/helm-cmd-t

Helm functions to package directories (SCM controlled or not) as sources.

Primary LanguageEmacs Lisp

Purpose

This package provides a helm source for repository (git, hg, etc) based file selection. The emphasis is on fast file-name completion. The concept of a “respository” is configurable through `helm-cmd-t-repo-types’.

Each repository is cached for fast access (see `helm-cmd-t-cache-threshhold’), and in the future, options will be available to interact with the repository (i.e. grep, etc).

`helm-cmd-t’ is the simple predefined command that opens a file in the current repository, however, it’s highly recommended that you add a helm source like recentf that keeps track of recent files you’ve worked with. This way, you don’t have to worry about your respository cache being out of sync. See “helm-C-x-b.el” for an example of a custom drop-in replacement for `switch-to-buffer’ or “C-x b”.

What about helm-ls-git

This project is mostly concerned with packaging a directory tree as a source for Helm completion and grep.

  • Any directory can be converted into a helm source.
  • If the directory happen to be under SCM, then specialized commands are used to interact with it (e.g. “git grep”).
  • Caching is handled for faster access in large data sets.
  • Actually predates helm-ls-git.

helm-ls-git is better at integrating git features into the Helm ecosystem. It

  • Shows git status of files.
  • Adds git related actions to helm-find-file.
  • Magit is not required

Install

  1. install `helm’ from github
  2. clone the `helm-cmd-t’ repository to “~/.emacs.d/helm-cmd-t”
  3. add to your config

    (push “~/.emacs.d/helm-cmd-t” load-path) (require ‘helm-config) (require ‘helm-cmd-t) (global-set-key (kbd “M-t”) ‘helm-cmd-t)

  4. additional optional helm settings to make helm more responsive.

    (setq helm-ff-lynx-style-map nil helm-input-idle-delay 0.1 helm-idle-delay 0.1)

  5. have a look at helm-C-x-b.el for more examples of how to use the `helm-cmd-t’ source to craft your own master file chooser.
  6. read the self-documenting code for additional configuration options.

Creating an ad-hoc source

It’s easy to convert any file system directory into a source

(setq downloads-source (helm-cmd-t-get-create-source-dir "~/Downloads"))
(setq docs-source (helm-cmd-t-get-create-source-dir "~/Documents"))

(defun helm-cmd-t-ad-hoc-example ()
  "Choose file from test folder."
  (interactive)
  (helm :sources (list downloads-source docs-source)))

Combine sources to make custom file selectors

see helm-C-x-b.el

But what about fuzy matching?

Fuzzy matching is really interesting and useful when done well. Unfortunatley it hasn’t been done well in Helm.

See flx for a take on fuzzy (flex) matching similar to Sublime Text’s. Unfortunately it’s not available in Helm yet.

Helm’s space separated regexps require a few more keystrokes, but the results are consistent and predictable. See the header of helm-match-plugin.el for details.