diff --git a/update-completion-links.zsh b/update-completion-links.zsh index 80f4c33..12a6102 100755 --- a/update-completion-links.zsh +++ b/update-completion-links.zsh @@ -11,7 +11,7 @@ for completion in $zsh_completions/src/_*; do # Remove existing completion file if it exists. [ -f $symlink ] && rm $symlink # Check if the command exists on the PATH. - if which ${name:1} &> /dev/null; then + if command -v ${name:1} &> /dev/null; then # Symlink the completion for the existing command. [ `uname` = Darwin ] && \ ln -s $completion $symlink || ln -sr $completion $symlink diff --git a/zshenv b/zshenv index 43ef38b..1ec0d82 100644 --- a/zshenv +++ b/zshenv @@ -37,7 +37,7 @@ export CCACHE_CONFIGPATH=$HOME/.config/ccache export CCACHE_DIR=$HOME/.cache/ccache # Add default CMake generator -which ninja &> /dev/null && \ +command -v ninja &> /dev/null && \ export CMAKE_GENERATOR=Ninja # Remove duplicates from environment variables @@ -47,8 +47,12 @@ typeset -U MANPATH; export MANPATH typeset -U INFOPATH; export INFOPATH # Set default editor. -which vim &> /dev/null && \ - export EDITOR=`which vim` +if command -v nvim &> /dev/null; then + export EDITOR=`command -v nvim` +elif command -v vim &> /dev/null; then + export EDITOR=`command -v vim` +fi +export GIT_EDITOR=$EDITOR # Use ~/.local for pip installs on macOS [ "`uname`" = "Darwin" ] && export PYTHONUSERBASE=$HOME/.local @@ -77,24 +81,24 @@ export PYLINTHOME=~/.local/share/pylint export VIRTUAL_ENV_DISABLE_PROMPT=1 # If pinentry-curses exists, use it for lastpass-cli -which pinentry-curses &> /dev/null && \ +command -v pinentry-curses &> /dev/null && \ export LPASS_PINENTRY=pinentry-curses # Teach these some XDG Base Directory Spec manners export IPYTHONDIR=$HOME/.config/ipython -which cargo &> /dev/null && \ +command -v cargo &> /dev/null && \ export CARGO_HOME=$HOME/.local/share/cargo -if which ccache &> /dev/null; then +if command -v ccache &> /dev/null; then export CCACHE_CONFIGPATH=$HOME/.config/ccache.conf export CCACHE_DIR=$HOME/.cache/ccache fi -which conan &> /dev/null && \ +command -v conan &> /dev/null && \ export CONAN_USER_HOME=$HOME/.local/share/conan -which docker &> /dev/null && \ +command -v docker &> /dev/null && \ export DOCKER_CONFIG=$HOME/.local/share/docker export GTK_RC_FILES=$HOME/.config/gtk/gtkrc export GTK2_RC_FILES=$HOME/.config/gtk-2.0/gtkrc -which rustup &> /dev/null && \ +command -v rustup &> /dev/null && \ export RUSTUP_HOME=$HOME/.local/share/rustup export PYLINTHOME=$HOME/.cache/pylint # TODO: terminfo diff --git a/zshrc b/zshrc index e99bbd0..7f16805 100644 --- a/zshrc +++ b/zshrc @@ -68,7 +68,7 @@ autoload -U compinit compinit # Add pip to the old completion engine if present -if which pip &> /dev/null; then +if command -v pip &> /dev/null; then function _pip_completion { local words cword read -Ac words @@ -178,9 +178,9 @@ frequent-directory Projects="$HOME/Projects" # Aliases alias grep='grep --color=always' -which cmake &> /dev/null && \ +command -v cmake &> /dev/null && \ alias cninja='cmake -GNinja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON' -which ssh &> /dev/null && \ +command -v ssh &> /dev/null && \ alias ssh='TERM=xterm-256color ssh' alias weather="curl wttr.in" alias cls="clear && printf '\e[3J'" @@ -188,15 +188,15 @@ alias cls="clear && printf '\e[3J'" case `uname` in Linux) alias ls='ls -F --color=auto' - if which cgdb &> /dev/null; then + if command -v cgdb &> /dev/null; then alias debug='cgdb --args' - elif which gdb &> /dev/null; then + elif command -v gdb &> /dev/null; then alias debug='gdb --args' fi ;; Darwin) alias ls='ls -GFh' - which lldb &> /dev/null && \ + command -v lldb &> /dev/null && \ alias debug='lldb --' ;; esac