Skip to content

Instantly share code, notes, and snippets.

@kazu634
Created December 20, 2014 13:09
Show Gist options
  • Save kazu634/4616791afa459768ac1f to your computer and use it in GitHub Desktop.
Save kazu634/4616791afa459768ac1f to your computer and use it in GitHub Desktop.
`peco` + `git ls-files`
# check whether `peco` exists
if which peco > /dev/null; then
function gim () {
# check whether the current directory is under `git` repository.
if git rev-parse 2> /dev/null; then
local selected_file=$(git ls-files . | peco)
if [ -n "${selected_file}" ]; then
vi ${selected_file}
fi
fi
}
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment