UNIX的なアレ

UNIX的なこととかいろいろ

uniquifyをつかって同一ファイル名を区別する


emacsネタです。
もうanything.elがないと生きていけない身体なくらいにanythingな日々をおくっていますが、anything-buffers-listしたときに同一のファイル名があるとこれがまた厄介です。
しかし、uniquifyを使うとファイルの区別を目視で行うのが簡単になります。

利用方法

uniquify自体はemacsに同梱されているます。なので以下の2行を.emacsとかに追記してあげるだけでOKです。

(require 'uniquify)
(setq uniquify-buffer-name-style 'post-forward-angle-brackets)

こんな感じになる


上記の設定をいれた上で、anything-buffers-listしてみるとこんな感じで表示されどのディレクトリに所属しているファイルなのかがはっきりとわかります。
uniquify-buffer-name-styleをいじると表示方法はいろいろと変更できます。

uniquify-buffer-name-style is a variable defined in `uniquify.el'.
Its value is post-forward-angle-brackets

Documentation:
If non-nil, buffer names are uniquified with parts of directory name.
The value determines the buffer name style and is one of `forward',
`reverse', `post-forward', or `post-forward-angle-brackets'.
For example, files `/foo/bar/mumble/name' and `/baz/quux/mumble/name'
would have the following buffer names in the various styles:
  forward        bar/mumble/name  quux/mumble/name
  reverse        name\mumble\bar  name\mumble\quux
  post-forward   name|bar/mumble  name|quux/mumble
  post-forward-angle-brackets   name<bar/mumble>  name<quux/mumble>
  nil            name  name<2>
Of course, the "mumble" part may be stripped as well, depending on the setting
of `uniquify-strip-common-suffix'.

You can customize this variable.

関連リンク