Wednesday, October 23, 2024

Re: Pasting large text in vim





Igbanam


On Mon, Oct 21, 2024 at 7:24 PM Ven Tadipatri <vtadipatri@gmail.com> wrote:
Hi,
I've been struggling for years with an issue of not being able to paste large amounts of text in vim in a timely manner.  Yeah, it was kind of bad, because I'd lost all hope that there would be a vim upgrade which would support a basic paste command.
  Before anyone jumps to conclusions, I did try several options - command-shift-V, entering paste mode, tried putting some sort of weird vmap command in my vimrc that called pbcopy. But nothing worked as I just stared at my screen watching text very slowly being pasted.
 Then, I discovered something that changed my vim experience and just wanted to share that with some of you. It turns out there is a star/asterisk register, which holds the clipboard contents. So you can just press double quote - shift 8 -then p (that's "*p) , and instantly, all your worries about pasting large text in vim just go away.
  Now, there is some fine print that I should let people know. Your vim compiler needs to be built with a "+clipboard" option. And of course, finding out your vim compiler options is not common knowledge. But that's easy to check too - just run "vim --version" and pipe it to grep clipboard, and you can see have this amazing feature builtin.
  Don't take my word for it - try out the star register and just watch how these 3 characters can transform your vim copy-paste experience for large clipboard contents.

Thanks,
Ven
--
--
--

This was such a pleasant surprise when I tried it that I just wanted to jump in with a "me too" jump on the bandwagon for this hint in the hopes of generating a mini-band-wagon

effect. Well done. Thanks also for the reminder about the -version option. It seems it can be done also inside vim with :version. Thanks.

No comments:

Post a Comment