diffchar.vim
diffchar.vim copied to clipboard
How to prevent the plugin from mapping <leader>g
You can use
]b
or]e
to jump cursor to start or end position of the next difference unit, and[b
or[e
to the start or end position of the previous unit. Those keymaps are configurable in your vimrc and so on.
I can create additional keymaps, but how do I prevent the plugin from hijacking <leader>g for example.
This plugin uses <Leader>g
for <Plug>GetDiffCharPair
as a default.
If <Leader>g
has been defined in your vimrc, this plugin does not overwrite your mapping, but <Plug>GetDiffCharPair
will not work.
If you still want to use it, try to set other key in your vimrc like this:
nmap <silent> <Leader>h <Plug>GetDiffCharPair
I don't think it works that way. The reason I am asking is that I have <leader>g mapped in my vimrc and diffchar maps it nonetheless.
For example, I tried to set this in my vimrc,
nmap <Leader>g :echo localtime()<CR>
diffchar does not overwrite the mapping and <Leader>g
correctly echoes the local time.
How do you exactly define <Leader>g
in your vimrc?
Hi, Thank you for this great plugin. This is what I did to unmap <Leader>p and <Leader>g since I use other p* and g* mappings -
" diffchar ---------
function s:UnmapSomeDiffCharKeys()
try
nunmap <Leader>p
nunmap <Leader>g
catch /E31:/
endtry
endfunction
autocmd BufEnter * call <SID>UnmapSomeDiffCharKeys()
" diffchar ---------
You could add your own <Leader>p mapping in this function after the endtry. thx, -m
The plugin does not overwrite the mappings, such as <Leader>g
, if those are defined in your vimrc. Is there any case to overwrite your mappings? Please let me know.
By the way, you can disable those functionalities and mappings:
nmap <Nop>(g) <Plug>GetDiffCharPair
nmap <Nop>(p) <Plug>PutDiffCharPair
or
nmap <Leader>g <Nop>
nmap <Leader>p <Nop>