Slackware This 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
 |
|
09-13-2008, 01:40 PM
|
#1
|
Member
Registered: Apr 2008
Location: China, Beijing
Distribution: Slackware
Posts: 423
Rep:
|
How to copy and paste things between vim and system clipboard
Can somebody show how to do it under 12.1? Thanks in advance.
|
|
|
Click here to see the post LQ members have rated as the most helpful post in this thread.
|
09-13-2008, 02:06 PM
|
#2
|
Amigo developer
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928
|
Left click-n-drag to highlight what you want to select. To paste into nearly any other application just click the center mouse button.
|
|
|
09-13-2008, 02:10 PM
|
#3
|
Senior Member
Registered: Jul 2007
Distribution: Slackware64-14.1
Posts: 2,367
|
I don't think that works with vim...
As far as I know, vim wasn't compiled with xterm-clipboard enabled, so you'll have an interesting time getting it to work. But I don't use vim at all, so I am probably wrong.
|
|
|
09-13-2008, 02:10 PM
|
#4
|
LQ Guru
Registered: Mar 2004
Distribution: Slackware
Posts: 6,858
|
Sometimes this setting: set mouse=r (in ~/.vimrc) helps when the mouse does not follow
|
|
|
09-13-2008, 04:55 PM
|
#5
|
Moderator
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,996
|
Hi,
I use 'gpm' and when you select then highlight with the left mouse button you can then pick a point in the same or other application with input mode. You can then insert with the right mouse button. This works in 'vi/elvis' since that's what I use. It will work between M$ and Linux since it is buffered.
|
|
|
09-13-2008, 05:13 PM
|
#6
|
HCL Maintainer
Registered: Jun 2003
Location: McCalla, AL, USA
Distribution: Gentoo on headless; Arch on everything that requires a GUI
Posts: 6,941
Rep: 
|
In /usr/share/vim/vimrc you need to comment (using ")
the line about set mouse. Then it will work.
|
|
1 members found this post helpful.
|
09-13-2008, 09:05 PM
|
#7
|
Member
Registered: May 2007
Distribution: Slackware
Posts: 288
Rep: 
|
In some text editors (vim and mcedit), I find I have to use SHIFT-middleclick in order to paste (as opposed to just middleclick).
|
|
|
09-13-2008, 09:48 PM
|
#8
|
Senior Member
Registered: Mar 2007
Location: Russia
Distribution: Slackware 12.2
Posts: 1,202
Rep:
|
Quote:
Originally Posted by grissiom
Can somebody show how to do it under 12.1? Thanks in advance.
|
"+yy or "*yy to copy to clipboard
"+p or "*p to paste from clipboard
See this:
http://lug.wsu.edu/node/1239
http://vim.wikia.com/wiki/Accessing_...stem_clipboard
vim in slackware 12.1 is configured without +xterm_clipboard, so it won't work in terminal version of vim. You might want to rebuild vim from source.
Or use gvim, where this method is supported.
Last edited by ErV; 09-13-2008 at 09:51 PM.
|
|
1 members found this post helpful.
|
09-14-2008, 01:31 AM
|
#9
|
Member
Registered: Apr 2008
Location: China, Beijing
Distribution: Slackware
Posts: 423
Original Poster
Rep:
|
Thanks guys, thanks for your advices~
I've tried set mouse=r and comment mouse settings in /usr/share/vim/vimrc but they don't work. ;(
It seems that it's very hard to send things to clipboard without +xterm_clipboard. But "SHIFT-middleclick" will paste in the input mode and paste words after 'i' or 'c' in the normal mode. It seems "SHIFT-middleclick" just throw strings into the terminal. Maybe we can do the copy in that way?
Yes, Gvim is xterm_clipboard enabled and hornor "+y. But I perfer launch vim while navigating in Konsole and hate the bad appearance of Gvim in a KDE environment.
I see that Vim 7.2 is out. Maybe PatV is preparing an other update?
Thanks.
|
|
|
09-14-2008, 01:42 AM
|
#10
|
Member
Registered: Nov 2007
Location: Canada
Distribution: Slackware 12.0
Posts: 100
Rep:
|
"How to Setup Slackware" - http://www.vcn.bc.ca/~dugan/setting-up-slackware.html
Quote:
Vim
The version of vim that comes with Slackware is compiled without x support. This is to accomodate users who don't run X. Unfortunately, this also means that if you do run X, you can't paste into vim from other X apps. Solve this problem by recompiling vim for X support (pass --with-x to its configure script). This is best done by downloading the entire vim source directory from a Slackware mirror, then editing and running the SlackBuild. After you do so, you'll be able to run the console version of vim inside an xterm, and paste text into it from other X applications.
|
|
|
1 members found this post helpful.
|
09-14-2008, 03:20 AM
|
#11
|
HCL Maintainer
Registered: Jun 2003
Location: McCalla, AL, USA
Distribution: Gentoo on headless; Arch on everything that requires a GUI
Posts: 6,941
Rep: 
|
This is mighty funny to me, because I can paste into ViM from konsole
or from X apps using the middle button. What am I missing, or rather,
what have I got that you are missing?
I can paste into ViM opened from the KDE menu, or into "vim file" from
konsole, or into vim opened in xterm to and from anywhere.
Code:
mingdao@silas:~$ ls /var/log/packages/vim-
vim-7.1.330-i486-1_slack12.1 vim-gvim-7.1.330-i486-1_slack12.1
Code:
mingdao@silas:~$ less /usr/share/vim/vimrc | grep mouse
" In many terminal emulators the mouse works just fine, thus enable it.
" set mouse=a
As a matter of fact, I've not found anywhere yet that I can't drag
with the left mouse button and paste with middle click.
|
|
|
09-14-2008, 03:55 AM
|
#12
|
Member
Registered: Nov 2005
Location: Diessen, The Netherlands
Distribution: Slackware 15
Posts: 700
Rep:
|
Quote:
Originally Posted by Bruce Hill
This is mighty funny to me, because I can paste into ViM from konsole
or from X apps using the middle button. What am I missing, or rather,
what have I got that you are missing?
I can paste into ViM opened from the KDE menu, or into "vim file" from
konsole, or into vim opened in xterm to and from anywhere.
As a matter of fact, I've not found anywhere yet that I can't drag
with the left mouse button and paste with middle click.
|
Same here.
Never recompiled vim... 
|
|
|
09-14-2008, 04:40 AM
|
#13
|
LQ Guru
Registered: Mar 2004
Distribution: Slackware
Posts: 6,858
|
Yes, copy and paste from X apps and the reverse works here too 
My ~/.vimrc looks like:
Code:
if v:lang =~ "utf8$" || v:lang =~ "UTF-8$"
set fileencodings=utf-8,latin1
endif
set nocompatible
set showmode
set ttyfast
set wildchar=<TAB>
set backspace=indent,eol,start
set nobackup
set history=50
set ruler
" Only do this part when compiled with support for autocommands
if has("autocmd")
" In text files, always limit the width of text to 78 characters
autocmd BufRead *.txt set tw=78
" When editing a file, always jump to the last cursor position
autocmd BufReadPost *
\ if line("'\"") > 0 && line ("'\"") <= line("$") |
\ exe "normal g'\"" |
\ endif
endif
map Q gq
if &t_Co > 2 || has("gui_running")
syntax on
set hlsearch
endif
if &term=="xterm"
set t_Co=8
set t_Sb=^[4%dm
set t_Sf=^[3%dm
endif
set tabstop=4
set autoindent
set mouse=r
|
|
|
09-14-2008, 04:42 AM
|
#14
|
Member
Registered: Apr 2008
Location: China, Beijing
Distribution: Slackware
Posts: 423
Original Poster
Rep:
|
Quote:
Originally Posted by Bruce Hill
This is mighty funny to me, because I can paste into ViM from konsole
or from X apps using the middle button. What am I missing, or rather,
what have I got that you are missing?
I can paste into ViM opened from the KDE menu, or into "vim file" from
konsole, or into vim opened in xterm to and from anywhere.
|
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.
|
|
|
09-14-2008, 04:48 AM
|
#15
|
Member
Registered: Sep 2004
Distribution: Slackware-14.2
Posts: 472
Rep: 
|
Have you tried using the shift key when selecting/pasting with the mouse?
Some programs such as midnight commander or links require it.
If you're using vim as mc's default editor (export EDITOR="vim"), try starting mc with "mc -d" - this disables the mouse from controlling mc, but allows select/paste without the shift key.
[EDIT] sorry - please ignore - I hadn't seen post #9
Last edited by harryhaller; 09-14-2008 at 06:00 AM.
|
|
|
All times are GMT -5. The time now is 02:27 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|