LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 08-22-2017, 10:30 AM   #1
colinh2
Member
 
Registered: Dec 2015
Posts: 54

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, 02: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, 03:03 PM   #3
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,897

Rep: Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018Reputation: 5018
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, 05:06 PM   #4
kjhambrick
Senior Member
 
Registered: Jul 2005
Location: Round Rock, TX
Distribution: Slackware64 15.0 + Multilib
Posts: 2,159

Rep: Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512
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 05:10 PM.
 
3 members found this post helpful.
Old 08-22-2017, 05:18 PM   #5
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,897

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

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
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 06:35 PM. Reason: edit: forgot to add what I do for copy/paste
 
3 members found this post helpful.
Old 08-22-2017, 09:26 PM   #7
colinh2
Member
 
Registered: Dec 2015
Posts: 54

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, 09:23 AM   #8
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,223

Rep: Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320
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, 10:40 AM   #9
Gerard Lally
Senior Member
 
Registered: Sep 2009
Location: Leinster, IE
Distribution: Slackware, NetBSD
Posts: 2,177

Rep: Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761
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, 02:10 PM   #10
caffe
LQ Newbie
 
Registered: Feb 2015
Posts: 17

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"
 
3 members found this post helpful.
  


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
vi/vim copy and paste from another editor. theKbStockpiler Linux - General 9 09-23-2011 06:20 PM
[SOLVED] Can't copy-paste from one terminal to another using vim cola Slackware 11 12-18-2009 10:51 PM
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
cygwin vim copy/paste problem takahaya Linux - Software 2 03-31-2006 01:16 AM

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

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