1
As far as I know, there is no autocmd event for copying and pasting. So I was curious if it is possible to write a script that toggles paste mode when the clipboard is used for paste. If it can handle Shift+Insert, Ctrl+Shift+v and middle-mouse button, or even internal script, that would be awesome, but I am primarily seeking to solve the case with keyboard shortcuts. My vim has -clipboard attribute.
Is there a valid reason why you don't use
"+y? – romainl – 2013-03-11T09:07:41.213I combined the X11 'primary' clipboard and 'clipboard' clipboard on my OS and also my vim is configured to copy everything to special registers automatically. It's actually very convenient this way. There is a bug that needs to be worked around but I recommend you to give clipIt (and fakeclip if you lack +clipboard attr in your vim) a try!
– Forethinker – 2013-03-11T16:56:26.740(hmm, why did I say
yinstead ofp?) Nevermind, my point is that, if you usep(either with"+/"*or without a register if you haveset clipboard^=unnamedplus), the pasted text is always how you expect it to be. <kbd>Shift+Insert</kbd>, <kbd>Ctrl+Shift+v</kbd> and middle-mouse button are the wrong way to paste text in Vim.pis the right way. Unless you work remotely. – romainl – 2013-03-11T19:53:07.470clipboard variable only exists for vim with +clipboard attribute. – Forethinker – 2013-03-11T19:56:43.253
It's both easier and faster to install a proper Vim with clipboard support than messing around with external tools and custom mappings. Nothing beats
p(andP). – romainl – 2013-03-11T20:16:55.773