| 1 |
.\" -*- nroff -*- |
| 2 |
.TH SENSIBLE-EDITOR 1 "28 Aug 2022" Debian |
| 3 |
.SH NAME |
| 4 |
sensible-editor \- launch sensibly chosen text editor |
| 5 |
.SH SYNOPSIS |
| 6 |
.B sensible-editor |
| 7 |
.RI [ OPTIONS ...] |
| 8 |
.SH DESCRIPTION |
| 9 |
.B sensible-editor |
| 10 |
makes sensible decisions on which editor to call. |
| 11 |
Programs in Debian can invoke this script to get a good default editor. |
| 12 |
.PP |
| 13 |
.B sensible-editor |
| 14 |
looks for an appropriate choice of editor in a series of places, |
| 15 |
and uses the first candidate that works. |
| 16 |
It starts by checking environment variables, |
| 17 |
followed by a variable defined via |
| 18 |
.BR select-editor , |
| 19 |
then tries the default editor command defined by the alternatives system, |
| 20 |
with a series of hard-coded command names as fallbacks. |
| 21 |
.PP |
| 22 |
Variables will be skipped if unset or null, |
| 23 |
but may include extra whitespace-separated parameters such as a |
| 24 |
.B \-\-verbose |
| 25 |
flag. |
| 26 |
Once |
| 27 |
.B sensible-editor |
| 28 |
has a candidate commandline, |
| 29 |
it will try to run it |
| 30 |
(passing on the arguments it was given as the files to be edited). |
| 31 |
If this fails because the command couldn't be executed |
| 32 |
(exit code 126) |
| 33 |
or was not found |
| 34 |
(exit code 127), |
| 35 |
it tries the next candidate. |
| 36 |
.PP |
| 37 |
The specific candidates |
| 38 |
.B sensible-editor |
| 39 |
tries, in order, are: |
| 40 |
.IP \(bu 2 |
| 41 |
.B $VISUAL |
| 42 |
\(en see |
| 43 |
.BR environ (7) |
| 44 |
.IP \(bu 2 |
| 45 |
.B $EDITOR |
| 46 |
\(en see |
| 47 |
.BR environ (7) |
| 48 |
.IP \(bu 2 |
| 49 |
.B $SENSIBLE_EDITOR |
| 50 |
.IP \(bu 2 |
| 51 |
.B $SELECTED_EDITOR |
| 52 |
\(en see |
| 53 |
.BR select-editor (1) |
| 54 |
.IP \(bu 2 |
| 55 |
.B editor |
| 56 |
\(en see |
| 57 |
.BR editor (1), |
| 58 |
.BR update-alternatives (1) |
| 59 |
.IP \(bu 2 |
| 60 |
.BR nano (1) |
| 61 |
.IP \(bu 2 |
| 62 |
.BR nano-tiny (1) |
| 63 |
.IP \(bu 2 |
| 64 |
.BR vi (1) |
| 65 |
.PP |
| 66 |
If all of these fail, |
| 67 |
.B sensible-editor |
| 68 |
errors out. |
| 69 |
This system is designed to make it easy for individual users to |
| 70 |
set a personal and/or temporary default, |
| 71 |
overriding the system-wide defaults. |
| 72 |
.SH "SEE ALSO" |
| 73 |
.BR sensible-browser (1), |
| 74 |
.BR sensible-pager (1), |
| 75 |
.BR select-editor (1), |
| 76 |
.BR environ (7), |
| 77 |
.BR editor (1), |
| 78 |
.BR \%update-alternatives (1) |
| 79 |
.SH "CONFORMING TO" |
| 80 |
The behavior of |
| 81 |
.B sensible-utils |
| 82 |
under a Debian system is documented in |
| 83 |
section 11.4 of Debian-Policy, |
| 84 |
available under /usr/share/doc/debian-policy |
| 85 |
if debian-policy is installed, |
| 86 |
or online at https://www.debian.org/doc/debian-policy/ |