Last active
August 29, 2015 14:07
-
-
Save AndrewVos/a9199f37927f5c8bbea8 to your computer and use it in GitHub Desktop.
Use the :G <tab> command in vim to list files that have been modified in a git repository
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
if !empty(glob(".git")) | |
function! GitLsFilesModified(A,L,P) | |
let pattern = a:A | |
if len(pattern) > 0 | |
return split(system("git ls-files --untracked --modified \| grep " . pattern), "\n") | |
else | |
return split(system("git ls-files --untracked --modified"), "\n") | |
endif | |
endfunction | |
command! -complete=customlist,GitLsFilesModified -nargs=1 G :edit <args> | |
endif | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment