Hacker News new | ask | show | jobs
by lunixbochs 4615 days ago
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.