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

26
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
GEOMETRY=150x50+0+67
EMACS_GEOMETRY=150x50+0+67
emacs="`which emacs`"
if [ -n "$DISPLAY" ]; then
exec "$emacs" -g $GEOMETRY "$@" &
else
exec "$emacs" "$@"
# Essayer avec emacs
emacs="$(which emacs 2>/dev/null)"
if [ -x "$emacs" ]; then
if [ -n "$DISPLAY" ]; then
exec "$emacs" -g "$EMACS_GEOMETRY" "$@" &
else
exec "$emacs" "$@"
fi
fi
# puis avec vim
vim="$(which vim 2>/dev/null)"
[ -x "$vim" ] && exec "$vim" "$@"
# puis avec $EDITOR
[ -n "$EDITOR" ] && exec "$EDITOR"
exit 1