I'm having a headache trying to figure out why vim isn't copying to a system buffer.
Here's my workflow:
vim asd
y1y
:q
vim qwe
p
On computerA and computerB, this works as I want it to: the line yanked from the file asd is put into the file qwe.
On computerC, this doesn't work.
All systems are running Ubuntu 8.04. computerA has the vim-full package installed, computerB and computerC have the vim package installed. computerA has xorg installed, is using the fluxbox window manager, and is accessed locally. computerB and computerC don't have X, and I'm sshing into both of them.
I've done a lot of reading and thought it was because computerC was compiled with -clipboard, but I ran vim --version on all three computers and only computerA was compiled with +clipboard.
Am I missing something obvious? I believe the user's .vimrc and the global vimrc files are the same. I can post output of vim --version and contents of vimrc files if that would help.
Take a look in .viminfo if the last thing you yanked was hi it should contain:
Registers:
""0 LINE 0 hi
Maybe the file permissions are messed up?
It doesn't exactly solve your problem, but a perfectly fine workaround would be
Which will open
asd
and yank from it (obviously), then split-openqwe
,put
your just-yanked item, and close the split-opened file. With this approach, there's no need to close the document you're working on a start a new instance of Vim.And if you don't like the horizontal split,
:vsp
makes a vertical split, which can sometimes be easier to read/use.Vim by default doesn't copy to a system buffer. The only way that it would remember the contents is if the multiple instances of vim use the same .viminfo file. It's possible that the .viminfo file isn't being written due to file permissions or due to a different setting in
'viminfo'
(the option).For more information on the viminfo configuration, see
To look at your current configuration on each computer, do:
As an aside, if you want to use the system clipboard (which must be present, so you'd need to do
ssh -X
), you can use:Then all copy and paste operations will use the X11 selection buffer. Of course, you need vim compiled with
+clipboard
for this to work, so it won't solve your immediate problem. See:for more information.
Perhaps you could post the result of the following on each computer?
This would help us to diagnose the problem in more detail. Could you also try:
This will use register
a
instead of the unnamed register.Why not use
"+y
and"+p
, they work directly with the system's clipboard bufferOK, I don't know about the system buffer issue, but what about simply opening the new file with
:e filename
, then pasting, then saving and:e #
ing your way back to the original file if needed? Yeah I know, tabs and splits are cool, but simple can do the job too.You could also use ex, either from the target file to read the content to be included via the
:r
command supplying a line range, or from the source file to append the selected text (either via simple line number/range or the almightyg
command) with:w >> filename
.Try this:
It allows copying and pasting through the system clipboard.