I have two files with the same name but in different directories:
apples/main.cpp
oranges/main.cpp
I open them in one emacs window via emacs apples/main.cpp oranges/main.cpp
When I use C-x b
to switch between these two buffers, the buffer names are "main.cpp" and "main.cpp<2>". I would love to be able to see the full path of these two files when switching buffers, so that I may disambiguate between the apples and the oranges version. Is there a way to do this?
One way could be to modify whatever code generates the <2> after the second main.cpp when Emacs detects that a buffer with that name is already open. However, I couldn't find how to do this.
Expanding on Tomasz's answer.
There are other options for uniquify-buffer-name-style, besides forward, that you may consider:
Files /foo/bar/mumble/name and /baz/quux/mumble/name would have the following buffer names in the various styles:
If you want to strip common directory suffixes of conflicting files, add the line below to your emacs init file.
(setq uniquify-strip-common-suffix t)
Now, if you open /a1/b/c/d and /a2/b/c/d, the buffer names will say "d|a1" and "d|a2" instead of "d|a1/b/c" and "d|a2/b/c".
Use lusty explorer. Configure it with:
Use uniquify. I use it like that: