Have the command "vim" launch nvim where possible
dblume

dblume commited on 2024-03-12 20:58:54
Showing 1 changed files, with 7 additions and 4 deletions.


Alias vim, vim-, and vimdiff
... ...
@@ -113,11 +113,14 @@ export RIPGREP_CONFIG_PATH=$HOME/.ripgreprc
113 113
 alias grep='grep --color=auto'
114 114
 alias fgrep='fgrep --color=auto'
115 115
 alias egrep='egrep --color=auto'
116
-alias vim-='vim +"setl buftype=nofile" -'
117 116
 alias tmux='tmux -2u'
118
-alias nv='nvim'
119
-alias nv-='nvim +"setl buftype=nofile" -'
120
-alias nvdiff='nvim -d'
117
+if [ -f /usr/bin/nvim ]; then
118
+    alias vim='nvim'
119
+    alias vim-='nvim +"setl buftype=nofile" -'
120
+    alias vimdiff='nvim -d'
121
+else
122
+    alias vim-='vim +"setl buftype=nofile" -'
123
+fi
121 124
 
122 125
 # colored GCC warnings and errors
123 126
 export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
124 127