zsh: Use dictionary for command existence check
Use the `commands` dictionary from zsh instead of always calling `command`. Regex used: s/command -v \([^ ]*\) &>\/dev\/null/(( $+commands[\1] ))/g
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user