I'm adding a buffer-local mapping to close netrw windows:
" ~/.vim/ftplugin/netrw.vim nnoremap <buffer> q <C-W>c
It works, but it hesitates because Netrw has created other mappings with a
q prefix, namely
qL, so it waits for the duration of
'timeoutlen' before executing my mapping.
I want my
q mapping to be instantaneous, so I've unmapped the other
nunmap <buffer> qb nunmap <buffer> qf nunmap <buffer> qF nunmap <buffer> qL
But rather than hard-code these and have to update them if netrw adds more
q mappings, I'd like to programmatically fetch a list of the keys my netrw buffer has mapped to sequences beginning with
q and use that to drive the unmappings.
I suppose I could parse the output of
:nmap, but that seems like a kludge. Is this information more directly accessible?
The answer provided below worked perfectly. It turns out, however, there's a way I can avoid the need to fetch these keybindings in the first place:
I came across this when reading through the dirvish plugin. So rather then perform any
nunmaps, I just changed my ftplugin file to:
nnoremap <nowait> <buffer> q <C-W>c
and it works right away!