Display path of file in status bar

后端 未结 5 684
遇见更好的自我
遇见更好的自我 2021-01-30 21:41

GNU Emacs 23.1.1

I am wondering is there a way to display the path of the file in the status bar, instead of just the filename.

I have to open many files in many

5条回答
  •  失恋的感觉
    2021-01-30 22:01

    What you are asking is to change the buffer name. You can customize how buffers are named using uniquify. It has several methods for making unique buffer names. The most obvious choice for you is 'forward' which gives exactly what you ask -- prefix the buffer name with part of the path as a prefix.

    However, this has a potentially unwanted side effect. Normally, buffer names are made unique by appending a suffix. When you do 'c-x b' to switch buffers, if you type "foo" and you have both "foo" and "foo<1>" you will be shown the common prefix and be given the ability to supply the suffix. So, 'c-x b foo' will let you do completion where you see a list of all of the "foo" buffers.

    If you use uniqueify in 'forward' mode, you'll have buffer names of the form "bar/foo" and "baz/foo". Now, 'c-x b foo' won't take you to a foo buffer, or allow you to do completion to get a list of foo buffers. You must remember the prefix that is added to each buffer name.

    My advice is to use the 'reverse' mode of uniqify, which uses the directory path as a suffix. It's perhaps slightly less intuitive, but easier to use in practice. So now you would have buffers like "foo\bar" and "foo\baz", again giving you the advantage of being able to do 'c-x b foo' and getting a list of all buffers with a filename of "foo".

    So, add this to your .emacs file and see if you like the behavior:

    (require 'uniquify)
    (setq uniquify-buffer-name-style 'reverse)
    

提交回复
热议问题