auto-ls をいい感じにする
esa と typora で個人wiki 的な感じのもの作って満足 して public なoutputをサボっていたので 小ネタを書く
auto-ls
cd したときに デフォルトで 自動的に ls
と git status
してくれるやつ, history が汚染されにくくなるし便利。
不満点
出力が冗長, scipy に適当にfile を追加してみる
~/gitrepos/github.com/scipy/scipy master* ❯ touch hoge && cd . appveyor.yml CONTRIBUTING.rst hoge MANIFEST.in README.rst setup.py tools benchmarks doc INSTALL.rst.txt pavement.py runtests.py site.cfg.example tox.ini codecov.yml HACKING.rst.txt LICENSE.txt pytest.ini scipy THANKS.txt On branch master Your branch is up to date with 'origin/master'. Untracked files: (use "git add <file>..." to include in what will be committed) hoge nothing added to commit but untracked files present (use "git add" to track)
対策
git status --short
と exa
を使う
exa について
better ls, rust製
zshrc に以下を追加
export AUTO_LS_COMMANDS=(exa git-status-short) auto-ls-exa () { if type "exa" > /dev/null 2>&1; then; exa fi } auto-ls-git-status-short () { if [[ $(git rev-parse --is-inside-work-tree 2> /dev/null) == true ]]; then git status --short fi }
結果
出力が簡潔になっていい感じ, コードべた張りなのでわかりにくいが, exa 使ってるので色分けもいい感じ。
~/gitrepos/github.com/scipy/scipy master* ❯ cd . appveyor.yml CONTRIBUTING.rst hoge MANIFEST.in README.rst setup.py tools benchmarks doc INSTALL.rst.txt pavement.py runtests.py site.cfg.example tox.ini codecov.yml HACKING.rst.txt LICENSE.txt pytest.ini scipy THANKS.txt ?? hoge