I have a very complex and dense structure of folders and files. I would like to open a file which is very far away from my home quickly in emacs.
C-x C-f
is not quick enough because I have to write the path which could be very long (example : /very/long/and/boring/path/which/make/me/use/tab/for/autocompletion/too/much/and/ruins/my/hands/with/repetitive/strain/injuries/my_file_finally.tex
)
So, is it another way, quicker, (than C-x C-f
) to open such file and, if not, is there a way to create shortcuts for the most used files ?
P-S : I don't want to move files (long paths means to me clean and organized computer).
I'll also mention
filecache.el
. It basically provides a specialized completion (which you can bind to a key for use when entering file names) which first completes on "filenames, regardless of directory", and once that is complete, cycles through the few directories where such files are found.In addition to the above answers, helm may be a good solution to your problem. While it does less than icicles in the realm of sophistocated pattern matching and creating/managing/saving complex sets of files, helm does what it does both well and fast (both from a keystrokes perspective and software/latency perspective). Just
M-x package-install <ret> helm <ret>
and you're set.First, helm can track
recenf
, a list of the files that you have used recently. JustM-x helm-recentf
and type a string/regex that will be matched to the file name you want, it will match it to filenames you have opened recently in real time. Scroll and enter to select the one.But wait! There's more: (Sorry if this is starting to sound like an advertisement) If you're on Linux (I'll assume that since you use slashes in your paths and it seems that the emacs+linux > mac+linux), you can use GNU locate, a tool for finding files anywhere on your system as long as the locate daemon has seen it before, which it probably has if the file has been around for any amount of time (see below for when it it hasn't). It's practically real time. The locate process is fast and helm streams the results in real time. The command for that is
M-x helm-locate
.Now, what if you want to find files in git/mercurial/bazaar/etc. projects? You can use projectile, a "project interaction library". With helm-projectile (you'll need both projectile and helm-projectile installed the same way you did helm itself). It will stream file/directory names and anything else into helm. Once again. All you need is to type a substring that matches anywhere, and helm will find it for you.
M-x helm-projectile
It's Github README says "helm is capable of a lot". There is much, much more to helm. Try helm-moccur, helm-ack (external package), helm-imenu, helm-browse-code, helm-tracker-search, helm-dabbrev etc. etc. etc.
And finally: why choose one? One thing that helm does really well is creating you own commands. Here's a function that searches all of the above.
I have this bound to
C-c o
See this answer to almost the same question. In particular, consider using (a) Dired bookmarks and the other project-related bookmarks in Bookmark+ and (b) the project-related aids in Icicles.
You can create abbreviations for long directory names -- see
directory-abbrev-alist
.OPTION # 1 -- one function per assigned key:
OPTION # 2 -- function with options:
OPTION # 3 -- right click context menu (popup):
OPTION # 4 -- menubar drop-down menu: