Skip to content

atweiden/fzf-extras

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 

Repository files navigation

fzf-extras

Additional key bindings for fzf, primarily Bash.

Usage

Bash

directory

bash cmdline description
zd 'fuzzy-finder' + 'cd' = 'zd', the super function of zdd, zda, zdr, zdf, zst, zz
zdd cd into selected directory
zda cd into selected directory, including hidden directories
zdr cd into selected parent directory
zdf cd into directory of selected file
zst cd into directory from stack
zz cd into selectable 'frecency' directory

file

bash cmdline description
e [FUZZY PATTERN] Open 'frecency' files with $EDITOR
fe [FUZZY PATTERN] Open selected file with $EDITOR
fo Equivalent to fe, but opens file with $OPENER (default: xdg-open) if you press Ctrl+O
v Open selected files from ~/.viminfo with $EDITOR

git

bash cmdline description
fbr Checkout Git branch (including remote branches)
fco Checkout Git branch/tag
fcoc Checkout Git commit
fcs Get Git commit SHA hash
fshow Git commit browser
fstash Git stash management (Enter to show stash contents, Ctrl+D to show diff of stash against current HEAD, Ctrl+B to check stash out as a branch, for easier merging)
fzf-gitlog-multi-widget Multi-selectable git show
fzf-gitlog-widget Git log browser

history

bash cmdline description
fh Select line from history, repeat without editing
fhe Select line from history, leave for editing
runcmd Utility function used to run shell command
writecmd Utility function used to write shell command

pid

bash cmdline description
fkill Select process to kill (alternatively, type kill˽Tab)

tags

bash cmdline description
ftags Search ctags

tmux

bash cmdline description
fs [FUZZY PATTERN] Select tmux session
ftpane Switch pane

Zsh

file

zsh cmdline description
Alt-i Paste selected entry from locate output into command line

Installation

Install fzf-extras

Arch Linux

Install aur/fzf-extras.

Manual

git clone https://github.com/atweiden/fzf-extras ~/.fzf-extras

Configure fzf-extras

To make use of function fo, consider setting the $OPENER environment variable. If $OPENER is unset, fo will attempt to open files with xdg-open when pressing Ctrl+O.

Arch Linux

cat >> ~/.bashrc <<'EOF'
OPENER=mimeo
EOF

macOS

cat >> ~/.bashrc <<'EOF'
OPENER=open
EOF

Source fzf-extras

Arch Linux

# bash users only
cat >> ~/.bashrc <<'EOF'
[[ -e "/usr/share/fzf/fzf-extras.bash" ]] \
  && source /usr/share/fzf/fzf-extras.bash
EOF

# zsh users only
cat >> ~/.zshrc <<'EOF'
[[ -e "/usr/share/fzf/fzf-extras.zsh" ]] \
  && source /usr/share/fzf/fzf-extras.zsh
EOF

Manual

# bash users only
cat >> ~/.bashrc <<'EOF'
[[ -e "$HOME/.fzf-extras/fzf-extras.sh" ]] \
  && source "$HOME/.fzf-extras/fzf-extras.sh"
EOF

# zsh users only
cat >> ~/.zshrc <<'EOF'
[[ -e "$HOME/.fzf-extras/fzf-extras.zsh" ]] \
  && source "$HOME/.fzf-extras/fzf-extras.zsh"
EOF

Zsh users should not be sourcing fzf-extras.sh.

The lack of meaningful support for Zsh will be fixed pending suitable PRs from Zsh-using contributors. Note it is perfectly acceptable to duplicate code from fzf-extras.sh into fzf-extras.zsh. See: #12.

Dependencies

Required

Optional

Sources

See Also

License

MIT