LinuxQuestions.org
Register a domain and help support LQ
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 02-20-2010, 12:30 AM   #31
speck
Member
 
Registered: Nov 2001
Location: California
Distribution: Slackware 14.1
Posts: 271

Rep: Reputation: 54

On a pretty stock Slackware 12.0, the "set mouse=r" option is all I need to provide. I ran the following test from an Xterm just to make sure (but I'm using Openbox only, not KDE).

Code:
1. mv -i ~/.vimrc ~/.vimrc.bak

2. vim /tmp/tmp.txt
    Highlighting in Firefox and middle click pasting into Vim does not work
    Highlighting in Vim and middle click pasting into Firefox does not work

3. echo "set mouse=r" > ~/.vimrc

4. vim /tmp/tmp.txt
    Highlighting in Firefox and middle click pasting into Vim now works
    Highlighting in Vim and middle click pasting into Firefox now works
 
Old 02-20-2010, 04:24 AM   #32
raju.mopidevi
Senior Member
 
Registered: Jan 2009
Location: vijayawada, India
Distribution: openSUSE 11.2, Ubuntu 9.0.4
Posts: 1,155
Blog Entries: 12

Rep: Reputation: 92
I am using openSuSE, i had klipper (clip board tool) at the tray. When ever i select some text at any window and press copy ---- then it automatically copied and shown at klipper. Now i can see what are copied. Klipper has history manager. My klipper shows last 7 copied texts.
 
Old 02-20-2010, 04:12 PM   #33
T3slider
Senior Member
 
Registered: Jul 2007
Distribution: Slackware64-14.0
Posts: 2,243

Rep: Reputation: 616Reputation: 616Reputation: 616Reputation: 616Reputation: 616Reputation: 616
This is an odd and needlessly complex discussion...

Hold shift while hilighting in vim to copy to the clipboard and then middle-click in any other app. When trying to paste *into* vim, just use Shift+Insert assuming you've copied to the system clipboard (the clipboard situation is very messy by default in Linux and is one of the worst designs IMO...to rectify this in WMs that don't handle this stuff as well as klipper or whatever other tool you may use, I always just set my terminal to copy to the primary buffer. urxvt makes this easy with perl extensions). The set mouse=a/r will work as well but you don't have to change that on-the-fly and exclude yourself from VISUAL mode...just hold shift.

Of course the real reason that this thread exists is that you cannot perform proper copying/pasting in vim using *registers* because it wasn't compiled with --with-x (which is annoying). It works properly in gvim but not in console vim, and the only way to fix this (so the clipboard is accessible using the system register in vim) is by recompiling.

Why has this thread reached so many pages?

[edit] Just checked, and shift+middle click works to paste into vim as well. So just hold shift while doing any standard hilighting/middle-clicking in vim and you're golden, and you can still use visual mode. Of course this is still incredibly stupid since it should have been compiled with --with-x in the first place, but I guess they were trying not to exclude those without X on their system. [/edit]

Last edited by T3slider; 02-20-2010 at 04:15 PM.
 
1 members found this post helpful.
Old 02-20-2010, 08:35 PM   #34
grissiom
Member
 
Registered: Apr 2008
Location: China, Beijing
Distribution: Slackware
Posts: 419

Original Poster
Rep: Reputation: 45
Thanks T3slider. The Shift modifier works like a charm So I will set mouse to a instead of r from now on. I've no idea why this thread got so loong(Oh, 3 pages). Maybe Shift is broken in the past
 
Old 06-04-2010, 08:59 AM   #35
armorsmith42
LQ Newbie
 
Registered: Jun 2008
Distribution: ubuntu
Posts: 1

Rep: Reputation: 0
What I did on debian Lenny:

1) sudo apt-get install vim-full
2) insert the following into my .vimrc
"""
set clipboard=unnamed
vnoremap y "*y
vnoremap Y "*Y
nnoremap p "*p
nnoremap P "*P
"""

