Skip to content
This repository has been archived by the owner on Oct 2, 2024. It is now read-only.

midchildan/fzftools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

fzftools

fzftools is an organized collection of FZF scripts with a consistent interface.

Installation

If you use bash:

$ git clone https://github.com/midchildan/fzftools.git
$ echo source "$(pwd)/fzftools.bash" >> ~/.bashrc

Or, if you use zsh:

$ git clone https://github.com/midchildan/fzftools.git
$ echo source "$(pwd)/fzftools.zsh" >> ~/.zshrc

Examples

Filter a list of directories

$ fzf-sel dir

Filter a list of git commits

$ fzf-sel git commit

cd to a subdirectory

$ fzf-run cd dir

Install some formula with Homebrew

$ fzf-run brew install formula

Edit a git file

$ fzf-run vim "git file"

You can also pass additional arguments:

$ fzf-run vim "git file" --remote-tab-silent

Interactive rebase with git

$ fzf-run git rebase commit -i

Browse git commits

$ fzf-loop git show commit

Usage

fzftools provides two commands: fzf-sel and fzf-run.

fzf-sel

Usage: fzf-sel selector

Filters list of items associated with selector using FZF. Examples of available selectors are:

  • dir
  • dirstack
  • file
  • fc
  • process
  • brew formula
  • brew installed
  • brew leaves
  • brew cask cask
  • brew cask installed
  • git branch
  • git commit
  • git file
  • git remote
  • git stash
  • git status
  • git tag

fzf-run

Usage: fzf-run command [subcommands...] selector [flags...]

Runs command with the output of fzf-sel selector as its arguments.

fzf-loop

Usage: fzf-loop command [subcommands...] selector [flags...]

Reapetedly run fzf-run until selection is canceled.

Customization

You can add a custom selector by defining fzf::sel::$(selector) as a function. You can also customize the behavior of fzf-run command by defining fzf::run::$(command) as a function.

License

See LICENSE.