LoginSignup
7
6

More than 5 years have passed since last update.

Vimのバックアップファイルをlsで表示させないようにする

Posted at

vimを使い出してから勝手に作られるバックアップファイルが気になるので、lsコマンドを叩いた時に見えなくする。

調べてみると、macのlsとLinuxのlsとは挙動が違うらしいので、coreutilsをインストール

brew install coreutils
meganii-air:controllers meganii$ brew install coreutils
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/coreutils-8.23.mavericks.bottle.tar.gz
######################################################################## 100.0%
==> Pouring coreutils-8.23.mavericks.bottle.tar.gz
==> Caveats
All commands have been installed with the prefix 'g'.

If you really need to use these commands with their normal names, you
can add a "gnubin" directory to your PATH from your bashrc like:

    PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"

Additionally, you can access their man pages with normal names if you add
the "gnuman" directory to your MANPATH from your bashrc as well:

    MANPATH="/usr/local/opt/coreutils/libexec/gnuman:$MANPATH"

==> Summary
?  /usr/local/Cellar/coreutils/8.23: 214 files, 10M

coreutilsのlsを使う場合は、glsのようにプレフィックスにgを付ける。
gls -Bとかやれば、バックアップファイルを非表示に出来る。

-aオプションとかをつけたときにはバックアップファイルも表示したい場合は、以下のようにする。

alias ls="/usr/local/bin/gls --hide='*~'"

参考

lsでVimのバックアップファイルを非表示にする

7
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
6