Imagine you are hacking on a project, working on some file, and you would like to quickly open another file of the same project, located in a completely different and possibly nested subdirectory. How to do this efficiently in Emacs?
Usual solutions are not fast enough
There are several ways how to address the task of "jumping around files": (a) use find-file or eshell and type the desired file name by heart, using auto-complete of pathnames; (b) use dired and jump between directories via caret etc; (c) use cedet or similar project file browser to jump between files or functions via sidebar; (d) use tags to jump to wanted function definition location; etc. However, the listed techniques are either relatively slow or work only for tagged source code, while we'd like to jump to a random lambda file of the project.
find-file-in-repository meets ido-ubiquitous
(Note that find-file-in-repository works with projects using git, mercurial, darcs, bazaar, monotone, or svn source code management system.)
Here is one possible configuration of these packages:
(require 'find-file-in-repository) (require 'ido) (require 'ido-ubiquitous) (require 'ido-vertical-mode) (global-set-key (kbd "C-x f") 'find-file-in-repository) (ido-ubiquitous-mode 1) (ido-vertical-mode) (setq ido-vertical-define-keys 'C-n-C-p-up-down-left-right)
The quick opening of project files is hooked under C-x f keyboard shortcut to create an analogy with the usual C-x C-f file opening shortcut.
Consider we are working on, say, fuzzy tokeniser in Invenio and we would like to quickly open, say, search engine API documentation. In other words, we are editing:
and we would like to jump to:
Here is the key sequence to achieve this:
C-x f s e a RET
It takes only five keystrokes, thanks to fuzzy ido mapping of s e a to mean search-engine-api.webdoc based on starting letters of the file name. Since there is no other file named like this, ido offers search engine API guide as the first auto-complete hit, so it is sufficient to press RET without further ado.
Learning from the past
Morever, ido learns from user's past actions and behaviour, so if you happen to edit more frequently websearch_templates.py rather than websubmit_templates.py, because you are working more with the Search component rather than the Submit component, then typing:
C-x f wstempl RET
will bring up the "correct" search file rather then the submit file. In other words, w s can stand either for websearch or websubmit, depending on your past behaviour. Neat, isn't it?