diff --git a/doc/signify.txt b/doc/signify.txt index 9082ca0..983d9d2 100644 --- a/doc/signify.txt +++ b/doc/signify.txt @@ -512,7 +512,13 @@ Hunk jumping:~ ]C Jump to last hunk. [C Jump to first hunk. -If you don't like these mappings, you can map them yourself: +These keys only get mapped by default when: + + - The keys are not mapped already (by you or another plugin). + - There are no other keys that are mapped to do the same (to avoid duplicate + mappings). + +Mapping other keys: > nmap gj (signify-next-hunk) nmap gk (signify-prev-hunk) diff --git a/plugin/signify.vim b/plugin/signify.vim index e08316a..73ced3e 100644 --- a/plugin/signify.vim +++ b/plugin/signify.vim @@ -85,13 +85,17 @@ nnoremap (signify-prev-hunk) &diff \ ? '[c' \ : ":\call sy#jump#prev_hunk(v:count1)\" -if empty(maparg(']c', 'n')) +if empty(maparg(']c', 'n')) && !hasmapto('(signify-next-hunk)', 'n') nmap ]c (signify-next-hunk) - nmap ]C 9999]c + if empty(maparg(']C', 'n')) && !hasmapto('9999]c', 'n') + nmap ]C 9999]c + endif endif -if empty(maparg('[c', 'n')) +if empty(maparg('[c', 'n')) && !hasmapto('(signify-prev-hunk)', 'n') nmap [c (signify-prev-hunk) - nmap [C 9999[c + if empty(maparg('[C', 'n')) && !hasmapto('9999[c', 'n') + nmap [C 9999[c + end endif " hunk text object