aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sh/profile.d/visual.sh9
-rw-r--r--vim/vimrc.stub15
2 files changed, 16 insertions, 8 deletions
diff --git a/sh/profile.d/visual.sh b/sh/profile.d/visual.sh
index 50b8b423..19c8f490 100644
--- a/sh/profile.d/visual.sh
+++ b/sh/profile.d/visual.sh
@@ -1,3 +1,8 @@
-# For a visual editor, use whichever kind of vi we get when we invoke 'vi'
-VISUAL='vi'
+# For a visual editor, use Vim explicitly if we've got it, but otherwise any vi
+# implementation will be fine
+if command -v vim >/dev/null 2>&1 ; then
+ VISUAL='vim'
+else
+ VISUAL='vi'
+fi
export VISUAL
diff --git a/vim/vimrc.stub b/vim/vimrc.stub
index d50cee55..f9ad4d4f 100644
--- a/vim/vimrc.stub
+++ b/vim/vimrc.stub
@@ -1,13 +1,16 @@
" We have a big, important decision to make here.
"
" Check that we’re not running in 'compatible' mode, nor that the environment
-" calls for the same, and that we’re running Vim v7.0.0 or newer. If it’s all
-" clear, we can load the main vimrc file from ~/.vim/vimrc to use Vim in all
-" of its incompatible glory, and then stop sourcing the rest of this file.
+" calls for the same, that we’re running Vim v7.0.0 or newer, and that we
+" haven't been invoked as just plain `vi`. If it’s all clear, we can load the
+" main vimrc file from ~/.vim/vimrc to use Vim in all of its incompatible
+" glory, and then stop sourcing the rest of this file.
"
-if !&compatible && !exists('$POSIXLY_CORRECT') && v:version >= 700
- runtime vimrc
- finish
+if !&compatible && !exists('$POSIXLY_CORRECT')
+ if v:version >=700 && v:progname !=# 'vi'
+ runtime vimrc
+ finish
+ endif
endif
" If we got this far, it means we’re running a tiny, 'compatible', and/or