Monday, March 6, 2023

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

""noremap <Leader>y "*y
""noremap <Leader>p "*p
"
noremap <Leader>y "+y
noremap <Leader>p "+p
noremap <Leader>P "+P


this works for me, on windows and linux both
On Monday, March 6, 2023 at 11:12:25 PM UTC+1 Rory Campbell-Lange wrote:
On 06/03/23, Rory Campbell-Lange (ro...@campbell-lange.net) wrote:
> On 04/03/23, Tony Mechelynck (antoine.m...@gmail.com) wrote:
> > On Sat, Mar 4, 2023 at 3:32 AM Angel M Alganza <a...@ugr.es> wrote:
>
> > 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>.
>
> On my urxvt console I seem to be able to copy and paste with control-alt-c and
> control-alt-p. Otherwise the middle button works pretty well for pasting
> console selected text.

Another way with pipes (on a linux terminal, at least) is

read selection from system clipboard
:r !xclip -o

write selection to system clipboard but read it back to keep it
:'<,'>! xclip -in && xclip -o

Rory

--
--
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/5c3742d7-1448-49d0-a948-8e7dad2d0909n%40googlegroups.com.

No comments: