Use [c and ]c to jump between hunks (changes).

This is more consistent with Vim.
This commit is contained in:
Andy Stewart
2014-01-15 15:36:13 +01:00
parent 6c435e5681
commit 0537c6945a
2 changed files with 12 additions and 10 deletions

View File

@@ -69,16 +69,16 @@ And you can turn line highlighting on and off (defaults to off):
Furthermore you can jump between hunks: Furthermore you can jump between hunks:
* jump to next hunk: `]h` * jump to next hunk (change): `]c`
* jump to previous hunk: `[h`. * jump to previous hunk (change): `[c`.
Both of those take a preceding count. Both of those take a preceding count.
To set your own mappings for these, for example `gh` and `gH`: To set your own mappings for these, for example `]h` and `[h`:
```viml ```viml
nmap gh <Plug>GitGutterNextHunk nmap ]h <Plug>GitGutterNextHunk
nmap gH <Plug>GitGutterPrevHunk nmap [h <Plug>GitGutterPrevHunk
``` ```
When your cursor is in a hunk, you can: When your cursor is in a hunk, you can:

View File

@@ -246,13 +246,15 @@ function! GitGutterGetHunkSummary()
endfunction endfunction
nnoremap <silent> <Plug>GitGutterNextHunk :<C-U>execute v:count1 . "GitGutterNextHunk"<CR> nnoremap <silent> <expr> <Plug>GitGutterNextHunk &diff ? ']c' : ":\<C-U>execute v:count1 . 'GitGutterNextHunk'\<CR>"
nnoremap <silent> <Plug>GitGutterPrevHunk :<C-U>execute v:count1 . "GitGutterPrevHunk"<CR> nnoremap <silent> <expr> <Plug>GitGutterPrevHunk &diff ? '[c' : ":\<C-U>execute v:count1 . 'GitGutterPrevHunk'\<CR>"
if g:gitgutter_map_keys if g:gitgutter_map_keys
if !hasmapto('<Plug>GitGutterNextHunk') && maparg(']h', 'n') ==# '' if !hasmapto('<Plug>GitGutterPrevHunk') && maparg('[c', 'n') ==# ''
nmap ]h <Plug>GitGutterNextHunk nmap [c <Plug>GitGutterPrevHunk
nmap [h <Plug>GitGutterPrevHunk endif
if !hasmapto('<Plug>GitGutterNextHunk') && maparg(']c', 'n') ==# ''
nmap ]c <Plug>GitGutterNextHunk
endif endif
endif endif