Automatically
ls
aftercd
, because you know you always do it anyway. Why not make it automatic?
To install using a Zsh plugin manager, add the following to your .zshrc
- antidote:
antidote bundle zshzoo/cd-ls
- zcomet:
zcomet load zshzoo/cd-ls
- zgenom:
zgenom load zshzoo/cd-ls
- znap:
znap source zshzoo/cd-ls
To install manually, first clone the repo:
git clone https://github.com/zshzoo/cd-ls ${ZDOTDIR:-~}/.zplugins/cd-ls
Then, in your .zshrc, add the following line:
source ${ZDOTDIR:-~}/.zplugins/cd-ls/cd-ls.zsh
To install with Oh-My-Zsh, first clone the repo from an interactive Zsh session:
# make sure your $ZSH_CUSTOM is set
ZSH_CUSTOM=${ZSH_CUSTOM:-~/.oh-my-zsh/custom}
# now, clone the plugin
git clone https://github.com/zshzoo/cd-ls $ZSH_CUSTOM/plugins/cd-ls
Then, add the plugin to your Oh-My-Zsh plugins list in your .zshrc
# in your .zshrc, add this plugin to your plugins list
plugins=(... cd-ls)
To install with Prezto, first clone the repo from an interactive Zsh session:
# make sure your $ZPREZTODIR is set
ZPREZTODIR=${ZPREZTODIR:-~/.zprezto}
# clone the repo to a prezto contrib dir
git clone https://github.com/zshzoo/cd-ls $ZPREZTODIR/contrib/cd-ls/external
# set up the contrib
echo "source \${0:A:h}/external/cd-ls.plugin.zsh" > $ZPREZTODIR/contrib/cd-ls/init.zsh
Then, add the plugin to your Prezto plugins list in .zpreztorc
zstyle ':prezto:load' pmodule \
... \
cd-ls \
...
By setting the CD_LS_COMMAND
environmental variable, you can customize the command to be executed right after cd
. The command defaults to the standard ls
in case the CD_LS_COMMAND
variable is not set.