So I've got ZSH doing all this cool stuff now, but what would be REALLY awesome is if I could get it to run 'ls -a' implicitly after every time I call 'cd'. I figure this must go in the .zlogin file or the .aliases file, I'm just not sure what the best solution is. Thoughts? Reference material?
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 }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With