Skip to content

Commit

Permalink
config-edit: better respect of editor preferences
Browse files Browse the repository at this point in the history
  • Loading branch information
balupton committed Jul 19, 2023
1 parent 3ef481c commit da51e33
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
9 changes: 6 additions & 3 deletions commands/config-edit
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ function config-edit() (
sudo-helper -- cat /etc/sudoers | rg --fixed-strings --regexp="$1"
}
function default_sudoers_editer {
env EDITOR="$(edit --dry --terminal)" sudo visudo
# --inherit to maintain editor preferences
sudo-helper --inherit -- visudo
}
;;
'--cron-system')
Expand All @@ -153,7 +154,8 @@ function config-edit() (
sudo-helper -- crontab -l | sponge | rg --fixed-strings --regexp="$1"
}
function default_cron_system_editer {
sudo-helper -- env EDITOR="$(edit --dry --terminal)" crontab -e || :
# --inherit to maintain editor preferences
sudo-helper --inherit -- crontab -e || :
if is-mac; then
service-helper --restart -- system/com.vix.cron
else
Expand All @@ -169,7 +171,8 @@ function config-edit() (
crontab -l | sponge | rg --fixed-strings --regexp="$1"
}
function default_cron_user_editer {
env EDITOR="$(edit --dry --terminal)" crontab -e || :
# user contrab already inherits editor preferences
crontab -e || :
if is-mac; then
service-helper --restart -- system/com.vix.cron
else
Expand Down
7 changes: 2 additions & 5 deletions commands/setup-environment-commands
Original file line number Diff line number Diff line change
Expand Up @@ -575,12 +575,9 @@ if test -z "${LC_CTYPE-}"; then
LC_CTYPE="$LANG"
fi

# Checks
# EDITOR, SUDO_EDITOR doesn't do anything so ignore
if test -z "${EDITOR-}"; then
editor="$(edit --dry --prompt || :)"
if test -n "$editor"; then
EDITOR="$editor"
fi
EDITOR="$(edit --dry --prompt || :)"
fi

# =====================================
Expand Down

0 comments on commit da51e33

Please sign in to comment.