aboutsummaryrefslogtreecommitdiffstats
path: root/bin/editor
blob: a7d5326ba9c0c4a7714e12eb89fc74f9c2716447 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh
# launch a text editor

exec_editor() {
    if [ -n "$1" ] && [ $(basename "$1") != "editor" ] \
        && which "$1" > /dev/null 2>&1
    then
        exec "$@"
    fi
}

exec_editor "$TEXTEDITOR" "$@"
[ -n "$GNOME_DESKTOP_SESSION_ID" ] && exec_editor gedit "$@"
[ -n "$KDE_FULL_SESSION" ] && exec_editor kwrite "$@"
exec_editor kwrite "$@"
exec_editor gedit  "$@"
exec_editor emacs  "$@"
exec_editor vim    "$@"
exec_editor nano   "$@"

echo "no text editor detected"