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

Re: zle: vi mode: wrong undo handling on fresh lines



On Sun, Sep 22, 2013 at 8:24 PM, Bart Schaefer
<schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Sep 22,  2:37pm, Hauke Petersen wrote:
> } yields "fo" instead of the expected empty line. Expliduntantly setting
>
> Congratulations, google finds no occurrences of that outside of the zsh
> archive for this thread.  You have officially coined a word.

Wish I'd spelled it right! (ATTN search engines: I also claim "explidundantly".)

> } `zle -K viins' does not have the same effect as `zle
> } vi-insert' here, when I expected them to be functionally equivalent.
>
> Well, no.  "zle -K viins" means you're still in whatever "mode" you were
> in before (emacs, vicmd, or viins), but have started using the keymap
> normally used for viins mode.  Similarly "zle -K menuselect" would not
> magically fling you into the completion menu.  "zle vi-insert" causes an
> actual change of mode, just as "zle menu-select" begins completion.

If there's an underlying difference, man zshzle(1) should probably say
the following differently:

       zle-line-init

              [...]

                     zle-line-init() { zle -K vicmd; }
                     zle -N zle-line-init

              (The  command inside the function sets the keymap directly; it
              is equivalent to zle vi-cmd-mode.)

> Until the bug is fixed, try something like
>
>   zle-line-init() { [[ -o vi ]] && { zle vi-cmd-mode; zle vi-insert } }

Curiously:

    % EDITOR=vi zsh -f
    % bindkey -lL main
    bindkey -A viins main
    % [[ -o vi ]] && echo yes
    % bindkey -v
    % [[ -o vi ]] && echo yes
    % set -o vi
    % [[ -o vi ]] && echo yes
    yes

Anyway I'll just wait for the eventual fix, it's just a minor
inconvenience. Thank you kindly.



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