Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

${EDITOR} with spaces (was: Re: [PATCH] initialization of main keymap)



Vincent Lefevre wrote on Fri, Sep 02, 2022 at 15:15:33 +0200:
> On 2022-09-01 22:06:03 -0700, Bart Schaefer wrote:
> > Upon further thought ...
> > 1) It's a bit odd that if both VISUAL and EDITOR are set, and VISUAL
> > is not set to a variant of vi, but EDITOR is, then zsh prefers to use
> > the bindings corresponding to EDITOR.
> > 2) As written the patch will always give Vincent the emacs bindings
> > because strstr() starts at the beginning and finds "vinc17" before
> > ever looking beyond the rindex().
> > 
> > Perhaps we should prefer VISUAL any time it is set?
> 
> Yes, the current behavior (with or without the patch) is definitely
> incorrect. For instance, https://unix.stackexchange.com/a/4861/74516
> suggests to set VISUAL to the full-screen editor, and either leave
> EDITOR unset or set it to "vi -e" (just in case a special line mode
> would be needed in some context). So a user who would use VISUAL=emacs
> and EDITOR="vi -e" would probably be annoyed by the current behavior.

Is $EDITOR meant to be used in a system(3) manner, as «system("${EDITOR} ${(q-)filename}")»,
or in an execve(2) manner, as «execl($EDITOR, $EDITOR, $filename)»?
(plus or minus a «--» guard in both cases)

Cheers,

Daniel




Messages sorted by: Reverse Date, Date, Thread, Author