Something like:
Type:
> ssh
press arrow-up:
> ssh larry@google.com
press arrow-up:
> ssh mark@facebook.com
Something like:
Type:
> ssh
press arrow-up:
> ssh larry@google.com
press arrow-up:
> ssh mark@facebook.com
"\e[B": history-search-forward
"\e[A": history-search-backward bind '"\e[A":history-search-backward'
bind '"\e[B":history-search-forward'
It's one of the things I always tell people to use since it makes using bash so much easier.Type: ctrl+r
Type: ssh
Bash says:
(reverse-i-search)`ssh': ssh dude@somewhere.com
Type again: ctrl+r
(reverse-i-search)`ssh': ssh someoneelse@elsewhere.com
To use it, I use:
bindkey "^[[A" history-beginning-search-backwardEdit: Seems ctrl-up and ctrl-down does the trick.
It emulates the Fish behavior (which is just awesome). I'm not sure if it requires oh-my-zsh, but I think it doesn't.
From the docs: Alt-Up and Alt-Down search the command history for the previous/next token containing the token under the cursor before the search was started. If the commandline was not on a token when the search started, all tokens match. See the history section for more information on history searching. [1]
I know of three history completion modes in fish.
Full command search: start typing a command and press Up. This will search for entire commands matching your query.
Word search: type any letters in a command, then press Alt+Up. This will cycle only the current word based on a substring match of your query. Useful for hostnames, filenames, etc.
Context-sensitive: If fish 'previews' the rest of a line as a lighter color text, press the right arrow key to complete. This is sensitive to the current directory and available files. If you go into a directory, `touch filename`, `cat filename`, and type `cat`, it will preview `cat filename` for you. Pressing the right arrow key will type it. If you `rm filename` or change directory, `cat filename` will no longer appear.
bind "C-p":history-search-backward
bind "C-n":history-search-forward
"\e[A": history-search-backward
"\e[B": history-search-forward