mirror of
https://github.com/amix/vimrc
synced 2025-06-29 02:55:01 +08:00
Updated plugins
This commit is contained in:
@ -179,7 +179,7 @@ endfunction
|
||||
" - this runs synchronously
|
||||
" - it ignores unsaved changes in buffers
|
||||
" - it does not change to the repo root
|
||||
function! gitgutter#quickfix()
|
||||
function! gitgutter#quickfix(current_file)
|
||||
let cmd = g:gitgutter_git_executable.' '.g:gitgutter_git_args.' rev-parse --show-cdup'
|
||||
let path_to_repo = get(systemlist(cmd), 0, '')
|
||||
if !empty(path_to_repo) && path_to_repo[-1:] != '/'
|
||||
@ -191,6 +191,9 @@ function! gitgutter#quickfix()
|
||||
\ ' diff --no-ext-diff --no-color -U0'.
|
||||
\ ' --src-prefix=a/'.path_to_repo.' --dst-prefix=b/'.path_to_repo.' '.
|
||||
\ g:gitgutter_diff_args. ' '. g:gitgutter_diff_base
|
||||
if a:current_file
|
||||
let cmd = cmd.' -- '.expand('%:p')
|
||||
endif
|
||||
let diff = systemlist(cmd)
|
||||
let lnum = 0
|
||||
for line in diff
|
||||
|
@ -158,6 +158,11 @@ Commands for jumping between hunks:~
|
||||
>
|
||||
command! Gqf GitGutterQuickFix | copen
|
||||
<
|
||||
*gitgutter-:GitGutterQuickFixCurrentFile*
|
||||
:GitGutterQuickFixCurrentFile Same as :GitGutterQuickFix, but only load hunks for
|
||||
the file in the focused buffer. This has the same
|
||||
functionality as :GitGutterQuickFix when the focused
|
||||
buffer is empty.
|
||||
|
||||
|
||||
Commands for operating on a hunk:~
|
||||
|
@ -118,7 +118,8 @@ command! -bar GitGutterBufferDisable call gitgutter#buffer_disable()
|
||||
command! -bar GitGutterBufferEnable call gitgutter#buffer_enable()
|
||||
command! -bar GitGutterBufferToggle call gitgutter#buffer_toggle()
|
||||
|
||||
command! -bar GitGutterQuickFix call gitgutter#quickfix()
|
||||
command! -bar GitGutterQuickFix call gitgutter#quickfix(0)
|
||||
command! -bar GitGutterQuickFixCurrentFile call gitgutter#quickfix(1)
|
||||
|
||||
" }}}
|
||||
|
||||
|
@ -947,12 +947,27 @@ function Test_quickfix()
|
||||
call setline(5, ['A', 'B'])
|
||||
call setline(9, ['C', 'D'])
|
||||
write
|
||||
let bufnr1 = bufnr('')
|
||||
|
||||
edit fixture_dos.txt
|
||||
call setline(2, ['A', 'B'])
|
||||
write
|
||||
let bufnr2 = bufnr('')
|
||||
|
||||
GitGutterQuickFix
|
||||
|
||||
let expected = [
|
||||
\ {'lnum': 5, 'bufnr': bufnr(''), 'text': '-e'},
|
||||
\ {'lnum': 9, 'bufnr': bufnr(''), 'text': '-i'}
|
||||
\ {'lnum': 5, 'bufnr': bufnr1, 'text': '-e'},
|
||||
\ {'lnum': 9, 'bufnr': bufnr1, 'text': '-i'},
|
||||
\ {'lnum': 2, 'bufnr': bufnr2, 'text': "-b\r"}
|
||||
\ ]
|
||||
|
||||
call s:assert_list_of_dicts(expected, getqflist())
|
||||
|
||||
GitGutterQuickFixCurrentFile
|
||||
|
||||
let expected = [
|
||||
\ {'lnum': 2, 'bufnr': bufnr(''), 'text': "-b\r"},
|
||||
\ ]
|
||||
|
||||
call s:assert_list_of_dicts(expected, getqflist())
|
||||
|
Reference in New Issue
Block a user