Last active
August 29, 2015 14:05
-
-
Save jeebak/a2a5e412ca37350988d3 to your computer and use it in GitHub Desktop.
Zsh fzf-git-ls-files widget, for fzf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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