From c61126ec0bcdbd64339582d1b2e30bb18b6edadc Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Fri, 6 Mar 2015 18:00:57 +0400 Subject: [PATCH] =?UTF-8?q?utiliser=20vim=20ou=20EDITOR=20si=20emacs=20n'e?= =?UTF-8?q?st=20pas=20install=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- em | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/em b/em index 063b0bc..953d668 100755 --- a/em +++ b/em @@ -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