In Bash, running tmux ls
works properly. However, in Zsh, I get this error:
tmux: unknown option -- p
usage: list-sessions [-F format]
I suspect this is because Zsh is replacing ls
of the command with my custom alias for ls
:
alias -g ls='ls -p --color'
I tried setting alias -g tmux\ ls='tmux list-sessions'
, but that didn't work.
Is there any way to change Zsh's alias expansion/substitution behavior?
You are defining ls
as a global alias, meaning it is expanded anywhere the shell sees ls
, not just when it is used as a command. Just drop the -g
option:
alias ls='ls -p --color'