now to copy, I press 'v' to enter visual highlight mode,
highlight the area I want to copy,
and press 'y' to yank it into the clipboard

to paste, I press 'p' from normal/command mode.

----
What this does:
vim uses multiple registers. I'm sure there are some ninjas out there who
switch between registers, but I only use one. the '*' register is the clipboard, so the last 4 commands just specify using that whenever you try to yank or paste.
I dont know if the first line is needed and I don't care.
 
Old 06-04-2010, 09:25 AM   #36
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: Carrollton, Texas
Distribution: Slackware64 14.1
Posts: 1,439

Rep: Reputation: 407Reputation: 407Reputation: 407Reputation: 407Reputation: 407
Quote:
Originally Posted by armorsmith42 View Post
What I did on debian Lenny:

1) sudo apt-get install vim-full
2) insert the following into my .vimrc
"""
set clipboard=unnamed
vnoremap y "*y
vnoremap Y "*Y
nnoremap p "*p
nnoremap P "*P
"""

now to copy, I press 'v' to enter visual highlight mode,
highlight the area I want to copy,
and press 'y' to yank it into the clipboard

to paste, I press 'p' from normal/command mode.

----
What this does:
vim uses multiple registers. I'm sure there are some ninjas out there who
switch between registers, but I only use one. the '*' register is the clipboard, so the last 4 commands just specify using that whenever you try to yank or paste.
I dont know if the first line is needed and I don't care.
While you undoubtedly happy using Debian Lenny, this is a Slackware forum. A solution that starts off with the "apt-get" command in a Slackware forum thread won't be very relevant. Not to mention other differences between Slackware and Debian.
 
Old 07-22-2011, 09:55 AM   #37
bk322
LQ Newbie
 
Registered: Jun 2011
Posts: 1

Rep: Reputation: Disabled
Well I'm on Kubuntu I put
set clipboard=unnamed
in .vimrc - and it enables me to interact with clipboard. All copy/paste commands - like dd - all work well through the clipboard.
 
Old 09-28-2013, 03:50 AM   #38
Xeratul
Senior Member
 
Registered: Jun 2006
Location: Debian Land
Posts: 1,323

Rep: Reputation: 83
Question

Hi

how to paste from the clipboard to VIM in xterm ?
(vim and not gvim)

this does not work
Code:
Some basic clipboard commands:
"+2yy  copy two lines to X11 clipboard
"+dd  cut line to X11 clipboard
"+p  paste X11 clipboard
http://vim.wikia.com/wiki/Accessing_...stem_clipboard


It is normal since most version havent this clipboard in compiled vim.

This does not work. Is there a workaround working based on xclip -o?

thanks
 
Old 09-28-2013, 04:32 AM   #39
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,528
Blog Entries: 27

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
Could this be a case of imagining the solution rather than solving the need?

If the need is "I want to copy text from vim running in an xterm to the clipboard and vice versa", it can be done using xterm's clipboard copy and paste facilities. For copying from vim, this method is limited to a screenful at a time and line numbers have to be off, though
 
Old 09-28-2013, 06:45 AM   #40
Xeratul
Senior Member
 
Registered: Jun 2006
Location: Debian Land
Posts: 1,323

Rep: Reputation: 83
Quote:
Originally Posted by catkin View Post
Could this be a case of imagining the solution rather than solving the need?

If the need is "I want to copy text from vim running in an xterm to the clipboard and vice versa", it can be done using xterm's clipboard copy and paste facilities. For copying from vim, this method is limited to a screenful at a time and line numbers have to be off, though
Code:
Func UniversalPaster()
  ! xclip -o ~/.unimyclip
  :r ~/.unimyclip
Endfunc

map <ctrl-v> UniversalPaster
what about this for the vim into the console?
 
Old 09-29-2013, 08:34 AM   #41
Geist
LQ Newbie
 
Registered: Jul 2013
Distribution: Slackware 14 / current
Posts: 26

Rep: Reputation: Disabled
For a completely different workaround:

