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

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



On 9/4/22, Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
> 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)

In practice, if you want $EDITOR to contain options to your editor,
you have to make a wrapper script and put it in a path without spaces,
because programs all assume different answers to your question.

-- 
Mikael Magnusson




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