LoginSignup
1
1

More than 5 years have passed since last update.

他人が編集できるファイルを強調表示する

Posted at

emacs の dired だと他人が編集できるファイルの場合、パーミション部分の w が赤く表示されるので ls でもやってみた。
.zshrc あたりに以下を追加

function ll(){
    if [[ -t 1 ]]; then
        ls --color=always -l $@ |
        perl -pe 's/(^(?:\s*?\d+[KMGTPEZY]? )?[^l][-rwxsS]{4})(w?)([-rxsS]{2,3})(w?)/$1\033[38;5;196m$2\033[0m$3\033[38;5;196m$4\033[0m/'
    else
        ls -l $@
    fi
}

ll -ill -sでも正しく色が付きます。

1
1
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
1
1