0

I would like to create a macro that does:

set paste
<paste>
set nopaste

This will save me from <paste> (Oh, forgot I again!) Delete. Execute the above. Over and over. :-)

But I can't think of a way to do it because action comes from outside of vi. I am using iTerm2 on a mac.

Any ideas?

1

You can remap your paste command to LEADER + p

nnoremap <leader>p :set paste<cr>p:set nopaste<cr>
0

If you're pasting from the clipboard, paste directly using "+p. I use \p as a mapping for it:

nnoremap <leader>p "+p

This should prevent problems with indentation, etc.

I have the following mappings for pasting from the clipboard and copying to it:

noremap <leader>p "+p
noremap <leader>y "+y

Your Answer

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

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