mirror of
https://github.com/airblade/vim-gitgutter.git
synced 2025-11-08 11:33:48 -05:00
Use [c and ]c to jump between hunks (changes).
This is more consistent with Vim.
This commit is contained in:
10
README.mkd
10
README.mkd
@@ -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:
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user