Skip to content
Snippets Groups Projects
Commit aed80560 authored by Jerome Reybert's avatar Jerome Reybert
Browse files

plugin/magit.vim: jump through closed file too

ref #99
parent 88ae24df
No related branches found
No related tags found
No related merge requests found
...@@ -1087,7 +1087,7 @@ endfunction ...@@ -1087,7 +1087,7 @@ endfunction
" param[in] dir: can be 'N' (for next) or 'P' (for previous) " param[in] dir: can be 'N' (for next) or 'P' (for previous)
function! magit#jump_hunk(dir) function! magit#jump_hunk(dir)
let back = ( a:dir == 'P' ) ? 'b' : '' let back = ( a:dir == 'P' ) ? 'b' : ''
let line = search("^@@ ", back . 'wn') let line = search('\%(^@@ \|' . g:magit_file_re . '\)', back . 'wn')
if ( line != 0 ) if ( line != 0 )
if ( foldlevel(line('.')) == 2 ) if ( foldlevel(line('.')) == 2 )
try try
...@@ -1096,6 +1096,15 @@ function! magit#jump_hunk(dir) ...@@ -1096,6 +1096,15 @@ function! magit#jump_hunk(dir)
endtry endtry
endif endif
call cursor(line, 0) call cursor(line, 0)
if ( foldlevel(line('.')) == 0 )
return
endif
" if current line if an header file of an open file, go next
if ( foldlevel(line('.')) == 1 )
let line = search('\%(^@@ \|' . g:magit_file_re . '\)', back . 'wn')
call cursor(line, 0)
endif
while ( foldclosed(line) != -1 ) while ( foldclosed(line) != -1 )
try try
foldopen foldopen
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment