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”.
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
- Bring up a list of repositories by using the the universal prefix `C-u M-t`.
- Press <tab> to get the list of actions associated with the repo.
- 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
- install `helm’ from github
- clone the `helm-cmd-t’ repository to “~/.emacs.d/helm-cmd-t”
- 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)
- 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)
- 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.
- 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