0

I am using following vim plugins vinegar and unimpaired.

When I enter a netrw directory listing with -, the mappings of unimpaired starting with c (e.g. toggle line numbers with con) do not work because netrw has mapped the single letter c (:h netrw-c).

I'd like to patch vinegar to add an unmapping for the c mapping of netrw.

For completeness I give here the mapping of c as done in $VIMRUNTIME/autoload/netrw.vim:

nnoremap <buffer> <silent> <nowait> c :<c-u>call <SID>NetrwLcd(b:netrw_curdir)<cr>

I have tried to add in plugin/vinegar.vim to the function! s:setup_vinegar() abort following line

nunmap c

However, this does not work. This might be an issue of the load or evaluation order of vinegar w.r.t. netrw.

UPDATE Sept 2018

Netrw v162 has changed the mapping to netrw-cd and therefore I do not need this anymore.

1

I've figured it out while writing my question. Answer is given here: I cannot unmap a key combination `y<C-G>`

nunmap <buffer> c works.

❯ git diff
diff --git a/plugin/vinegar.vim b/plugin/vinegar.vim
index 28adce4..7afeafc 100644
--- a/plugin/vinegar.vim
+++ b/plugin/vinegar.vim
@@ -98,6 +98,7 @@ function! s:setup_vinegar() abort
   xnoremap <buffer> . <Esc>: <C-R>=<SID>escaped(line("'<"), line("'>"))<CR><Home>
   nmap <buffer> ! .!
   xmap <buffer> ! .!
+  nunmap  <buffer> c
   nnoremap <buffer> <silent> cg :exe 'keepjumps cd ' .<SID>fnameescape(b:netrw_curdir)<CR>
   nnoremap <buffer> <silent> cl :exe 'keepjumps lcd '.<SID>fnameescape(b:netrw_curdir)<CR>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.