Vim (terminal) - copy to x clipboard and paste while suspeneded
I have vimx installed, so I can copy in vimx to the x clipboard by using "+y
and the like, which works well as long as I can keep the current vimx running.
However, I also love to be able to switch to the current running shell with ctrl-z
and be able to开发者_JAVA百科 paste what I copied from vim into the shell. Does anyone know how to do this, because as soon as I suspend vim with ctr-z
the x-clipboard becomes empty, until I put vim into the fg
again.
ok,
After about an hour of head bashing this issue, I have decided to use a different approach to do the same thing.
I will detail what I did here for the benefit of those with the same issue.
If you have wxcopy
on your system that is enough to get copy/paste support on your system between vim and other apps. If you want to copy from vim, select the text using v
or V
or whatever method you prefer, then use the command :tee >(wxcopy)
. This will copy that code into the oldschool X11 cut buffer. This buffer has the added bonus of not requiring the parent application to be running for pasting to work, hence my problem goes away.
I realize it may be hard to get your hands on wxcopy
, under fedora the package that provides it is:
WindowMaker
This isn't an answer as much as a push in the right direction, but start here:
:help quoteplus
:help x11-cut-buffer
Specifically the second help text has some interesting notes about suspending vim. It claims to write the buffer into PRIMARY and CUT_BUFFER0 so you can still use middle click after you've suspended. Maybe you've deleted those or a plugin is interfering? Maybe you are running an old version of vim (I'm running 7.2.182).
My suggestion is to disable all plugins you've manually installed and try vanilla vim. If that doesn't work, consider using vim's -V (verbose) flag and see if it will try to put the buffer into PRIMARY or CUT_BUFFER0 before it actually gets suspended.
I don't have vim compiled with X (vimx) so I can't actually test this myself. Hopefully that gets you in the right direction.
精彩评论