Skip to content

Commit

Permalink
Add default mappings.
Browse files Browse the repository at this point in the history
  • Loading branch information
airblade committed Apr 17, 2013
1 parent bcef63b commit 935184b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
14 changes: 8 additions & 6 deletions README.mkd
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
8 changes: 8 additions & 0 deletions plugin/gitgutter.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 935184b

Please sign in to comment.