Add default mappings.

This commit is contained in:
Andy Stewart
2013-04-17 11:23:11 +02:00
parent bcef63b7d5
commit 935184bd18
2 changed files with 16 additions and 6 deletions

View File

@@ -53,16 +53,18 @@ And you can turn line highlighting on and off (defaults to off):
* turn off with `:GitGutterLineHighlightsDisable`
* toggle with `:GitGutterLineHighlightsToggle`.
Furthermore you can jump between `[count]` hunks:
Furthermore you can jump between hunks:
* jump to next hunk: `:[count]GitGutterNextHunk [count]`
* jump to previous hunk: `:[count]GitGutterPrevHunk [count]`.
* jump to next hunk: `]h`
* jump to previous hunk: `[h`.
You may want to add mappings for these if you use them often. For example:
Both of those take a preceding count.
To set your own mappings for these, for example `gh` and `gH`:
```viml
nmap <silent> ]h :<C-U>execute v:count1 . "GitGutterNextHunk"<CR>
nmap <silent> [h :<C-U>execute v:count1 . "GitGutterPrevHunk"<CR>
nmap gh <Plug>GitGutterNextHunk
nmap gH <Plug>GitGutterPrevHunk
```
Finally, you can force vim-gitgutter to update its signs across all visible buffers with `:GitGutterAll`.

View File

@@ -524,6 +524,14 @@ function! GitGutterGetHunks()
return s:is_active() ? s:hunks : []
endfunction
nnoremap <silent> <Plug>GitGutterNextHunk :<C-U>execute v:count1 . "GitGutterNextHunk"<CR>
nnoremap <silent> <Plug>GitGutterPrevHunk :<C-U>execute v:count1 . "GitGutterPrevHunk"<CR>
if !hasmapto('<Plug>GitGutterNextHunk') && maparg(']h', 'n') ==# ''
nmap ]h <Plug>GitGutterNextHunk
nmap [h <Plug>GitGutterPrevHunk
endif
augroup gitgutter
autocmd!
if g:gitgutter_eager