Friday, March 3, 2023

Re: Can I copy/yank into and out of vim?

On Sat, Mar 4, 2023 at 3:32 AM Angel M Alganza <ama@ugr.es> wrote:
>
> On 2023-03-04 01:08, K otgc wrote:
> > Hello, I would like to copy/yank text from vim out to other programs
> > like
> > dpaste or Google Docs.
> > I would also like to coy/yank text from external programs like website
> > text
> > into vim.
> > I can manually highlight external program text with my mouse, copy and
> > then
> > insert into vim, but maybe there's a vim script for this?
>
> I use Shift+Insert (in insert mode in Vim) to do just that. As far as I
> can tell it works everywhere, although what's inserted in xterm and the
> rest of X programs is different. Probably Shift+Inserts uses a different
> "clipboard" for xterm and for everything else in X.

The reason for this dfference in behaviour is that xterm doesn't use
the X11 clipboard (register + in Vim) but only the X11 selection
(register * in Vim). In almost every other GUI, including gvim, you
can use Edit→Cut, Edit→Copy and Edit→Paste to pass text from one
program to another via the clipboard, but in xterm you need to have
some text selected (and, in Vim, written to "*) then the middle mouse
button pastes into xterm; conversely, IIUC anything selected in xterm
will appear in Vim's * register and can be pasted with "*p or with
<MiddleMouse>.

Best regards,
Tony.

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAJkCKXt1j4wYTX-ipwHQp_dTUK77JSZH4dSK4Cd_0fHAYuaz_w%40mail.gmail.com.

No comments: