在状态栏中显示文件的路径 [英] Display path of file in status bar

查看:119
本文介绍了在状态栏中显示文件的路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

GNU Emacs 23.1.1



我想知道有没有办法在状态栏中显示文件的路径,而不是仅仅是文件名。 p>

我必须在许多目录中打开许多文件,有时我会忘记他​​们所在的目录。只要更容易显示状态栏中的某些路径,如果可能的话。



有时我的目录路径很长。



例如

  /projects/clientserver/trunk/src/client/client.c 

这样的状态栏,只显示最后两个目录。

  / src / client / client.c 

非常感谢任何建议,

解决方案

你所要求的是更改缓冲区名称。您可以使用 uniquify 自定义缓冲区的名称。它具有制作唯一缓冲区名称的几种方法。你最明显的选择是前进,它提供了你所要求的 - 将缓冲区名称作为前缀的一部分前缀。



但是,潜在的不利副作用。通常,通过追加一个后缀来使缓冲区名称变得独一无二。当您'c-x b'切换缓冲区时,如果键入foo,并且同时具有foo和foo,您将显示公共前缀,并给予提供后缀的功能。所以,'cx b foo'将让你完成所有的foo缓冲区的列表。



如果在'forward'模式下使用uniqueify您将具有bar / foo和baz / foo形式的缓冲区名称。现在,'c-x b foo'不会带你到一个foo缓冲区,或者让你完成以获取一个foo缓冲区列表。您必须记住添加到每个缓冲区名称的前缀。



我的建议是使用uniqify的reverse模式,它使用目录路径作为后缀。这可能稍微不那么直观,但在实践中更容易使用。所以现在你会有像foo \\和foo \\这样的缓冲区,这样一来你可以使用'cx b foo'并获得一个文件名为foo的所有缓冲区的列表, 。



所以,添加到你的.emacs文件,看看你喜欢的行为:

 (需要'uniquify)
(setq uniquify-buffer-name-style'reverse)


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 directories, and sometimes I forget what directory they are in. Just easier to display the some of the path in the status bar if that is possible.

Sometimes my directory paths are very long.

for example

/projects/clientserver/trunk/src/client/client.c

like this in the status bar, just display the last two directories.

/src/client/client.c

Many thanks for any suggestions,

解决方案

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)

这篇关于在状态栏中显示文件的路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