zsh-users
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: Christopher Paul <Christopher.Paul@hitachivantara.com>
Cc: "zsh-users@zsh.org" <zsh-users@zsh.org>
Subject: Re: vi mode cursor position
Date: Sat, 13 Jul 2019 11:24:28 +0200	[thread overview]
Message-ID: <41960-1563009868.475157@HUWd.vdv5.55oG> (raw)
In-Reply-To: <MWHPR08MB2448C2BDCB0DDC87EDADBE23EDF30@MWHPR08MB2448.namprd08.prod.outlook.com>

Christopher Paul wrote:
> Salutations Zsh Users,
>
> I just started using zsh. It's always fun to learn a new trick. I am a long-time vi-mode user. One thing that's different from ksh and bash is the cursor position after an ESC-k. With zsh, the cursor is positioned on the last character of the last command after an ESC-k. With ksh and bash, the cursor is positioned at the first character of the last command after an ESC-k.
>
> I'm pretty sure there is a way to change this in zsh. Can anyone give me a pointer?

By default, k is bound to up-line-or-history.
There are alternatives that differ in terms of the cursor position. For
example:

  bindkey -a k history-beginning-search-backward

However that may break other things like moving the cursor in a
multi-line buffer so you may want to use a custom widget that does
something like:

  if [[ $LBUFFER == *$'\n'* ]]; then
    zle .up-line
  else
    zle .history-beginning-search-backward
  fi

Oliver

  reply	other threads:[~2019-07-13  9:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-11 23:52 Christopher Paul
2019-07-13  9:24 ` Oliver Kiddle [this message]
2019-07-15 22:08   ` Christopher Paul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=41960-1563009868.475157@HUWd.vdv5.55oG \
    --to=okiddle@yahoo.co.uk \
    --cc=Christopher.Paul@hitachivantara.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).