All Projects → PatrickF1 → Fzf.fish

PatrickF1 / Fzf.fish

Licence: mit
Augment your fish command line with fzf key bindings.

Programming Languages

shell
77523 projects

Projects that are alternatives of or similar to Fzf.fish

fish
Fish config with awesome flexible prompt, unicode symbols, better fzf integration and lot of handy functions.
Stars: ✭ 27 (-89.41%)
Mutual labels:  fish, fzf, fish-shell
Zoxide
A smarter cd command. Supports all major shells.
Stars: ✭ 4,422 (+1634.12%)
Mutual labels:  fzf, fish, fish-shell
sublime-fish
A robust Sublime Text syntax package for fish
Stars: ✭ 32 (-87.45%)
Mutual labels:  fish, fish-shell
dotfiles
Dotfiles for Neovim (0.7+), Fish shell, git, Kitty, tmux, and more.
Stars: ✭ 54 (-78.82%)
Mutual labels:  fish, fish-shell
dotfiles
macOS / Linux / Codespaces dotfiles with 1-line setup script. Tested on Apple Silicon Macs. Supports both zsh and fish. Now managed with https://github.com/twpayne/chezmoi
Stars: ✭ 82 (-67.84%)
Mutual labels:  fish, fish-shell
agnoster
Agnoster for Fish 🐠
Stars: ✭ 42 (-83.53%)
Mutual labels:  fish, fish-shell
fish-color-scheme-switcher
A fish shell 🐟 plugin to switch color schemes 🌈
Stars: ✭ 48 (-81.18%)
Mutual labels:  fish, fish-shell
dotpr0n
Dotfiles for macOS, FreeBSD, fish, tmux, custom functions and lots more. Peekaboo!
Stars: ✭ 44 (-82.75%)
Mutual labels:  fish, fish-shell
Dots
Personal *nix configuration files
Stars: ✭ 136 (-46.67%)
Mutual labels:  fzf, fish
dotfiles
~nickTD
Stars: ✭ 13 (-94.9%)
Mutual labels:  fish, fish-shell
AwsTerm
A collection of awesome terminal utilities
Stars: ✭ 37 (-85.49%)
Mutual labels:  fish, fish-shell
fish logo
🐠 Fish shell colorful ASCII-art logo
Stars: ✭ 82 (-67.84%)
Mutual labels:  fish, fish-shell
dotfiles
No description or website provided.
Stars: ✭ 20 (-92.16%)
Mutual labels:  fish, fzf
Z.lua
⚡ A new cd command that helps you navigate faster by learning your habits.
Stars: ✭ 2,164 (+748.63%)
Mutual labels:  fzf, fish
fish-exa
🐟 exa aliases for fish
Stars: ✭ 24 (-90.59%)
Mutual labels:  fish, fish-shell
fish-symnav
Symbolic link navigation for Fish shell
Stars: ✭ 11 (-95.69%)
Mutual labels:  fish, fish-shell
Fzf
🌸 A command-line fuzzy finder
Stars: ✭ 40,965 (+15964.71%)
Mutual labels:  fzf, fish
Forgit
💤 A utility tool powered by fzf for using git interactively.
Stars: ✭ 1,823 (+614.9%)
Mutual labels:  fzf, fish
fishline
A powerline prompt framework for the fish-shell built in fish-shell.
Stars: ✭ 66 (-74.12%)
Mutual labels:  fish, fish-shell
fish-kube-prompt
⎈ kubectl context/namespace in your fish shell prompt
Stars: ✭ 71 (-72.16%)
Mutual labels:  fish, fish-shell

fzf.fish 🔍🐟

latest release badge build status badge awesome badge

Augment your Fish command line with mnemonic key bindings to efficiently find what you need using fzf.

Features

Use fzf.fish to interactively find and insert into the command line:

File paths

file search

  • Search input: recursive listing of current directory's non-hidden files
  • Key binding and mnemonic: Ctrl+F (F for file)
  • Preview window: file with syntax highlighting, directory contents, or file type
  • Remarks
    • prepends ./ to the selection if only one selection is made and it becomes the only token on the command line, making it easy to execute if an executable, or cd into if a directory (see cd docs)
    • if the current token is a directory with a trailing slash (e.g. functions/<CURSOR>), then search will be scoped to that directory
    • ignores files that are also ignored by git
    • Tab to multi-select

