Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: vi mode cursor position
- X-seq: zsh-users 24055
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Christopher Paul <Christopher.Paul@xxxxxxxxxxxxxxxxxx>
- Subject: Re: vi mode cursor position
- Date: Sat, 13 Jul 2019 11:24:28 +0200
- Authentication-results: amavisd4.gkg.net (amavisd-new); dkim=pass (2048-bit key) header.d=yahoo.co.uk
- Cc: "zsh-users@xxxxxxx" <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1563009871; bh=jysWvCkAMjr11BfNTw44hfK8i0pBLjxO07Fid70drRU=; h=From:References:To:Subject:Date:From:Subject; b=aeU2AAetUW2hg7OSkqta7e0us8910r/P2DNbridKJn7oYB9e4T/YWrxTPD7LBwNkOI5L5reWVA/B8630Hc7hbLnj7mqtPhoON+DwAoGpO7w7VQBDZWgSUJS/dp1yxwlY+nJbAN+1t/kzAaGzYZilNbnikUFVD9K/Xvh/DAXXyOF4IMlZpkZIlsGywxcq1bxHiZXYpx23gVgjpADbjFYHA0CACydhbXwRmWJw36u2msHrbml+93aRsww4WMBTIby23M7V6+umoCgeofSe3nDhM7sCEKO4uueRicaH2DtUKXTHOc9iO2qsDpBOAS2GyADQuMKDMakb9117AAmo5X/lzQ==
- In-reply-to: <MWHPR08MB2448C2BDCB0DDC87EDADBE23EDF30@MWHPR08MB2448.namprd08.prod.outlook.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author