Beef up install.sh editor detection
This commit is contained in:
parent
96616b2751
commit
580c5b5e1d
|
@ -386,9 +386,37 @@ else
|
||||||
## Verify that the specified editor program exists
|
## Verify that the specified editor program exists
|
||||||
##-------------------------------------------------------
|
##-------------------------------------------------------
|
||||||
|
|
||||||
DEFAULTEDITOR=${EDITOR:-‘/bin/vi’}
|
# If user specified an editor in $path_to_vi or $TWEDITOR, try that first.
|
||||||
TWEDITOR=${TWEDITOR:-$DEFAULTEDITOR}
|
# $path_to_vi defaults to /usr/bin/vi, so we usually succeed here.
|
||||||
TWEDITOR_PATH=`command -v $TWEDITOR`
|
#
|
||||||
|
if [ -n ${TWEDITOR} ]; then
|
||||||
|
TWEDITOR_PATH=`command -v $TWEDITOR`
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If user's environment includes $EDITOR, try that next
|
||||||
|
if [ -n ${EDITOR} ] && [ -z ${TWEDITOR_PATH} ]; then
|
||||||
|
TWEDITOR_PATH=`command -v $EDITOR`
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Ok, now search path for vi
|
||||||
|
if [ -z ${TWEDITOR_PATH} ]; then
|
||||||
|
TWEDITOR_PATH=`command -v vi`
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Try vim in case there isn't a link named vi
|
||||||
|
if [ -z ${TWEDITOR_PATH} ]; then
|
||||||
|
TWEDITOR_PATH=`command -v vim`
|
||||||
|
fi
|
||||||
|
|
||||||
|
# No vi/vim? See if nano is present
|
||||||
|
if [ -z ${TWEDITOR_PATH} ]; then
|
||||||
|
TWEDITOR_PATH=`command -v nano`
|
||||||
|
fi
|
||||||
|
|
||||||
|
# No vi or nano? See if emacs is available
|
||||||
|
if [ -z ${TWEDITOR_PATH} ]; then
|
||||||
|
TWEDITOR_PATH=`command -v emacs`
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -n ${TWEDITOR_PATH} ]; then
|
if [ -n ${TWEDITOR_PATH} ]; then
|
||||||
TWEDITOR=$TWEDITOR_PATH
|
TWEDITOR=$TWEDITOR_PATH
|
||||||
|
|
Loading…
Reference in New Issue