Modified paths

git status select

  • Search input: the current repository's git status
  • Key binding and mnemonic: Ctrl+Alt+S (S for status, Alt to prevent overriding pager-toggle-search)
  • Remarks: Tab to multi-select

A commit hash

git log search

  • Search input: the current repository's formatted git log
  • Key binding and mnemonic: Ctrl+Alt+L (L for log, Alt to prevent overriding clear screen)
  • Preview window: commit message and diff

A previously run command

command history search

  • Search input: the command history from all interactive sessions of Fish
  • Key binding and mnemonic: Ctrl+R (R for reverse-i-search)
  • Preview window: the entire command, wrapped

A shell variable

shell variables search

  • Search input: all the variable names of the environment, both local and exported
  • Key binding and mnemonic: Ctrl+V (V for variable)
  • Preview window: the scope info and values of the variable
  • Remarks
    • $history is excluded for technical reasons so use the search command history feature instead to inspect it

The prompt used in the screencasts was created using IlanCosman/tide.

Installation

First, make sure you're using Fish 3.1.2 or newer.

$ fish --version
fish, version 3.1.2

Next, install with Fisher.

fzf.fish can be installed manually or with other plugin managers but only Fisher is officially supported.

fisher install PatrickF1/fzf.fish

Finally, install the following CLI tools:

  • fzf - command-line fuzzy finder that powers this plugin
  • fd - much faster and friendlier alternative to find
  • bat - smarter cat with syntax highlighting (used to preview files)

For macOS, I recommend installing them using brew.

On certain distribution of Linux, you will need to alias fdfind to fd (see #93).

Configuration

Custom key bindings

If you would like to customize the key bindings, first, prevent the default key bindings from executing by setting fzf_fish_custom_keybindings as an universal variable. You can do this with

set --universal fzf_fish_custom_keybindings

Do not try to set fzf_fish_custom_keybindings in your config.fish because the key binding configuration is sourced first on shell startup and so will not see it.

Next, set your own key bindings by following conf.d/fzf.fish as an example.

Fzf default options

fzf supports setting default options via the FZF_DEFAULT_OPTS environment variable. If it is set, fzf will implicitly prepend its value to the options passed in on every execution, scripted or interactive.

To make fzf's interface friendlier, fzf.fish takes the liberty of setting a sane FZF_DEFAULT_OPTS if it is not already set. See conf.d/fzf.fish for more details. This affects fzf even outside of this plugin. If you would like to remove this side effect or just want to customize fzf's default options, then set your own FZF_DEFAULT_OPTS universal variable. For example:

set --universal --export FZF_DEFAULT_OPTS --height 50% --margin 1

Alternatively, you can override it in your config.fish:

set --export FZF_DEFAULT_OPTS --height 50% --margin 1

Change the command used to preview folders

The search files feature, by default, uses ls to preview the contents of a directory. To integrate with the variety of ls replacements available, the command used to preview directories is configurable through the fzf_preview_dir_cmd variable. For example, in your config.fish, you may put:

set fzf_preview_dir_cmd exa --all --color=always

Do not specify a target path in the command, as fzf.fish will prepend the directory to preview to the command itself.

Change the files searched

To pass custom options to fd when it is executed to populate the list of files for the search files feature, set the fzf_fd_opts variable. For example, to include hidden files but not .git, put this in your config.fish:

set fzf_fd_opts --hidden --exclude=.git

Change the key binding or Fzf options for a single command

See the FAQ Wiki page.

Prior art

If fzf.fish is a useful plugin, it is by standing on the shoulder of giants. There are two other fzf integrations for Fish worth regarding: jethrokuan/fzf and fzf's out-of-the-box Fish extension. The Prior Art Wiki page explains how fzf.fish compares to and improves on them.

Troubleshooting & FAQ

Need help? These Wiki pages can guide you:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].