]> git.sur5r.net Git - i3/i3/blob - i3-sensible-editor
d71a440bb1fe0c5c408ca8e18883f8ed114bb592
[i3/i3] / i3-sensible-editor
1 #!/bin/sh
2 # This script tries to exec an editor by trying some known editors if $EDITOR is
3 # not set.
4 #
5 # Distributions/packagers can enhance this script with a
6 # distribution-specific mechanism to find the preferred pager.
7 [ -n "$VISUAL" ] && which $VISUAL >/dev/null && exec $VISUAL "$@"
8 [ -n "$EDITOR" ] && which $EDITOR >/dev/null && exec $EDITOR "$@"
9
10 # Hopefully one of these is installed (no flamewars about preference please!):
11 which nano >/dev/null && exec nano "$@"
12 which vim >/dev/null && exec vim "$@"
13 which vi >/dev/null && exec vi "$@"
14 which emacs >/dev/null && exec emacs "$@"