| 1 |
#!/bin/sh |
| 2 |
# |
| 3 |
# This code is released in public domain by Han Boetes <[email protected]> |
| 4 |
# |
| 5 |
# This script tries to exec an editor by trying some known editors if $EDITOR is |
| 6 |
# not set. |
| 7 |
# |
| 8 |
# Distributions/packagers can enhance this script with a distribution-specific |
| 9 |
# mechanism to find the preferred editor |
| 10 |
|
| 11 |
# Hopefully one of these is installed (no flamewars about preference please!): |
| 12 |
for editor in "$VISUAL" "$EDITOR" nano nvim vim vi emacs pico qe mg jed gedit mcedit gvim; do |
| 13 |
if command -v "$editor" > /dev/null 2>&1; then |
| 14 |
exec "$editor" "$@" |
| 15 |
fi |
| 16 |
done |