ZSH: automatically run ls after every cd

EDIT:
After looking at documentation (zshbuiltins, description of cd builtin or hook functions) I found a better way: it is using either chpwd function:

function chpwd() {
    emulate -L zsh
    ls -a
}

or using chpwd_functions array:

function list_all() {
    emulate -L zsh
    ls -a
}
chpwd_functions=(${chpwd_functions[@]} "list_all")

Put the following into .zshrc:

function cd() {
    emulate -LR zsh
    builtin cd $@ &&
    ls -a
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)