1
This question is more general than the problem I am currently faced with, and may not have a solution. But my real problem may have a solution if there is no general solution.
What I want to do is if I use y
from visual mode, I want Vim to yank both to the +
register and to the regular "
register.
I don't care about clobbering the system clipboard, because there are tools I use to record past clipboard entries. I just want a way to yank to clipboard which is easy enough to perform that I may actually make use of it.
Possible approaches
- bind key to function which somehow hopefully can grab the range of the selection, and then stick it into both registers -- i think this can be done, i have a magic snippet in my vimrc that does this. I have no idea how it works. Looks like this:
vnoremap <silent> x :<C-u>execute 'normal! vlF' . nr2char(getchar()) . 'of' . nr2char(getchar())<CR>
- yank and then call function that explicitly copies
"
register to+
register. Not sure how to do a yank and then call some function. might be easier - ???
- no direct profit likely
Yeah i wanted to only have visual mode
y
to yank to system clipboard so that i wont end up with a ton of useless entries. I guess you brought up a really good point at the end there, which is... all yanks always go into"
so I really didnt need to even find or write a way to bind two actions to the key. – Steven Lu – 2014-12-10T08:12:11.297This works well. I didn't mention... I can't actually even type
"+y
in visual mode, because my"
is bound tosurround.vim
to surround selection with double-quotes. – Steven Lu – 2014-12-10T08:16:19.763