/fish-fzf

Yet another fzf plugin for Fish.

Primary LanguageShellMIT LicenseMIT

Fish FZF

Yet another fzf plugin for Fish.

Unlike the others, this plugin tries to pack as much as possible into a single "do what I mean" shortcut. Edit a file? cd to a directory? Just insert it into the command line? Many things like this can be determined from context.

Installation

Use Fisher:

fisher install mk12/fish-fzf

Keybindings

The main keybinding is CtrlO:

  • CtrlO calls __fzf_insert file to search files.

For convenience, you can also jump directly into a different mode with these keybindings:

  • CtrlQ calls __fzf_insert directory to search directories.
  • AltZ calls __fzf_insert z to search z directories.

This plugin also offers a fzf version of history-search-backward:

  • CtrlR calls __fzf_history to search command history.

Usage

Press CtrlO to launch fzf.

If you've already typed a path, or part of one, it will start there. Otherwise, it will start in the working directoy. Within fzf, you get these keybindings:

  • Enter selects a result.
  • Tab selects multiple results.
  • CtrlO switches to searching files.
  • CtrlQ switches to searching directories.
  • AltZ switches to searching z directories.
  • Alt goes up to the parent directory.
  • Alt goes into the current item's directory.
  • AltH goes to your home directory.
  • Alt. toggles showing hidden paths.
  • AltI toggles showing ignored paths.

When you make a selection, it will normally be inserted in the command line. But if the command line was empty before and you only selected one item:

  • If it's a directory, cd to it.
  • If it's a file, open it with $EDITOR.

To prevent this, use AltEnter.

Alternatives

License

© 2022 Mitchell Kember

Fish FZF is available under the MIT License; see LICENSE for details.