Helm functions to package directories (SCM controlled or not) as sources.
Emacs Lisp
Latest commit 7fa3d4a Jan 25, 2017 @lewang lewang committed on GitHub Merge pull request #35 from emacs-helm/defclass-wip
Make compatible with Git helm (v2.5.0+)



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.


`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.

Once you do this, you don’t have to worry about your respository cache being out of sync nearly as newly created files will appear through other sources.

See “helm-C-x-b.el” for an example of a custom drop-in replacement for `switch-to-buffer’ or “C-x b”.

Cache management

For large repositories (>2000 in a git repository), it’s inefficient use a fresh file list whenever every time the source is used.

You can set `helm-cmd-t-cache-threshhold’ to define when you want this cache to kick in. It’s a balancing act between information “freshness” and UI responsiveness.

Once cacheing kicks in for a respo, you can manually invalidate it by

  1. Bring up a list of repositories by using the the universal prefix `C-u M-t`.
  2. Press <tab> to get the list of actions associated with the repo.
  3. Choose “INVALIDATE”.


Use the same steps as specified in “Cache management”, but choose the grep command, e.g. “git grep”

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


  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)
  1. 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)
  1. 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.
  2. 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."
  (helm :sources (list downloads-source docs-source)))

Combine sources to make custom file selectors

see helm-C-x-b.el