Created
December 20, 2014 13:09
-
-
Save kazu634/4616791afa459768ac1f to your computer and use it in GitHub Desktop.
`peco` + `git ls-files`
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
# 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