I’ve long been a fan of GNU Emacs’ file navigation model. I’ve been switching buffers with C-x C-f ..., C-x b; C-mouse-1 occasionally.
However, recently I’ve been finding myself programming on projects that have sets of several files with the same names, but in different directories, along these lines:
package/message.py
package/message.zcml
package/ui/message.py
package/ui/message.zcml
package/ui2/message.py
package/ui2/message.zcml
In these circumstances my usual buffer switching tools are not very efficient. It’s hard to remember whether the file I want is in the buffer message.py<2> or message.py<3>, and it’s pretty fussy to switch between them with C-x b. What I would like, perhaps, is something like tab bar or a menu where I could arrange the files I’m working on and have them maintain their spatial arrangement, so that I could quickly switch beetween them. I briefly looked at speedbar and tabbar-mode, but didn’t find much help. Any suggestions?
Along with using
uniquifyto obtain more helpful buffer names, you might want to look into usingibuffergroups for your “spatial arrangement” needs. You can create named groups based on sets of filters, and you can filter on file path(*), so you could easily have separate groups for each of those directories.I highly recommend binding C-xC-b to
ibufferas a replacement for the default.Aside from that, if you use
ido-modein conjunction with theuniquifyconfig, then when you type C-xb to switch buffers, you can type and match against any part of the (uniquified) buffer name. If you enableido-enable-flex-matching(or alternatively, use something like LustyExplorer instead) then you can type unconnected parts of that buffer name, and the fuzzy matching will narrow the list intelligently (e.g. typing “mez2” might be enough to isolate “message.zcml|ui2”).(*) Personally I prefer ibuffer to match dired buffers as well as file buffers when I make a filename filter, so I redefine that filter accordingly: