Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] ZLE: Bind '_' to vi-first-non-blank in vicmd keymap
- X-seq: zsh-workers 54151
- From: Oliver Kiddle <opk@xxxxxxx>
- To: Aidan Van Duyne <aidanvanduyne@xxxxxxxxx>
- Cc: zsh-workers@xxxxxxx
- Subject: Re: [PATCH] ZLE: Bind '_' to vi-first-non-blank in vicmd keymap
- Date: Tue, 16 Dec 2025 01:53:56 +0100
- Archived-at: <https://zsh.org/workers/54151>
- In-reply-to: <CAC0jd=B+87Jpw51w6+NfsqfLLMiAdWD+Y4jJ89WKivrevgzDeQ@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <CAC0jd=B+87Jpw51w6+NfsqfLLMiAdWD+Y4jJ89WKivrevgzDeQ@mail.gmail.com>
On 7 Dec, Aidan Van Duyne wrote:
> In vim/vi, '_' moves to the first non-blank character of a line.
> Zsh's vi-mode already provides `vi-first-non-blank` support. This
> is currently bound to '^' in the keymap. This patch binds '_' to
> `vi-first-non-blank` in the vicmd keymap so that Zsh behavior matches
> vim/vi expectations.
Thanks, I have pushed this.
In vi/vim, ^ and _ do actually differ slightly given a numeric argument.
It is ignored with ^ but moves down a line with _ and a count of 2
or more. + does much the same but with lines counted more normally.
Having zsh replicate this would probably be taking vi compatibility too
far. I'd guess _ is mostly useful for people that have a keyboard that
doesn't make ^ easy to access or where it operates as a dead key.
Oliver
Messages sorted by:
Reverse Date,
Date,
Thread,
Author