aboutsummaryrefslogtreecommitdiff
path: root/sh/profile.d/editor.sh
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2017-03-09 10:03:33 +1300
committerTom Ryder <tom@sanctum.geek.nz>2017-03-09 10:03:33 +1300
commitc3d4f097a7282f81d4c0efc702efdb6e99cb218c (patch)
tree14487758fd655d5c09a910ab1908bf1a29cd03bc /sh/profile.d/editor.sh
parentUpdate submodules (diff)
downloaddotfiles-c3d4f097a7282f81d4c0efc702efdb6e99cb218c.tar.gz
dotfiles-c3d4f097a7282f81d4c0efc702efdb6e99cb218c.zip
Use env vars not shell funcs for vim check
Set EDITOR and VISUAL appropriately based on what's on the system. We can't assume ed(1) unfortunately, but ex(1) should be there.
Diffstat (limited to 'sh/profile.d/editor.sh')
-rw-r--r--sh/profile.d/editor.sh8
1 files changed, 6 insertions, 2 deletions
diff --git a/sh/profile.d/editor.sh b/sh/profile.d/editor.sh
index ee0da70b..5d6b249e 100644
--- a/sh/profile.d/editor.sh
+++ b/sh/profile.d/editor.sh
@@ -1,3 +1,7 @@
-# Set command-line editor
-EDITOR=ed
+# Set command-line editor; ed if we've got it (!), but ex will do fine
+if command -v ed >/dev/null 2>&1 ; then
+ EDITOR=ed
+else
+ EDITOR=ex
+fi
export EDITOR