mirror of
https://github.com/airblade/vim-gitgutter.git
synced 2025-11-08 11:33:48 -05:00
Add default mappings.
This commit is contained in:
14
README.mkd
14
README.mkd
@@ -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`.
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user