I have this in my .vimrc
nnoremap <leader>p :CtrlP<CR><C-\>w
I change all nmap to nnoremap in my .vimrc and everything works fine except this one:
nnoremap <leader>p :CtrlP<CR><C-\>w
With nmap <leader>p :CtrlP<CR><C-\>w
it does automatically insert word into CtrlP and with nnoremap it doesn't, I get blank field, like I just pressed Ctrl-P.
Why it doesn't work with nnoremap?
When you create a mapping with nnoremap
, it does not consider your prior mappings when resolving what to do. In other words, if you had previously mapped any of these:
<CR>
<C-\>
w
Then those maps would be ignored in your <leader>p
mapping, and instead the default action of those keystrokes would be used.
As far as I know, <C-\>
has no default action, so I would suspect you have mapped it (or you are relying on a mapping that another plugin has added), but that mapping is not being taken into account here.