I want to auto indent code on pasting and found this:

:nnoremap p  p=`]                  --(not working)

but it was not working for me as the code still came out unindented.

So I used:

:nnoremap <c-p>  p=`]              --(working)

and it worked fine.

I would like to have the remap in the first way, any idea why it does not work.

  • It works for me. May 10, 2016 at 6:00
  • 2
    Why go through all that trouble when you already have [p and ]p?
    – romainl
    May 10, 2016 at 6:14
  • 3
    The first comment also works fine for me. Does :nmap p shows the correct mapping? If it doesn't you can use :verbose nmap p to see which file overrided your mapping.
    – statox
    May 10, 2016 at 7:57
  • 3
    @statox Thanks, I had an another mapping for p already, that was what was conflicting with this mapping.
    – meain
    May 10, 2016 at 12:17

1 Answer 1


When a mapping seems to do nothing or do something totally unexpected, the first reflex to have is to check if it is really mapped to what you want.

To do so the command :map is your friend:

When using only :map, Vim will prompt all the mappings created in the current session. To restrict your search to the problematic mapping simply pass the not working keys as argument of the command: here it would be :map p.

Note that you can use :map <Leader>k to check what Leaderk is mapped.

It is also good to know that commands like :nmap, :vmap, :imap can be used to search for mapping in particular modes.

Once the :map commands proved that your mapping is overrided you can easily find which file overrided it: :verbose map <key> will prompt the last file which modified the mapping.

Finally in some cases it can be useful to know that :mapc can be used to unmap a key sequence.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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