To implement pasting only once I can use:
noremap <silent> p p:let @"=""<cr>
This clears register after pasting, so that following paste will not work. What will however happen is empty pasting which updates undo. So pressing p 3 times will require 3 undo calls to undo the initial paste.
How to suppress this? I tried something like:
:noremap <expr> @" != "" ? p:let @"="" : <Nop> <cr>
But it doesn't impose any change.
This one is working for me:
:noremap <silent> <expr> p @" != "" ? 'p:let @"=""<cr>' : ""
To be a bit shorter:
:noremap <silent> <expr> p @" != "" ? 'pq"q' : ""
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With