aboutsummaryrefslogtreecommitdiff
path: root/sh/profile.d/visual.sh
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2019-01-01 01:11:08 +1300
committerTom Ryder <tom@sanctum.geek.nz>2019-01-01 01:11:08 +1300
commite19bb8fb3c8350bee288327abd978a59eb3dc0f7 (patch)
tree754d2d883b27477f53f0fece44ef9edc7e4238f0 /sh/profile.d/visual.sh
parentMerge branch 'release/v4.2.0' (diff)
parentBump VERSION (diff)
downloaddotfiles-954586e6ed7dfbd525e6ec8d1adc4f0c0bc0a48e.tar.gz (sig)
dotfiles-954586e6ed7dfbd525e6ec8d1adc4f0c0bc0a48e.zip
Merge branch 'release/v4.3.0'v4.3.0
* release/v4.3.0: Bump VERSION Switch to using GNU Emacs on development machines Trim some trailing whitespace Clarify control flow in shell scripts Add clarifying comment Translate a short-circuit into a conditional Add a cheeky error message to sd() Strip trailing slashes from sd() target Correct error message from sd()
Diffstat (limited to 'sh/profile.d/visual.sh')
-rw-r--r--sh/profile.d/visual.sh10
1 files changed, 8 insertions, 2 deletions
diff --git a/sh/profile.d/visual.sh b/sh/profile.d/visual.sh
index 119d81c7..94aee963 100644
--- a/sh/profile.d/visual.sh
+++ b/sh/profile.d/visual.sh
@@ -1,3 +1,9 @@
-# Use first found implementation of vi(1)
-VISUAL='vi'
+# If emacs is installed, and ~/.emacs exists, use emacs as the visual editor;
+# otherwise, use the system's vi
+if command -v emacs >/dev/null 2>&1 &&
+ [ -f "$HOME"/.emacs ] ; then
+ VISUAL=emacs
+else
+ VISUAL=vi
+fi
export VISUAL