You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support for history-beginning-search-{forward,backward} #992
By examining the default binds of Fish, I found Fish doesn't use history-search-backward for up arrow. It's quite a habit in Bash to use up arrow for that.
How can I rewrite up arrow and bind it with history-search-backward?
It worked, but not acurate enough. For example I use g X where X is a name of a bookmark of directory.
I type g scriptg codeg dlg docs to jump to each directory.
When I tap up arrow with a single g, Fish completes with any commans that has g, even like cd g.
That's the reason I want to add limit and make it work like history-search-backward like in Bash.
I was not sure about its name, and could found a bind with history-prefix-search-forward in it.
Before using Fish I was using such a piece of code in my ~/.bash:
bind'"\e[A": history-search-backward'bind'"\e[B": history-search-forward'set show-all-if-ambiguous on
set completion-ignore-case on
Reading the up-or-search function, it seems to me the issue here is that commandline -f incorrectly mimics the history-search-backward readline function. The apparent functionality (matching anywhere in a history line) is actually that of history-substring-search-backward. Here is the relevant documentation from readline(3):
history-search-backward
Search backward through the history for the string of characters between the start of the current line and the current cursor position (the point). The search string must match at the beginning of a history line. This is a non-incremental search.
history-substring-search-backward
Search backward through the history for the string of characters between the start of the current line and the current cursor position (the point). The search string may match anywhere in a history line. This is a non-incremental search.
6 years later is there a solution to this? I tried fish for a while but I switched back to zsh because the substring search is never what I want and frustrates me to no end.
Activity
zanchey commentedon Sep 8, 2013
Up arrow (
bind -k up) is already bound toup-or-searchin the default keybindings. Is that not working for you?tiye commentedon Sep 8, 2013
It worked, but not acurate enough. For example I use
g Xwhere X is a name of a bookmark of directory.I type
g scriptg codeg dlg docsto jump to each directory.When I tap up arrow with a single
g, Fish completes with any commans that hasg, even likecd g.That's the reason I want to add limit and make it work like
history-search-backwardlike in Bash.ridiculousfish commentedon Sep 8, 2013
It sounds like the desire here is a way to do a prefix search.
tiye commentedon Sep 9, 2013
I was not sure about its name, and could found a bind with
history-prefix-search-forwardin it.Before using Fish I was using such a piece of code in my
~/.bash:didn't understand all meanings though..
jmerkow commentedon Nov 13, 2015
Any update on this?
faho commentedon Mar 29, 2016
This seems to be the same as #1072.
stahara commentedon Apr 13, 2016
Reading the
up-or-searchfunction, it seems to me the issue here is thatcommandline -fincorrectly mimics thehistory-search-backwardreadline function. The apparent functionality (matching anywhere in a history line) is actually that ofhistory-substring-search-backward. Here is the relevant documentation fromreadline(3):stahara commentedon Apr 14, 2016
Hm, I see the source of confusion, I think: the
bash(1)manpage contradicts this and describes the behavior as implemented in fish.[-]How to bind history-search-forward to up arrow?[/-][+]Support for history-beginning-search-{forward,backward}[/+]half-potato commentedon Jun 7, 2019
6 years later is there a solution to this? I tried fish for a while but I switched back to zsh because the substring search is never what I want and frustrates me to no end.
ridiculousfish commentedon Jun 14, 2019
There's no binding for a history prefix search yet.
pinpox commentedon Sep 19, 2019
What steps would be required to implement this? I would like to give it a go, but don't know where to start.
domdom commentedon Sep 27, 2019
I've had a go at implementing this. Would you like a PR?