On 2023-03-04, Tony Mechelynck wrote:
> 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>.
This has always confused me, so I've taken to using autocutsel to
copy the selection to the clipboard and vice versa whenever either
is updated. I have a script that runs these commands at startup:
autocutsel -fork
autocutsel -selection PRIMARY -fork
There's a good article on this here:
http://mutelight.org/articles/subtleties-of-the-x-clipboard.
I also use this setting in my vimrc:
set clipboard^=unnamed
so that I can copy and paste everything through the default unnamed
register.
The resulting behavior of having almost every cut or copy operation
overwriting the clipboard will drive some people crazy, but it works
well for me.
Regards,
Gary
--
--
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/20230304061324.GE10570%40phoenix.
Friday, March 3, 2023
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment