/cd-ls

Automatically `ls` after `cd`

Primary LanguageShellMIT LicenseMIT

cd-ls

License built for works with prezto works with ohmyzsh

Automatically ls after cd, because you know you always do it anyway. Why not make it automatic?

Installation

Install with a Zsh plugin manager

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

Install manually, without a plugin manager

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

Install for Oh-My-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)

Install for Prezto

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 \
  ...

Configuration

CD_LS_COMMAND

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.