From c3d4f097a7282f81d4c0efc702efdb6e99cb218c Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 9 Mar 2017 10:03:33 +1300 Subject: 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. --- sh/profile.d/visual.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'sh/profile.d/visual.sh') diff --git a/sh/profile.d/visual.sh b/sh/profile.d/visual.sh index 95eb1d5d..d03da255 100644 --- a/sh/profile.d/visual.sh +++ b/sh/profile.d/visual.sh @@ -1,3 +1,7 @@ -# Set visual editor -VISUAL=vi +# Set visual editor; vim if we've got it, but vi will do fine +if command -v vim >/dev/null 2>&1 ; then + VISUAL=vim +else + VISUAL=vi +fi export VISUAL -- cgit v1.2.3