LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-16-2009, 10:05 PM   #1
posix_memalign
Member
 
Registered: Aug 2008
Posts: 81

Rep: Reputation: 15
Copy and paste


I'm unable to copy and paste from vim.

I can copy and paste from the terminal itself, and from programs such as pico and nano -- but I really only use vim.

Attempting :set paste/set nopaste seems to have no effect.

I use rxvt but the problem is also present in i.a. xterm.
 
Old 03-16-2009, 11:49 PM   #2
David1357
Senior Member
 
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,302
Blog Entries: 1

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by posix_memalign View Post
I can copy and paste from the terminal itself, and from programs such as pico and nano -- but I really only use vim.
Can you use gvim? That should have X11 copy/paste support.
 
Old 03-16-2009, 11:56 PM   #3
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,624

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
first why are you using "rxvt" . The only place i have seen it used is in MinGW / mSys

and in xterm there is no c/p
 
Old 03-18-2009, 03:37 PM   #4
posix_memalign
Member
 
Registered: Aug 2008
Posts: 81

Original Poster
Rep: Reputation: 15
Then tell me the name of a terminal emulator that is similar to rxvt and makes vim work.

I can use gvim, it works, but I want to use vim.
 
Old 03-18-2009, 03:54 PM   #5
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,624

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
i use Gnome-terminal and konsole

posix_memalign what distro are you using ?
 
Old 03-18-2009, 11:21 PM   #6
posix_memalign
Member
 
Registered: Aug 2008
Posts: 81

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by John VV View Post
i use Gnome-terminal and konsole

posix_memalign what distro are you using ?
konsole: I'm supposed to start up that bloatware-monster just to use a console?
gnome-terminal: I don't have it.

Besides, I tried konsole, I can't copy and paste properly (middle mouse button) within vim there either. The issue does not seem to be related to the choice in terminal emulator.

I'm using Slackware 12.2.
 
Old 03-19-2009, 02:05 PM   #7
David1357
Senior Member
 
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,302
Blog Entries: 1

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by posix_memalign View Post
Besides, I tried konsole, I can't copy and paste properly (middle mouse button) within vim there either.
If I right click on selected text in a gnome-terminal running on Cygwin/X, I can copy to the clipboard.

The middle button just seems to copy and then immediately paste. For the particular string I am using, it means that when it reaches the "a" character in the string, vi goes into insert mode and writes the rest of the string into the buffer.

I think you are trying to do something that is inherently impossible: Use X windows commands in a program that does not understand them. That is why I recommended gvim: It supports the X protocol.

To summarize: You are pushing a rope here.
 
Old 03-19-2009, 06:35 PM   #8
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
vim in a terminal ( konsole ) works fine with copy & paste.
vim in a VT ( <CTRL><ALT><F1> ) works fine with copy & paste.

Left-click and hold whilst you drag to highlight what you want copied. It is copied automatically. Nothing else to do.

Then just middle-button to paste.

Much nicer that that other OS

But I have the gpm package installed.
 
Old 03-20-2009, 01:29 AM   #9
posix_memalign
Member
 
Registered: Aug 2008
Posts: 81

Original Poster
Rep: Reputation: 15
No and no.

To make it perfectly clear:

By "copy and paste" I mean: Highlight arbitrary text by clicking and holding down the left mouse button while highlighting the desired text, release left mouse button -- text will stay highlighted. Move cursor to desired output area (i.e. where to 'paste' said text), click once middle mouse button, the text has now been copy and pasted.

This already works fine in the terminals I use. However if and only if (so far) I have vim running in one of the terminals (which copy and paste works in) this makes copy and paste NOT work.

Now, copy and pasting text such as C code into vim doesn't work without making bad formatting on the text, that requires the :set paste/:set nopaste to look perfect, I'm aware of that, but I'm not talking about that -- I'm talking about the fact that copy and paste doesn't work at all as long as vim runs in one of my terminals.

