Sample Header Ad - 728x90

zsh history-beginning-search-backwards doesn't position cursor as desired

6 votes
2 answers
1878 views
In bash, I used this:
% cat .inputrc
"\e[A": history-search-backward
"\e[B": history-search-forward
I'd like the same behavior in .zsh, so I've tried these bindkeys:
"^[[A" history-beginning-search-backward
"^[[B" history-beginning-search-forward
These are ALMOST what I want, except when I just up arrow (with no entered text) to see the immediately previous command, the cursor is positioned at the beginning of the line, rather than the end. 'bindkey '^[[A' history-search-backward' is close, it puts the cursor at the end BUT it only searches for the first word, e.g. if I type 'ssh foo' it will return the most recent 'ssh' in the history, not the most recent line starting with 'ssh foo'. Also, this positions the cursor at the end of the line when I do search, which is also not what I want (both bash's history-search-backwards and zsh's history-beginning-search-backward keep the cursor where I stopped typ is it possible to get the cursor positioned at the end of the line with the same functionality as history-beginning-search-backward?
Asked by mayostard (61 rep)
Feb 16, 2022, 12:42 PM
Last activity: May 2, 2023, 11:11 AM