How to copy and paste things between vim and system clipboard
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I forgot to mention that I'm using KDE4.1 testing package from slackware.com. But I think it maybe does not metter. On my box, middle click does not paste the words selected outside but same other words which I don't know where they come from. But Shift+middle click dose the work.
Besides, it's also unconvenience if I can only paste things in but cannot get things out.
In /usr/share/vim/vimrc have you commented set mouse=a ?
Click here to see the post LQ members have rated as the most helpful post in this thread.
Oh, IMHO, when set mouse=a, drag with left button could trigger visual mode, in which the selected content is handdled by vim internally but not X. So we cannot copy things out when mouse=a. But when set mouse=r, dragging mouse will not trigger visual mode so the selected content is passed to X. So we can copy things out.
Hmm,it's a pity that we cannot copy things out while in visual mode...
I think you have some conflict, perhaps in a vimrc you added
or something. Not only on 6 boxen on this LAN, but all other
computers where I've installed Slackware (I build and repair
them), commenting set mouse=a in /usr/share/vim/vimrc enables
highlighting with the left button and pasting with the middle
button -- everywhere.
I think you have some conflict, perhaps in a vimrc you added
or something. Not only on 6 boxen on this LAN, but all other
computers where I've installed Slackware (I build and repair
them), commenting set mouse=a in /usr/share/vim/vimrc enables
highlighting with the left button and pasting with the middle
button -- everywhere.
Oh, yes. I'm sorry... I set mouse=a in ~/.vimrc ... ;(
Distribution: Fedora 3,4- Ubuntu 6.06 to 8.10, Gentoo and Arch
Posts: 408
Rep:
Basically, set mouse=r, will let you copy from vim to X.
However, I rather have set mouse=a, where I can point to anywhere in the file using mouse. I don't copy things from vim to X very often. But if I want to do it, I write :set mouse=r real quick and copy it to the X.
Last edited by mohtasham1983; 09-25-2008 at 05:37 PM.
Somehow my instructions are too complicated, or your
~/.vimrc files are overruling the system wide one, or
I am not understanding your problems or posts ...
Quote:
Why do they have these problems with ViM?
And why don't they comment out set mouse=a in /usr/share/vim/vimrc
and see how well it works?
I wrote that in GViM, and saved it. Then reopened it
and dragged the text with the left mouse button. Then
I copied it into here with the middle mouse button.
That is copying from ViM to X. As stated before, I can
copy and paste to and from ViM and every app in this way,
no matter where I start ViM from, too.
Also, it works for me with USB mouse, USB wireless mouse,
USB wireless mouse/kbd combo, PS/2 mouse, touchpad and
synaptic mouse. Only one I haven't tried it with is the
bluetooth mouse which default Slack kernel doesn't even
detect. When I have time for a custom kernel to get that
rodent working, I'll try it.
Maybe I'm missing something here and you can help me.
I don't have a personal .vimrc nor have I touched the main vimrc.
Once again, might I suggest you "touch" the main vimrc?
Code:
mingdao@silas:~$ cat /etc/slackware-version
Slackware 12.1.0
mingdao@silas:~$ ls /var/log/packages/vim-
vim-7.1.330-i486-1_slack12.1 vim-gvim-7.1.330-i486-1_slack12.1
mingdao@silas:~$ less /usr/share/vim/vimrc | grep mouse
" In many terminal emulators the mouse works just fine, thus enable it.
" set mouse=a
mingdao@silas:~$ ls -l .vimrc
/bin/ls: cannot access .vimrc: No such file or directory
I can't remember if this bad behavior first started in vim
with Slack-12.0, or 12.1 -- however, doing just what you see
above allows me to copy into and out of vim into and out of
any app on my box.
I have installed the new version of these apps from Slack-12.1
patches, but vim-7.1.285-i486-1 worked the same. And it is now
working the same on many other boxen.
OK, I'm using VIM7.2 from current but I think it shouldn't be a problem since there is no changes in copying part as far as I can see.
In my condition:
:set mouse=a allowed copy to vim (via middle-click)
:set mouse=r allowed copy from vim (via drag selection and middle-click in other space) and copy to vim (via middle-click)
I don't think touch /usr/share/vim/vimrc is a good idea because all the work can be done via edit ~/.vimrc. This doesn't hurt the root system.
how to fix gvim to use the clipboard directly: read the online help!
according to
:help clipboard
When the "unnamed" string is included in the 'clipboard' option, the unnamed register is the same as the "* register. Thus you can yank to and paste the selection without prepending "* to commands.
So check the output of
:set clipboard?
and add in ,unnamed,
for example, in my .vimrc,
set clipboard=autoselect,unnamed,exclude:cons\|linux
You still need to press yy to yank and p to paste, but it's easier than "*yy and "*p
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.