mirror of
https://github.com/nix-community/home-manager.git
synced 2024-12-14 11:57:55 +00:00
home-manager: Check VISUAL before EDITOR for editor
Check VISUAL for a visual editor before EDITOR, as per Unix convention and as followed by Git, crontab, mutt, and other tools.
This commit is contained in:
parent
3c6f2dd59c
commit
b319781e30
2 changed files with 10 additions and 6 deletions
|
@ -97,7 +97,7 @@ Instantiate the configuration and print the resulting derivation\&.
|
||||||
|
|
||||||
.It Cm edit
|
.It Cm edit
|
||||||
.RS 16
|
.RS 16
|
||||||
Open the home configuration using the editor indicated by \fBEDITOR\fR\&.
|
Open the home configuration using the editor indicated by \fBVISUAL\fR or \fBEDITOR\fR\&.
|
||||||
.RE
|
.RE
|
||||||
.Pp
|
.Pp
|
||||||
|
|
||||||
|
|
|
@ -565,10 +565,14 @@ function presentNews() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function doEdit() {
|
function doEdit() {
|
||||||
if [[ ! -v EDITOR || -z $EDITOR ]]; then
|
if [[ ! -v VISUAL || -z $VISUAL ]]; then
|
||||||
# shellcheck disable=2016
|
if [[ ! -v EDITOR || -z $EDITOR ]]; then
|
||||||
_i 'Please set the $EDITOR environment variable' >&2
|
# shellcheck disable=2016
|
||||||
return 1
|
_i 'Please set the $EDITOR or $VISUAL environment variable' >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
EDITOR=$VISUAL
|
||||||
fi
|
fi
|
||||||
|
|
||||||
setConfigFile
|
setConfigFile
|
||||||
|
@ -881,7 +885,7 @@ function doHelp() {
|
||||||
echo
|
echo
|
||||||
echo " help Print this help"
|
echo " help Print this help"
|
||||||
echo
|
echo
|
||||||
echo " edit Open the home configuration in \$EDITOR"
|
echo " edit Open the home configuration in \$VISUAL or \$EDITOR"
|
||||||
echo
|
echo
|
||||||
echo " option OPTION.NAME"
|
echo " option OPTION.NAME"
|
||||||
echo " Inspect configuration option named OPTION.NAME."
|
echo " Inspect configuration option named OPTION.NAME."
|
||||||
|
|
Loading…
Reference in a new issue