Skip to content

Instantly share code, notes, and snippets.

@jeebak
Last active August 29, 2015 14:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeebak/a2a5e412ca37350988d3 to your computer and use it in GitHub Desktop.
Save jeebak/a2a5e412ca37350988d3 to your computer and use it in GitHub Desktop.
Zsh fzf-git-ls-files widget, for fzf
fzf-git-ls-files() {
if [[ -f '.git/config' ]]; then
LBUFFER="$(git ls-files | fzf +s +m -n2..,..)"
else
echo "Not a git repo\n"
fi
zle redisplay
}
zle -N fzf-git-ls-files
bindkey '^o' fzf-git-ls-files
# Useful when paired with...
# Alt-e attempts to edit what's on the command line
bindkey -s '\ee' "\C-a${EDITOR:-vim} \n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment