The Computer Oracle

Is there a “reverse incremental search” functionality in Fish similar to Bash’s CTRL+R?

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Romantic Lands Beckon

--

Chapters
00:00 Is There A “Reverse Incremental Search” Functionality In Fish Similar To Bash’S Ctrl+R?
00:28 Accepted Answer Score 71
01:08 Answer 2 Score 11
01:51 Answer 3 Score 11
02:03 Answer 4 Score 6
02:29 Answer 5 Score 5
02:52 Thank you

--

Full question
https://superuser.com/questions/627929/i...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#bash #fish

#avk47



ACCEPTED ANSWER

Score 71


I've never used fish myself but a cursory google search brought up this page which states that

Powerful History Mechanism

Modern shells save previous commands in a command history. You can view earlier commands by using the up and down arrows. Fish extends this concept by integrating the history search functionality. To search the history, simply type in the search string, and press the up arrow. By using the up and down arrow, you can search for older and newer matches. The fish history automatically removes duplicate matches and the matching substring is highlighted. These features make searching and reusing previous commands much faster.

Is that what you are looking for? It seems quite similar to bash's.




ANSWER 2

Score 11


fish doesn't implement incremental history search, although it seems to come up fromtime to time. The pre-2.0 documentation has a "Missing features and bugs" section 1 which lists incremental history search fairly far down in the "Possible features" list. The fish-users mailing list includes this message from Axel Liljencratz, dated August 21, 2006, in which he says that incremental search would be a nice feature to have.

If you're used to bash-style incremental search, fish history searching does take a bit of getting used to. You have to type the search term first, and you move up and down matching entries with up- and down- arrow. But I suppose you get used to it.




ANSWER 3

Score 11


You can use : https://github.com/junegunn/fzf

this library provide powerful search for fish shell.




ANSWER 4

Score 6


Now in fish shell 3.6.0

https://github.com/fish-shell/fish-shell/releases/tag/3.6.0

By default, Control-R now opens the command history in the pager (#602). This is fully searchable and syntax-highlighted, as an alternative to the incremental search seen in other shells. The new special input function history-pager has been added for custom bindings.




ANSWER 5

Score 5


Far better Ctrl+r reverse searches with FZF and fzf fish plugin, using the Triton fish package manager, configured to use The Silver Searcher.

~/.config/fish/config.fish:

triton jethrokuan/fzf
set -U FZF_COMPLETE 2
set -U FZF_FIND_FILE_COMMAND "ag -l --hidden --ignore .git"
set -U FZF_DEFAULT_OPTS "--height 40% --layout=reverse --border"

On Mac OS, to install the prereqs:

brew install the_silver_searcher
brew install fzf