From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 992 invoked by alias); 23 Sep 2013 04:57:16 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 31763 Received: (qmail 19698 invoked from network); 23 Sep 2013 04:57:10 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <130922215731.ZM19104@torch.brasslantern.com> Date: Sun, 22 Sep 2013 21:57:31 -0700 In-reply-to: Comments: In reply to Hauke Petersen "Re: zle: vi mode: wrong undo handling on fresh lines" (Sep 22, 10:27pm) References: <130922112421.ZM18920@torch.brasslantern.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Hauke Petersen Subject: Re: zle: vi mode: wrong undo handling on fresh lines Cc: zsh-workers@zsh.org MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Sep 22, 10:27pm, Hauke Petersen wrote: } } > "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. } > "zle vi-insert" causes an actual change of mode } } If there's an underlying difference, man zshzle(1) should probably say } the following differently: } } zle-line-init() { zle -K vicmd; } Hmm, it probably would in fact be better to use "zle vi-cmd-mode" in that example, but the differences between emacs mode and vicmd mode are less extreme than emacs and viins. } > 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 Heh. Hence "try something like" not "do exactly this" ... what you use in place of [[ -o vi ]] depends on how you got into viins mode in the first place. A more universal test would be [[ $KEYMAP == viins ]], and now that I think of it vi-cmd-mode may move the cursor back one postion, so: zle-line-init() { [[ $KEYMAP == viins ]] && { zle vi-cmd-mode zle vi-add-next } }