Wednesday, November 3, 2010

Re: How to copy text from vim to clipboard in Linux

Hi,

thanks for the reply

On Wed, Nov 3, 2010 at 14:09, Tim Chase <vim@tim.thechases.com> wrote:
On 11/03/10 06:14, Alexander Dietz wrote:
I searched for doing so and got hints like using "+y after selecting the
text or using "*y, but these suggestions do not work. I even put the line
"set clipboard=unnamed" into my .vimrc without changing the behavior.

It sounds like you're on the right track if you had a build of vim built with +clipboard   You can check the output of ":ver" to see whether it was built with native clipboard support.

I think the code has been compiled without clipboard support. I see only a '-clipboard'
 

The first thing I'd check is whether you have multiple builds of vim on your machine -- some distros include a "tiny" build of vim in the default install (often linked to "vi"), in addition to the huge build of vim/gvim with all the chocolate-toppings.  If you're invoking the stripped-down version, a simple shell alias (or on Debian systems, the "update-alternatives" script) may get you the non-tiny build.

I have tried vim which gave the negative result as described above.
 

If not, the only way I know of to get any clipboard functionality is to pipe your selection through xclip, which is usually available on most X systems and be able to read the man-pages (note that piping usually happens line-wise, so character-wise and block-wise visual-selections may have to be copied to a temp buffer, or make use of Dr. Chip's vis.vim plugin).

 :'<,'>!xclip -f


xclip also does not seem to be installed on the different systems.
 
(optionally tweaking the "-selection" parameter to xclip based on which clipboard you want...selection or clipboard)


Any other idea I can try out, instead of quitting vi, doing a 'cat file', search for the place to copy, and manually copy with the mouse?



Thanks
  Alex
 

-tim




--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: