Skip to content

Instantly share code, notes, and snippets.

@kenoss
Created April 3, 2016 10:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kenoss/5fa30538070b1dbccc9ebb3738d2e1cd to your computer and use it in GitHub Desktop.
Save kenoss/5fa30538070b1dbccc9ebb3738d2e1cd to your computer and use it in GitHub Desktop.
function peco-find-file() {
local command
if git rev-parse 2> /dev/null; then
command='git ls-files'
else
command='find . -type f'
fi
local selected_files=$(eval $command | peco --prompt "[find file]")
LBUFFER="${LBUFFER% } $(echo ${selected_files} | tr '\n' ' ')"
zle redisplay
}
zle -N peco-find-file
bindkey '^u^f' peco-find-file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment