aboutsummaryrefslogtreecommitdiff
path: root/sh/profile.d/editor.sh
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2017-03-24 14:02:59 +1300
committerTom Ryder <tom@sanctum.geek.nz>2017-03-24 14:02:59 +1300
commit2e28d5a885608fddd1e0b7464ba3c9582a9e8ca4 (patch)
treef2ac4ae683f7dd4cfa416813bf93838df0de256d /sh/profile.d/editor.sh
parent89f185d62638c682fc363d4747d8cef9c7f39fd5 (diff)
downloaddotfiles-2e28d5a885608fddd1e0b7464ba3c9582a9e8ca4.tar.gz
dotfiles-2e28d5a885608fddd1e0b7464ba3c9582a9e8ca4.zip
Add exm(1df) to work around Vim's screen-clearing
Diffstat (limited to 'sh/profile.d/editor.sh')
-rw-r--r--sh/profile.d/editor.sh11
1 files changed, 10 insertions, 1 deletions
diff --git a/sh/profile.d/editor.sh b/sh/profile.d/editor.sh
index 5d6b249e..307879fe 100644
--- a/sh/profile.d/editor.sh
+++ b/sh/profile.d/editor.sh
@@ -1,7 +1,16 @@
-# Set command-line editor; ed if we've got it (!), but ex will do fine
+# Ideally, we'd use plain old ed(1), but many Linux distributions don't install
+# it by default
if command -v ed >/dev/null 2>&1 ; then
EDITOR=ed
+
+# Failing that, if we have both vim(1) and exm(1df) in our $PATH, use the
+# latter to work around Vim's ex mode screen-clearing
+elif { command -v vim && command -v exm ; } >/dev/null 2>&1 ; then
+ EDITOR=exm
+
+# Otherwise, just call ex(1) directly
else
EDITOR=ex
fi
+
export EDITOR