LinuxQuestions.org
Visit Jeremy's Blog.
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 08-22-2017, 11:30 AM   #1
colinh2
Member
 
Registered: Dec 2015
Posts: 35

Rep: Reputation: Disabled
How to restore traditional X11 copy-paste when using vim?


I recently installed Slackware 14.2-64 and am using xfce4.

I'm running vim in an xfce4-terminal.

If I try to paste text into vim, while in insert mode, using middle-click (actually 2-finger tap), it seems to be the equivalent of doing ^V. Similarly, if I select text in vi
I can't then paste it to a terminal.

Is there a good explanation somewhere about X11 buffers, clipboards, left-click select/middle-click paste, ^X ^C ^V
etc?

I'd just like it to work the same way it did the last 25 years...
 
Old 08-22-2017, 03:30 PM   #2
Diantre
Member
 
Registered: Jun 2011
Distribution: Slackware
Posts: 515

Rep: Reputation: 234Reputation: 234Reputation: 234
Quote:
Originally Posted by colinh2 View Post
If I try to paste text into vim, while in insert mode, using middle-click (actually 2-finger tap), it seems to be the equivalent of doing ^V. Similarly, if I select text in vi
I can't then paste it to a terminal.
Try using Shift-Middle Click. To copy text from vim to another terminal I press Shift, select the text with the mouse, and then press Shift-Insert in the other terminal window to paste. Or you can select the text inside vim then press "*yy or "+yy to copy text to the system clipboard.

Quote:
Originally Posted by colinh2 View Post
Is there a good explanation somewhere about X11 buffers, clipboards, left-click select/middle-click paste, ^X ^C ^V
etc?
Read the vim help file with :help x11-selection first. There's also plenty of info out there. Here's two pages with more information:

https://stackoverflow.com/questions/...tems-clipboard

https://unix.stackexchange.com/quest...ternal-program

Hope that helps.
 
2 members found this post helpful.
Old 08-22-2017, 04:03 PM   #3
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,203

Rep: Reputation: 4289Reputation: 4289Reputation: 4289Reputation: 4289Reputation: 4289Reputation: 4289Reputation: 4289Reputation: 4289Reputation: 4289Reputation: 4289Reputation: 4289
Adding set mouse="" to your vimrc will do what you want, and is what I do to restore that functionality.
 
4 members found this post helpful.
Old 08-22-2017, 06:06 PM   #4
kjhambrick
Senior Member
 
Registered: Jul 2005
Location: Round Rock, TX
Distribution: Slackware64 15.0 + Multilib
Posts: 1,493

Rep: Reputation: 934Reputation: 934Reputation: 934Reputation: 934Reputation: 934Reputation: 934Reputation: 934Reputation: 934
Quote:
Originally Posted by GazL View Post
Adding set mouse="" to your vimrc will do what you want, and is what I do to restore that functionality.
Same here more-or-less:

Code:
set mouse=
Really didn't like the 'windowification' of vim myself ... I thought that was what gvim was all about ...

-- kjh

EDIT: I forgot this one ( from the manual: This prevents Vim from auto-indenting the pasted code )

Code:
set paste

Last edited by kjhambrick; 08-22-2017 at 06:10 PM.
 
3 members found this post helpful.
Old 08-22-2017, 06:18 PM   #5
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,203

Rep: Reputation: 4289Reputation: 4289Reputation: 4289Reputation: 4289Reputation: 4289Reputation: 4289Reputation: 4289Reputation: 4289Reputation: 4289Reputation: 4289Reputation: 4289
I spent so much time turning unwanted vim features off that I actually decided to try emacs instead.
 
Old 08-22-2017, 07:28 PM   #6
jmccue
Member
 
Registered: Nov 2008
Location: US
Distribution: slackware
Posts: 415

Rep: Reputation: 220Reputation: 220Reputation: 220
Quote:
Originally Posted by GazL View Post
I spent so much time turning unwanted vim features off that I actually decided to try emacs instead.
This is exactly what I have been doing, every vim release I need to increase the size of my ~/.vimrc to get back to 'sane' defaults. What really pushed me over the edge is when I had to add:
Quote:
set scrolloff=0
when vim set yet another new default, took me a while to find that one.

For the interested, these are the settings I have had to append to ~/.vimrc since the release of 7.x
pastebin

Edit forgot: what I have for copy/paste while in gvim

X-buffer, copy/paste:
Quote:
map <F9> "*y
map <S-F9> "*P
Windows type, copy/paste:

Quote:
map <F10> "+y
map <S-F10> "+gP
John

Last edited by jmccue; 08-22-2017 at 07:35 PM. Reason: edit: forgot to add what I do for copy/paste
 
3 members found this post helpful.
Old 08-22-2017, 10:26 PM   #7
colinh2
Member
 
Registered: Dec 2015
Posts: 35

Original Poster
Rep: Reputation: Disabled
Ahhh. Thanks everyone!

Huh. Now I see all the similar threads. My googling wasn't very effective :-(
 
Old 08-23-2017, 10:23 AM   #8
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 10,189

Rep: Reputation: 4753Reputation: 4753Reputation: 4753Reputation: 4753Reputation: 4753Reputation: 4753Reputation: 4753Reputation: 4753Reputation: 4753Reputation: 4753Reputation: 4753
I rebuild vim with

Code:
--with-x
And then I add the following to my .vimrc:

Code:
set ttymouse=xterm2
 
1 members found this post helpful.
Old 08-23-2017, 11:40 AM   #9
Gerard Lally
Senior Member
 
Registered: Sep 2009
Location: Brú na Bóinne, IE
Distribution: Slackware, NetBSD
Posts: 1,998

Rep: Reputation: 1506Reputation: 1506Reputation: 1506Reputation: 1506Reputation: 1506Reputation: 1506Reputation: 1506Reputation: 1506Reputation: 1506Reputation: 1506Reputation: 1506
Quote:
Originally Posted by GazL View Post
I spent so much time turning unwanted vim features off that I actually decided to try emacs instead.
With emacs and evil you get the best of both worlds. With emacs you get org-mode, an insanely powerful RPN calculator, a built-in shell, a file browser, a web browser, and Tramp for remote editing; and with evil you get Vim's far superior modal editing and keys. Evil's vi(m) emulation is almost flawless.
 
2 members found this post helpful.
Old 10-03-2017, 03:10 PM   #10
caffe
LQ Newbie
 
Registered: Feb 2015
Posts: 15

Rep: Reputation: Disabled
Quote:
Originally Posted by dugan View Post
I rebuild vim with
Code:
--with-x
Just fyi, you don't have to recompile vim. Pat kindly compiles vim twice (vim and vim-gvim packages). However, you don't have to use gvim's gui. It works just fine in the console (launch with -v). You then get x11 copy/paste without recompiling. I use this everyday with this in my bashrc:
Code:
[[ ! -z "$DISPLAY" ]] && alias vim="gvim -v"
 
2 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
vi/vim copy and paste from another editor. theKbStockpiler Linux - General 9 09-23-2011 07:20 PM
[SOLVED] Can't copy-paste from one terminal to another using vim cola Slackware 11 12-18-2009 11:51 PM
copy-paste in vim proNick Linux - Newbie 5 02-17-2008 08:29 PM
How to copy paste into VIM ? EAD Linux - Software 15 12-12-2006 07:38 PM
cygwin vim copy/paste problem takahaya Linux - Software 2 03-31-2006 02:16 AM

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

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