21 lines
746 B
VimL
21 lines
746 B
VimL
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||
|
" OpenChangedFiles COMMAND
|
||
|
" Open a split for each dirty file in git
|
||
|
"
|
||
|
" Shamelessly stolen from Gary Bernhardt: https://github.com/garybernhardt/dotfiles
|
||
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||
|
function! OpenChangedFiles()
|
||
|
only " Close all windows, unless they're modified
|
||
|
let status = system('git status -s | grep "^ \?\(M\|A\)" | cut -d " " -f 3')
|
||
|
let filenames = split(status, "\n")
|
||
|
if len(filenames) > 0
|
||
|
exec "edit " . filenames[0]
|
||
|
for filename in filenames[1:]
|
||
|
exec "sp " . filename
|
||
|
endfor
|
||
|
end
|
||
|
endfunction
|
||
|
command! OpenChangedFiles :call OpenChangedFiles()
|
||
|
|
||
|
nnoremap ,ocf :OpenChangedFiles<CR>
|