Make test for nvim compatible with macOS.
dblume

dblume commited on 2024-03-14 11:10:18
Showing 1 changed files, with 1 additions and 1 deletions.


Could have used

   hash <the_command> # For regular commands. Or...
   type <the_command> # To check built-ins and keywords

But why not just go with POSIX compatibility?
... ...
@@ -114,7 +114,7 @@ alias grep='grep --color=auto'
114 114
 alias fgrep='fgrep --color=auto'
115 115
 alias egrep='egrep --color=auto'
116 116
 alias tmux='tmux -2u'
117
-if [ -f /usr/bin/nvim ]; then
117
+if command -v nvim &> /dev/null; then
118 118
     alias vim='nvim'
119 119
     alias vim-='nvim +"setl buftype=nofile" -'
120 120
     alias vimdiff='nvim -d'
121 121