chrisbra/NrrwRgn

How to remap all key bindings ?

Opened this issue · 5 comments

I use Lazy.nvim to install the plugin, I want:
(1) disable all current default key bindings.
(2) only define a key binding (eg, <leader> n) to relpace function of current <leader>nr.

that is not possible. The plugin defines keybindings for a reason.

Thanks. I forked this project and solved this issue!

bew commented

that is not possible. The plugin defines keybindings for a reason.

I too would prefer to disable all keybindings and define my own, why do you not want this to be possible, for what reasons? 🤔

you just need to re-define those mappings here:

if !hasmapto('<Plug>NrrwrgnDo') && !get(g:, 'nrrw_rgn_nomap_nr', 0)
xmap <unique> <Leader>nr <Plug>NrrwrgnDo
nmap <unique> <Leader>nr <Plug>NrrwrgnDo
endif
if !hasmapto('<Plug>NrrwrgnBangDo') && !get(g:, 'nrrw_rgn_nomap_Nr', 0)
xmap <unique> <Leader>Nr <Plug>NrrwrgnBangDo
endif
if !hasmapto('VisualNrrwRgn')
xnoremap <unique> <script> <Plug>NrrwrgnDo <sid>VisualNrrwRgn
nnoremap <unique> <script> <Plug>NrrwrgnDo <sid>VisualNrrwRgn
endif
if !hasmapto('VisualNrrwRgnBang')
xnoremap <unique> <script> <Plug>NrrwrgnBangDo <sid>VisualNrrwBang
endif

and then it shouldn't define its own mappings.

bew commented

Setting g:nrrw_rgn_nomap_nr & g:nrrw_rgn_nomap_Nr is even better, my mappings would be dynamically set later so not from the start.