Last active
August 29, 2015 14:14
-
-
Save masawada/45c95d6e8d5a048d79e8 to your computer and use it in GitHub Desktop.
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
# peco find directory | |
function peco-find() { | |
local current_buffer=$BUFFER | |
local search_root="" | |
local file_path="" | |
if git rev-parse --is-inside-work-tree > /dev/null 2>&1; then | |
search_root=`git rev-parse --show-toplevel` | |
else | |
search_root=`pwd` | |
fi | |
file_path="$(find ${search_root} -maxdepth 5 | peco)" | |
BUFFER="${current_buffer} ${file_path}" | |
CURSOR=$#BUFFER | |
zle clear-screen | |
} | |
zle -N peco-find | |
# bind keys | |
bindkey '^f' peco-find |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment