Wednesday, November 3, 2010

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

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.

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.

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

(optionally tweaking the "-selection" parameter to xclip based on
which clipboard you want...selection or clipboard)

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