LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 04-16-2008, 05:28 PM   #1
oldfolio
LQ Newbie
 
Registered: Apr 2008
Distribution: Slackware
Posts: 13

Rep: Reputation: 0
Vim xterm_clipboard feature


The binary Vim package included in Slack was compiled with the xterm_clipboard feature disabled. Short of compiling Vim for myself, is there any way that I can move the contents of a Vim register to the X clipboard? Thanks.
 
Old 04-16-2008, 08:41 PM   #2
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,125

Rep: Reputation: 165Reputation: 165
I might not have understood what you meant, but I added the following mouse settings on my Slack 12 boxes for the mouse:
Code:
~/.vimrc
set mouse=""

~/.gvimrc
set mouse=a
 
Old 04-16-2008, 09:19 PM   #3
wadsworth
Member
 
Registered: Aug 2007
Distribution: Slackware64 13.37
Posts: 215

Rep: Reputation: 65
Holding the left-shift key and selecting text with the mouse
should copy from vim into another app.
Left-shift + middle-click should paste back into vim.

Works here in rxvt.
Or did you mean without using the mouse?
Or am I misunderstanding the question?
 
Old 04-16-2008, 09:21 PM   #4
Telemachos
Member
 
Registered: May 2007
Distribution: Debian
Posts: 754

Rep: Reputation: 59
There are probably a lot of ways to do this, but one is to install xclip. Then you can enter this while in a vim session
Code:
:w !xclip -sel clip
That would save the entire buffer to the clipboard; you can also select part of the text to clip using ranges or visual selections. This tip talks about using xclip with Vim: http://vim.wikia.com/wiki/VimTip964

Edit - I was assuming you meant without using a mouse.

Last edited by Telemachos; 04-16-2008 at 09:26 PM.
 
Old 04-16-2008, 09:32 PM   #5
urbanjost
LQ Newbie
 
Registered: Mar 2008
Posts: 1

Rep: Reputation: 0
wxpaste and wxcopy

Two handy programs for reading and writing data to X11 cut buffers and primary selections
(AKA the clipboard) that do not have the issues with buffer size and such that xprop(X11)
has are called wxcopy and wxpaste. If they are not already on your machine, at least one
place you can pick them up is

stuff.mit.edu/afs/athena/project/wm-beta/src/WindowMaker-0.70.0/util/wxcopy.c

They build simply by compiling them with the -lX11 switch (or equivalent) added to the
load options. You could pick up and build the entire WindowMaker package, but that is
probably harder than rebuilding the vim(1) program.

They are useful for more than just being used with vim(1); but work well with all vim ranges. I used
something similar for years with vi(1). For example:

TO SET MARKER a POSITION CURSOR AT BEGINNING OF REGION AND ENTER
ma
SET MARKER b AT END OF REGION OF INTEREST BY PLACING CURSOR THERE AND ENTERING
mb
THEN WRITE REGION TO STANDARD INPUT OF COMMAND wxcopy(1)
:'a'bw!wxcopy

then, in either vi(1) or vim(1) you can use map to make this easier to use. For example,
if you have a $HOME/.exrc file you could make the lower-case "g" key do the command
by adding the line

map g :a';'b!wxcopy

Although you can get short buffers OUT of the clipboard quite easily with xprop(1), I seem to
remember there was a problem with SETTING the clipboard with it; so I recommend these programs even though you have to compile them.

Of course, just remarking the region manually with the mouse in an xterm(1) works too.
 
Old 04-16-2008, 10:14 PM   #6
oldfolio
LQ Newbie
 
Registered: Apr 2008
Distribution: Slackware
Posts: 13

Original Poster
Rep: Reputation: 0
Thanks, everyone. All of your suggestions allow me to do exactly what I was wanting to do, namely, copy text from a non-gui Vim session in an xterm to other applications. I hadnít been thinking in terms of using the mouseĖsimply because I normally donít use itĖbut Iím more than happy to use it if it helps get the job done.
 
  


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
VIM Users: Do you use VIM via console or gui? JMJ_coder Linux - General 48 04-16-2008 04:12 AM
Best new F7 feature monsm Fedora 8 06-04-2007 06:47 PM
encryption with Vim (vim -x) mikshaw Linux - Software 2 03-07-2007 10:00 AM
LXer: Vim tips: Using Vim mappings and abbreviations LXer Syndicated Linux News 0 06-18-2006 02:54 PM
LXer: Cream for Vim - Making Vim more user friendly LXer Syndicated Linux News 0 06-18-2006 12:54 AM

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

All times are GMT -5. The time now is 11:39 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration