mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-15 14:53:51 -05:00
Add next/previous section maps
This commit is contained in:
@@ -1730,6 +1730,8 @@ function! fugitive#BufReadStatus() abort
|
||||
nunmap <buffer> ~
|
||||
nnoremap <buffer> <silent> <C-N> :<C-U>execute <SID>StageNext(v:count1)<CR>
|
||||
nnoremap <buffer> <silent> <C-P> :<C-U>execute <SID>StagePrevious(v:count1)<CR>
|
||||
nnoremap <buffer> <silent> [[ :<C-U>execute <SID>PreviousSection(v:count1)<CR>
|
||||
nnoremap <buffer> <silent> ]] :<C-U>execute <SID>NextSection(v:count1)<CR>
|
||||
exe "nnoremap <buffer> <silent>" nowait "- :<C-U>execute <SID>Do('Toggle',0)<CR>"
|
||||
exe "xnoremap <buffer> <silent>" nowait "- :<C-U>execute <SID>Do('Toggle',1)<CR>"
|
||||
exe "nnoremap <buffer> <silent>" nowait "s :<C-U>execute <SID>Do('Stage',0)<CR>"
|
||||
@@ -2565,6 +2567,29 @@ function! s:StagePrevious(count) abort
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:NextSection(count) abort
|
||||
for i in range(a:count)
|
||||
if !search('^[A-Z][a-z][^:]*$','W')
|
||||
return '.'
|
||||
endif
|
||||
+
|
||||
endfor
|
||||
call s:StageReveal()
|
||||
return '.'
|
||||
endfunction
|
||||
|
||||
function! s:PreviousSection(count) abort
|
||||
-
|
||||
for i in range(a:count)
|
||||
if !search('^[A-Z][a-z][^:]*$\|\%^','bW') || line('.') == 1
|
||||
return '.'
|
||||
endif
|
||||
+
|
||||
endfor
|
||||
call s:StageReveal()
|
||||
return '.'
|
||||
endfunction
|
||||
|
||||
function! s:StageInline(mode, ...) abort
|
||||
let lnum1 = a:0 ? a:1 : line('.')
|
||||
let lnum = lnum1 + 1
|
||||
|
||||
Reference in New Issue
Block a user