1

For example, if I have the mapping nnoremap p ]p and want to put text only once with the unmapped p behaviour, is there a key I can press before p to bypass those mappings? Something like a shell command command.

I tried <c-v>p and i<c-o>p but that didn't do the trick.

Note that I'm trying to learn if there's a built-in feature that does that to various commands; I'm not looking for a solution that solves this case specifically, like nnoremap <leader>p p.

Also, there's a similar question out there, but that is not about executing the normal command from normal mode.

1 Answer 1

1

You can use :normal! p, the :normal command executes its argument as a sequence of Normal-mode commands, and the ! modifier bypasses any mappings.

See :help :normal for more details.

4
  • This executes an ex command while in command-line mode, so it doesn't answer the question. Thanks for you time, though :)
    – anakimluke
    Commented Feb 28, 2023 at 23:24
  • Sure, I understand that, but : gets you there from Normal mode. Why necessarily a restriction of staying in Normal mode and not going through Command-line mode to accomplish this?
    – filbranden
    Commented Mar 1, 2023 at 1:14
  • 1
    because it feels like it's a feature vim might just have and I just don't know about it. It's also more convenient to a workflow and, if normal mode has it, maybe it is also available in visual mode(where the :normal! p trick doesn't seem to work)
    – anakimluke
    Commented Mar 1, 2023 at 12:22
  • @anakimluke in visual mode, a mapping could use <Cmd>normal! p instead.
    – D. Ben Knoble
    Commented Mar 1, 2023 at 14:32

Your Answer

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

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