utiliser vim ou EDITOR si emacs n'est pas installé

This commit is contained in:
Jephté Clain 2015-03-06 18:00:57 +04:00
parent d86717bfd3
commit c61126ec0b
1 changed files with 19 additions and 7 deletions

20
em
View File

@ -1,11 +1,23 @@
#!/bin/sh #!/bin/bash
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 # -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
GEOMETRY=150x50+0+67 EMACS_GEOMETRY=150x50+0+67
emacs="`which emacs`" # Essayer avec emacs
emacs="$(which emacs 2>/dev/null)"
if [ -x "$emacs" ]; then
if [ -n "$DISPLAY" ]; then if [ -n "$DISPLAY" ]; then
exec "$emacs" -g $GEOMETRY "$@" & exec "$emacs" -g "$EMACS_GEOMETRY" "$@" &
else else
exec "$emacs" "$@" exec "$emacs" "$@"
fi fi
fi
# puis avec vim
vim="$(which vim 2>/dev/null)"
[ -x "$vim" ] && exec "$vim" "$@"
# puis avec $EDITOR
[ -n "$EDITOR" ] && exec "$EDITOR"
exit 1