diff --git a/.config/zsh/.zprofile b/.config/zsh/.zprofile index d476845..bf19a01 100644 --- a/.config/zsh/.zprofile +++ b/.config/zsh/.zprofile @@ -35,17 +35,17 @@ if [[ ! "$PATH" =~ "$HOME/\.local/bin" ]]; then export PATH="$HOME/.local/bin${PATH:+:$PATH}" fi -if command -v nvim &>/dev/null; then +if (( $+commands[nvim] )); then export EDITOR=nvim -elif command -v vim &>/dev/null; then +elif (( $+commands[vim] )); then export EDITOR=vim -elif command -v vi &>/dev/null; then +elif (( $+commands[vi] )); then export EDITOR=vi -elif command -v nano &>/dev/null; then +elif (( $+commands[nano] )); then export EDITOR=nano fi -if command -v nvim &>/dev/null; then +if (( $+commands[nvim] )); then export MANPAGER="nvim -c 'set ft=man' -" else # https://www.tecmint.com/view-colored-man-pages-in-linux/ @@ -59,7 +59,7 @@ else fi # Show also hidden files per default but ignore files in '.git' directories. -if command -v rg &>/dev/null; then +if (( $+commands[rg] )); then # Also respect gitignores FZF_DEFAULT_COMMAND="rg --hidden --files -g '!.git'" else @@ -68,7 +68,7 @@ fi export FZF_DEFAULT_COMMAND # Setup LS_COLORS -if command -v dircolors &>/dev/null; then +if (( $+commands[dircolors] )); then if [[ -e "$XDG_CONFIG_HOME"/dircolors/dircolors ]]; then eval "$(dircolors -b "$XDG_CONFIG_HOME"/dircolors/dircolors)" else diff --git a/.config/zsh/zshrc.d/40-functions.zsh b/.config/zsh/zshrc.d/40-functions.zsh index d21ae4c..152c060 100644 --- a/.config/zsh/zshrc.d/40-functions.zsh +++ b/.config/zsh/zshrc.d/40-functions.zsh @@ -48,9 +48,9 @@ conf() { local CONF_EDITOR if [[ -n "$EDITOR" ]]; then CONF_EDITOR="$EDITOR" - elif command -v vim &>/dev/null; then + elif (( $+commands[vim] )); then CONF_EDITOR=vim - elif command -v nano &>/dev/null; then + elif (( $+commands[nano] )); then CONF_EDITOR=nano else CONF_EDITOR=cat diff --git a/.config/zsh/zshrc.d/90-external-plugins/70-direnv b/.config/zsh/zshrc.d/90-external-plugins/70-direnv index d751f7a..4f8bac3 100644 --- a/.config/zsh/zshrc.d/90-external-plugins/70-direnv +++ b/.config/zsh/zshrc.d/90-external-plugins/70-direnv @@ -1 +1 @@ -! command -v direnv &>/dev/null || eval "$(direnv hook zsh)" +! (( $+commands[direnv] )) || eval "$(direnv hook zsh)"