LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 09-13-2008, 01:40 PM   #1
grissiom
Member
 
Registered: Apr 2008
Location: China, Beijing
Distribution: Slackware
Posts: 423

Rep: Reputation: 45
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.
Old 09-13-2008, 02:06 PM   #2
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
Left click-n-drag to highlight what you want to select. To paste into nearly any other application just click the center mouse button.
 
Old 09-13-2008, 02:10 PM   #3
T3slider
Senior Member
 
Registered: Jul 2007
Distribution: Slackware64-14.1
Posts: 2,367

Rep: Reputation: 843Reputation: 843Reputation: 843Reputation: 843Reputation: 843Reputation: 843Reputation: 843
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.
 
Old 09-13-2008, 02:10 PM   #4
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
Sometimes this setting: set mouse=r (in ~/.vimrc) helps when the mouse does not follow
 
Old 09-13-2008, 04:55 PM   #5
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
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.
 
Old 09-13-2008, 05:13 PM   #6
Bruce Hill
HCL Maintainer
 
Registered: Jun 2003
Location: McCalla, AL, USA
Distribution: Arch, Gentoo
Posts: 6,940

Rep: Reputation: 129Reputation: 129
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.
Old 09-13-2008, 09:05 PM   #7
saulgoode
Member
 
Registered: May 2007
Distribution: Slackware
Posts: 288

Rep: Reputation: 155Reputation: 155
In some text editors (vim and mcedit), I find I have to use SHIFT-middleclick in order to paste (as opposed to just middleclick).
 
Old 09-13-2008, 09:48 PM   #8
ErV
Senior Member
 
Registered: Mar 2007
Location: Russia
Distribution: Slackware 12.2
Posts: 1,202
Blog Entries: 3

Rep: Reputation: 62
Quote:
Originally Posted by grissiom View Post
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.
Old 09-14-2008, 01:31 AM   #9
grissiom
Member
 
Registered: Apr 2008
Location: China, Beijing
Distribution: Slackware
Posts: 423

Original Poster
Rep: Reputation: 45
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.
 
Old 09-14-2008, 01:42 AM   #10
Cotobear
Member
 
Registered: Nov 2007
Location: Canada
Distribution: Slackware 12.0
Posts: 100

Rep: Reputation: 16
"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.
Old 09-14-2008, 03:20 AM   #11
Bruce Hill
HCL Maintainer
 
Registered: Jun 2003
Location: McCalla, AL, USA
Distribution: Arch, Gentoo
Posts: 6,940

Rep: Reputation: 129Reputation: 129
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.
 
Old 09-14-2008, 03:55 AM   #12
adriv
Member
 
Registered: Nov 2005
Location: Diessen, The Netherlands
Distribution: Slackware 15
Posts: 700

Rep: Reputation: 43
Quote:
Originally Posted by Bruce Hill View Post
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...
 
Old 09-14-2008, 04:40 AM   #13
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
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
 
Old 09-14-2008, 04:42 AM   #14
grissiom
Member
 
Registered: Apr 2008
Location: China, Beijing
Distribution: Slackware
Posts: 423

Original Poster
Rep: Reputation: 45
Quote:
Originally Posted by Bruce Hill View Post
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.
 
Old 09-14-2008, 04:48 AM   #15
harryhaller
Member
 
Registered: Sep 2004
Distribution: Slackware-14.2
Posts: 468

Rep: Reputation: Disabled
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.
 
  


Reply

Tags
vim



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
copy-paste in vim proNick Linux - Newbie 5 02-17-2008 07:29 PM
How to copy paste into VIM ? EAD Linux - Software 15 12-12-2006 06:38 PM
Buggy copy n paste with vim in terminal Kovacs Slackware 1 09-05-2006 12:13 AM
Clipboard Manager for quickly copy paste saurya_s Linux - Software 1 09-22-2005 09:33 AM
copy and paste not working (requested clipboard format not available) marie-p Linux - Software 1 01-23-2005 11:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 11:01 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration