Re: Pasting large text in vim

Tim Chase <[email protected]>
Newsgroups gmane.editors.vim
Message-ID <[email protected]>
On 2024-12-26 08:39, Enan Ajmain wrote:
> Ven Tadipatri wrote:
> >   Now, there is some fine print that I should let people know. Your vim
> > compiler needs to be built with a "+clipboard" option.
> 
> This is the sore point. For people who use Vim over ssh, this is not an
> option (ssh -X is crappy at least in my experience).  OSC52 is a godsend
> for this, but it only works for copying not pasting (for security
> reasons).  I've been dealing with it with ':set paste!' & <C-S-v>, but
> as you said, for large text that's problematic.
> 
> So what I tend to do is: I send the clipboard content to a temp file
> over ssh and then use remote Vim's local register to copy from that temp
> file.

While kinda hackish, I tend to

  :r !cat

then paste the contents into the terminal/ssh window (doesn't get
impacted by auto-indent) and then control+d to send the EOF when done.

>   xclip -o | ssh [email protected] 'cat > tmp.txt' # from local shell
>   # then copy content from tmp.txt to real-file.txt with Vim

It has the benefit that I don't need to clean up the temp-file when
done.  Also, it works in vi/nvi on my BSD boxes that don't have vim, and
even works in ed(1) when I'm using that (though I do have to beware if
the pasted text has any lines consisting of only a period)

-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

--- 
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 [email protected].
To view this discussion visit https://groups.google.com/d/msgid/vim_use/Z21hfqDsrJo4GTlz%40thechases.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.