0

If I try to map capital 'Y' in my vimrc, this is getting ignored. For example, if I put something like

nmap Y :w<CR>

in my vimrc, this has no effect. However if I run vim and I enter

:nmap Y :w<CR>

then the mapping works as expected.

I tried an empty vimrc with only this line, so I'm sure there's no other mapping interfering or something.

Why does this happen?

  • This command works for me when I put it in vimrc as well as file's command line. Sometimes, your vimrc configuration might be overridden by default settings. This has happened for me. I faced a similar problem. When i set path in vimrc, it doesnt work. But when i gave it in script, it worked. I gave :verbose set path in command line to check which changed the value. The default file has removed my config from vimrc. So, similarly, you can check a verbose command in command line to check whether your cvimrc has been overridden or not. – SibiCoder Apr 25 '16 at 7:25
  • 1
    Thanks for the feedback. Running :verbose nmap Y :w<CR> did not return anything though.. – geo909 Apr 25 '16 at 13:38
  • You shouldn't give full command with verbose. Just give like :verbose map (or :verbose nmap). That should show the mappings done. You can check whether your map is in that list. If it isn't there, then your vimrc config has been overridden by system's vimrc config file. – SibiCoder Apr 25 '16 at 14:44

Your Answer

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

Browse other questions tagged or ask your own question.