[PATCH] Use $VISUAL over $EDITOR when calculating editor to use

Edwin Kofler eankeen at gmail.com
Thu Dec 29 08:34:35 UTC 2022


It is more correct to use $VISUAL first, then $EDITOR.
See: https://unix.stackexchange.com/a/4861
---
  src/password-store.sh | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/password-store.sh b/src/password-store.sh
index 22e818f..ffaf24f 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -294,7 +294,7 @@ cmd_usage() {
                 during entry. Or, optionally, the entry may be 
multiline. Prompt before
                 overwriting existing password unless forced.
             $PROGRAM edit pass-name
-               Insert a new password or edit an existing password using 
${EDITOR:-vi}.
+               Insert a new password or edit an existing password using 
${VISUAL:-${EDITOR:-vi}}.
             $PROGRAM generate [--no-symbols,-n] [--clip,-c] 
[--in-place,-i | --force,-f] pass-name [pass-length]
                 Generate a new password of pass-length (or 
$GENERATED_LENGTH if unspecified) with optionally no symbols.
                 Optionally put it on the clipboard and clear board 
after $CLIP_TIME seconds.
@@ -500,13 +500,13 @@ cmd_edit() {
                 $GPG -d -o "$tmp_file" "${GPG_OPTS[@]}" "$passfile" || 
exit 1
                 action="Edit"
         fi
-       ${EDITOR:-vi} "$tmp_file"
+       ${VISUAL:-${EDITOR:-vi}} "$tmp_file"
         [[ -f $tmp_file ]] || die "New password not saved."
         $GPG -d -o - "${GPG_OPTS[@]}" "$passfile" 2>/dev/null | diff - 
"$tmp_file" &>/dev/null && die "Password unchanged."
         while ! $GPG -e "${GPG_RECIPIENT_ARGS[@]}" -o "$passfile" 
"${GPG_OPTS[@]}" "$tmp_file"; do
                 yesno "GPG encryption failed. Would you like to try again?"
         done
-       git_add_file "$passfile" "$action password for $path using 
${EDITOR:-vi}."
+       git_add_file "$passfile" "$action password for $path using 
${VISUAL:-${EDITOR:-vi}}."
  }

  cmd_generate() {
-- 
2.34.1


More information about the Password-Store mailing list