Created
April 3, 2016 09:52
-
-
Save kenoss/85ed24b3d168234a16d5f4f7a1e0b29a to your computer and use it in GitHub Desktop.
My version of http://k0kubun.hatenablog.com/entry/2014/07/06/033336
This file contains hidden or 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
function peco-find-file() { | |
local source_files | |
if git rev-parse 2> /dev/null; then | |
source_files=$(git ls-files) | |
else | |
source_files=$(find . -type f) | |
fi | |
local selected_files=$(echo $source_files | 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