Closed 0xiDen closed 1 year ago
Sounds interesting, can you give me more info about how that works, and what I need to do to install and use the plugin?
I'm glad you're interested. No plugin is needed. this features comes with zsh however can be further improved by installing some plugins.
bindkey "^[[A" history-beginning-search-backward
bindkey "^[[B" history-beginning-search-forward
This binds Up and Down (adjust for your own escape sequences) to a history search, backwards and forwards, based upon what has already been entered at the prompt.
So, if you were to enter "vim" and hit Up, zsh will traverse backwards through your history for only those commands commencing with "vim". you can see the implemented code here: https://github.com/zsh-users/zsh/blob/master/Functions/Zle/up-line-or-beginning-search
Wouldn't it be better to add it to a separate vim.zsh file then?
I used vim as an example @ChristianLempa. It IS NOT specific to vim.
It works with any command. suppose you enter command_x
(for example vim
or docker
) and hit UP Arrow Key
it searches your history and goes through commands starting with command_x (for example last vim file you opened or docker node ls
since it was in your history) cause it covers under autoload config and you originally used this file for zsh autoload I added to this file however if you prefer it we can put it in a separate file with autoload configs and name it zsh_autoload or something.
Thanks for the clarification. I'll merge it then and might add it to another file later, as goto is something different.
One of my favorite features of zsh is history-beginning-search which can be done backward or forward in this commit I enabled this feature.