Please stop talking about gvim -- it has nothing to do with this issue.

Very important: This has worked perfectly fine over the past 10 years, it has only started to be an issue now.

My system is Slackware 12.2 with vim 7.2, X.Org X server 1.4.2, and XFCE 4.4.3.

Either this is a bug of some sort or there is a very trivial solution.
 
Old 03-20-2009, 09:42 AM   #10
David1357
Senior Member
 
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,302
Blog Entries: 1

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by posix_memalign View Post
Very important: This has worked perfectly fine over the past 10 years, it has only started to be an issue now.
I don't see how it can possibly work. The only way you can insert text into vim is when it is in insert mode. If you copy the text while it is in command mode, how do you put it in insert mode without doing something extra?

Also, the only way to move the cursor in vim is to use the command mode keys or search or other commands that move the cursor. How is your X windows paste command supposed to do that?
 
Old 03-20-2009, 11:26 PM   #11
posix_memalign
Member
 
Registered: Aug 2008
Posts: 81

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by David1357 View Post
I don't see how it can possibly work. The only way you can insert text into vim is when it is in insert mode. If you copy the text while it is in command mode, how do you put it in insert mode without doing something extra?

Also, the only way to move the cursor in vim is to use the command mode keys or search or other commands that move the cursor. How is your X windows paste command supposed to do that?
Are you serious?

I have used vi/vim for over 10 years, I'm fully aware of the differences between the various modes of vi/vim.

I obviously enter insert mode manually before I paste the desired text.
 
Old 06-16-2009, 03:41 AM   #12
sir-oberon
LQ Newbie
 
Registered: Jun 2009
Location: Munich
Posts: 1

Rep: Reputation: 0
I have to agree with posix_memalign for two reasons.
1. I have used copy/paste with middle mouse button in terminalbased vim for years.
2. I am facing the same problem that it does not work correctly.

I am using kubuntu 8.04 KDE4 and right now I am pasting a "T" all the time instead of pasting the selected text.
The odd thing is that sometimes it works perfectly. I tried changing settings in klipper but that didn't help. Stopping klipper didn't help aswell.

So please let me know if anyone has a solution to this problem.
 
Old 06-29-2009, 04:42 AM   #13
Skylinux
LQ Newbie
 
Registered: Jun 2009
Posts: 1

Rep: Reputation: 1
I came here because I have the same problem and registered to post the solution I found.

Solution:
Press SHIFT while selecting the text in vi/vim, voila you can now middle click to paste the text into other programs.

I love the dual buffer Linux has, having different things in CTRL+C/V and middle mouse is awesome
 
Old 07-01-2009, 02:37 AM   #14
posix_memalign
Member
 
Registered: Aug 2008
Posts: 81

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Skylinux View Post
I came here because I have the same problem and registered to post the solution I found.

Solution:
Press SHIFT while selecting the text in vi/vim, voila you can now middle click to paste the text into other programs.

I love the dual buffer Linux has, having different things in CTRL+C/V and middle mouse is awesome
Jesus H. christ, best solution I've ever seen.

Thanks.
 
Old 07-05-2009, 12:06 PM   #15
David1357
Senior Member
 
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,302
Blog Entries: 1

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by posix_memalign View Post
I obviously enter insert mode manually before I paste the desired text.
Maybe I am a poor reader. I was unable to find that step in any of your posts. I am glad that someone finally posted a satisfactory solution.

Last edited by David1357; 07-05-2009 at 12:08 PM.
 
  


Reply



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... gumuruhsspj Linux - General 3 09-28-2008 01:17 PM
copy/paste help abk4523 Linux - Newbie 4 05-31-2005 06:29 AM
how to copy and paste acd copy cd paschim Linux - General 2 04-05-2004 09:25 AM
Copy and paste scottie Linux - General 4 10-29-2003 01:27 PM
Copy and Paste? cli_man Linux - General 11 05-16-2003 04:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:54 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