Only add aliases when the target command exists

Previously aliases for commands were added without checking if the
command being aliased existed first, this is now not the case.
This commit is contained in:
Kenneth Benzie 2018-04-21 17:18:43 +01:00
parent 5a1ef73524
commit 9e77e83d7f

17
zshrc
View File

@ -130,20 +130,27 @@ fi
# Aliases
alias grep='grep --color=always'
alias cninja='cmake -GNinja -DCMAKE_EXPORT_COMPILE_COMMNADS=ON'
alias ssh='TERM=xterm-256color ssh'
which cmake &> /dev/null && \
alias cninja='cmake -GNinja -DCMAKE_EXPORT_COMPILE_COMMNADS=ON'
which ssh &> /dev/null && \
alias ssh='TERM=xterm-256color ssh'
case `uname` in
Linux)
[ "$TMUX" = "" ] && \
alias cls="printf '\ec'" || alias cls="clear && printf '\e[3J'"
alias cls="printf '\ec'" || \
alias cls="clear && printf '\e[3J'"
alias ls='ls -F --color=auto'
alias debug='cgdb --args'
which cgdb &> /dev/null && \
alias debug='cgdb --args' || \
which gdb &> /dev/null && \
alias debug='gdb --args'
;;
Darwin)
alias cls="clear && printf '\e[3J'"
alias ls='ls -GFh'
alias debug='lldb --'
which lldb &> /dev/null && \
alias debug='lldb --'
;;
esac