detect presence of nvim

Sun, 05 Mar 2023 23:19:03 -0500

author
Meredith Howard <mhoward@roomag.org>
date
Sun, 05 Mar 2023 23:19:03 -0500
changeset 1066
c826661721a8
parent 1065
23229c179f82
child 1067
08675f3a85f6

detect presence of nvim

.profile.common file | annotate | diff | comparison | revisions
--- a/.profile.common
+++ b/.profile.common
@@ -13,17 +13,6 @@ HISTIGNORE="ls:cd:cd -:pwd:exit:date:pri
 
 export MANPATH=$HOME/.man:$HOME/.local/share/man:
 
-# TODO: detect presence
-export EDITOR=nvim
-export SUDO_EDITOR=$HOME/bin/privim
-export LESS='Ri'
-export GPG_TTY="$(tty)"
-
-export PERL_CPANM_OPT='-nq --prompt'
-
-export ASDF_CONCURRENCY='2'
-export RUBY_EXTRA_CONFIGURE_OPTIONS="--enable-shared --enable-install-doc"
-
 if [ -d ~/perl5/lib ]; then
   eval "$(perl -Mlocal::lib)"
 fi
@@ -36,6 +25,23 @@ if [ -d ~/.asdf ]; then
   source ~/.asdf/asdf.sh
 fi
 
+if [ -x "$(command -v nvim)" ]; then
+  export EDITOR=nvim
+  alias vim=nvim
+  alias view="nvim -R"
+else
+  export editor=vim
+fi
+
+export SUDO_EDITOR=$HOME/bin/privim
+export LESS='Ri'
+export GPG_TTY="$(tty)"
+
+export PERL_CPANM_OPT='-nq --prompt'
+
+export ASDF_CONCURRENCY='2'
+export RUBY_EXTRA_CONFIGURE_OPTIONS="--enable-shared --enable-install-doc"
+
 alias l='ls -lFh'     #size,show type,human readable
 alias la='ls -lAFh'   #long list,show almost all,show type,human readable
 alias lt='ls -ltFh'   #long list,sorted by date,show type,human readable

mercurial