Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@masawada
Last active August 29, 2015 14:14
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 masawada/45c95d6e8d5a048d79e8 to your computer and use it in GitHub Desktop.
Save masawada/45c95d6e8d5a048d79e8 to your computer and use it in GitHub Desktop.
# 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