Install xclip (though I think Slackware comes with it or something similar, xclipboard perhaps).
Copy anything from your X application, switch to Vim. :r!xclip -o and it will read the content into the buffer.
If you want to copy from Vim, simply :w !xclip (the space between w and ! is important) and it will write the buffer into xclip, or any other program. visual selection followed by :!xclip works too but it deletes the selected text.
 
Old 09-29-2013, 10:11 AM   #42
Xeratul
Senior Member
 
Registered: Jun 2006
Location: Debian Land
Posts: 1,323

Rep: Reputation: 83
Quote:
Originally Posted by Geist View Post
For a completely different workaround:

Install xclip (though I think Slackware comes with it or something similar, xclipboard perhaps).
Copy anything from your X application, switch to Vim. :r!xclip -o and it will read the content into the buffer.
If you want to copy from Vim, simply :w !xclip (the space between w and ! is important) and it will write the buffer into xclip, or any other program. visual selection followed by :!xclip works too but it deletes the selected text.
Many thanks !!

this is alsmost working
Code:
function Xclipcopy()
  :w /tmp/clip.txt
  silent execute '!  cat /tmp/clip.txt | xclip -i  '
endfunction

" COPY To X11 CLipboard
" vmap <F5> :!xclip -f -sel clip<CR> <----- not working!!!!
" may work too? map <F7> :-1r !xclip -o -sel clip<CR> <--- not  working
vmap <F5> :call Xclipcopy()<cr>


" below this is very well working
" Paste From X11 CLipboard
" map <F6> :w !xclip<CR><CR>
" vmap <F6> "*y <-- not working
map <F6> :r!xclip -o<CR>
vmap <F6> :r!xclip -o<CR>


" hey, note, here we talk about vim (not gvim)

Code:
 screen --version####################
Screen version 4.00.03jw4 (FAU) 2-May-06

only COPY with F5 is not working !!


xclip -i shall do it

cat /tmp/file | xclip -i shall make it but how...



###
:!xclip NOT working
The text is selected with v in visual
this is brillantly not working since it tries to save to file.
Code:
~$ vim /tmp/tetimedia:~[No write since last change]

Last edited by Xeratul; 09-29-2013 at 10:29 AM.
 
Old 09-29-2013, 01:38 PM   #43
Stephen Morgan
Member
 
Registered: Feb 2011
Location: England
Distribution: Slackware
Posts: 147

Rep: Reputation: 15
It works for me. I highlight using visual mode, then (still in visual mode) hit
Code:
:w !xclip
Then `xclip -o` prints what i highlighted.

Mind you, it shows up in the middle-click clipboard.

EDIT: Try
Code:
:w !xclip -selection clip -i
That puts it in the right clipboard to show with ^V, rather than middle-click.

Last edited by Stephen Morgan; 09-29-2013 at 01:41 PM.
 
Old 09-30-2013, 02:23 AM   #44
Xeratul
Senior Member
 
Registered: Jun 2006
Location: Debian Land
Posts: 1,323

Rep: Reputation: 83
Quote:
Originally Posted by Stephen Morgan View Post
It works for me. I highlight using visual mode, then (still in visual mode) hit
Code:
:w !xclip
Then `xclip -o` prints what i highlighted.

Mind you, it shows up in the middle-click clipboard.

EDIT: Try
Code:
:w !xclip -selection clip -i
That puts it in the right clipboard to show with ^V, rather than middle-click.
I would desire the real clipboard (x11) not the middle moues click.

I will try :

Code:
:w !xclip -selection clip -i
.

to be continued



Code:
:w !xclip -selection clip -i

Press ENTER or type command to continue:w !xclip -selection clip -i

Press ENTER or type command to continue
it seems to work, but it is not silent copy

Code:
dasafds
dasfdsf

dasf
dasf

dsf
 
  


Reply

Tags
vim


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
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


All times are GMT -5. The time now is 04:37 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration