News for hackers. Stuff that matters.
Re:Fish shell 2.1 by lignuist on Monday October 28, 2013 @10:05AM (#6626960)
I am looking for something that lets me type the first few letters and when I press the arrow-up key then (maybe in combination with another key), it will only offer those items from the history, which match my previous input.

Something like:

Type:

> ssh

press arrow-up:

> ssh [email protected]

press arrow-up:

> ssh [email protected]

Re:Fish shell 2.1 by tambourine_man on Monday October 28, 2013 @10:49AM (#6627242)
Not sure if that's what you want, but have you tried this in your .inputrc?

  "\e[B": history-search-forward
  "\e[A": history-search-backward
Re:Fish shell 2.1 by JelteF on Tuesday October 29, 2013 @04:27AM (#6632620)
You can also put this in your bashrc:

  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.
Re:Fish shell 2.1 by lignuist on Monday October 28, 2013 @11:00AM (#6627310)
Looks interesting. How would I use that afterwards?
Re:Fish shell 2.1 by bretthoerner on Monday October 28, 2013 @11:13AM (#6627405)
Type, say, 's' and then press your up arrow.
Re:Fish shell 2.1 by TeMPOraL on Monday October 28, 2013 @10:15AM (#6627025)
Fish does that by default.
Re:Fish shell 2.1 by stith on Monday October 28, 2013 @10:15AM (#6627024)
You can do that in bash with ctrl+r:

Type: ctrl+r

Type: ssh

Bash says:

(reverse-i-search)`ssh': ssh [email protected]

Type again: ctrl+r

(reverse-i-search)`ssh': ssh [email protected]

Re:Fish shell 2.1 by cshenoy on Monday October 28, 2013 @10:09AM (#6626988)
oh-my-zsh[1] does that for me. It's a pretty great function.

1. https://github.com/robbyrussell/oh-my-zsh

Re:Fish shell 2.1 by jlgreco on Monday October 28, 2013 @10:37AM (#6627156)
The history-beginning-search-backward widget, which is standard to the zsh line editor, does it. You don't need to pull in all of oh-my-zsh.

To use it, I use:

  bindkey "^[[A" history-beginning-search-backward
Re:Fish shell 2.1 by jevinskie on Monday October 28, 2013 @02:56PM (#6629021)
This seems to have been broken for me unless I add DEBIAN_PREVENT_KEYBOARD_CHANGES=yes to my .zshenv. I'm not sure if it was an update to ZSH, oh-my-zsh, or Ubuntu that causes the issue.
Re:Fish shell 2.1 by josteink on Monday October 28, 2013 @10:46AM (#6627221)
Im using oh-my-zsh, but I cant find this one. Care to enlighten me which option or plugin I should enable? :)

Edit: Seems ctrl-up and ctrl-down does the trick.

Re:Fish shell 2.1 by Spittie on Monday October 28, 2013 @01:04PM (#6628148)
I'm using https://github.com/zsh-users/zsh-history-substring-search

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.

Re:Fish shell 2.1 by josteink on Tuesday October 29, 2013 @04:37AM (#6632663)
It's actually a plugin bundled with oh-my-zsh, but I copy-pasted the default keybindings from the github page you linked, and it's indeed pretty awesome.
Re:Fish shell 2.1 by vially on Monday October 28, 2013 @10:16AM (#6627030)
Not exactly what you're asking for but: Alt + Up might help.

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]

[1] - http://fishshell.com/docs/2.1/

Re:Fish shell 2.1 by lunixbochs on Monday October 28, 2013 @12:11PM (#6627774)
Up does this by default. Alt+Up is useful for searching a single word through history

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.

Re:Fish shell 2.1 by Osiris on Monday October 28, 2013 @11:11AM (#6627390)
This is actually the feature of fish I use the most and is the primary reason I always install fish on my servers. Automatic history search using the up-arrow is fantastic.
Re:Fish shell 2.1 by quarterto on Monday October 28, 2013 @10:07AM (#6626969)
Ctrl+R.
Re:Fish shell 2.1 by krcz on Monday October 28, 2013 @10:18AM (#6627044)
In my Fedora Linux bash page-up works like that.
Re:Fish shell 2.1 by siteshwar on Monday October 28, 2013 @10:14AM (#6627020)
fish does this too when you press up arrow key.
Re:Fish shell 2.1 by patrickg on Monday October 28, 2013 @10:13AM (#6627011)
bash: "\C-p": history-search-backward in ~/.inputrc
Re:Fish shell 2.1 by iron_ball on Monday October 28, 2013 @10:34AM (#6627131)
Or in .bashrc:

bind "C-p":history-search-backward

bind "C-n":history-search-forward

Re:Fish shell 2.1 by mineo on Monday October 28, 2013 @10:09AM (#6626987)
This is what the arrow-up key in ZSH does by default.
Re:Fish shell 2.1 by mmgutz on Monday October 28, 2013 @12:34PM (#6627926)
On my box, zsh only searches based on the first word. Other options, in comments above, search on multi words. For example "git push" then up arrow works expected.
Re:Fish shell 2.1 by chanux on Monday October 28, 2013 @10:58AM (#6627295)
In your ~/.inputrc

"\e[A": history-search-backward

"\e[B": history-search-forward

Re:Fish shell 2.1 by nzp on Monday October 28, 2013 @03:28PM (#6629208)
Tcsh does just that by default (at least on FreeBSD).
Re:Fish shell 2.1 by rsync on Monday October 28, 2013 @03:32PM (#6629231)
I have been doing this for over a decade with csh.
Re:Fish shell 2.1 by lignuist on Monday October 28, 2013 @10:20AM (#6627060)
Thanks for all the tips! :)
Re:Fish shell 2.1 by pacefalm on Monday October 28, 2013 @10:09AM (#6626984)
zsh does that