Tuesday, January 14, 2014

Re: Copying and pasting text to Vim [Was: Do developers use vim exclusively or alternate with an IDE?]

On 2014-01-14, shawn wilson wrote:
> On Tue, Jan 14, 2014 at 3:11 AM, Erik Christiansen wrote:
> > On 14.01.14 11:36, Sam Bituser wrote:
> >> Copying and pasting text from outside of the editor. E.g. modifying an HTML
> >> page by swapping odd bits of text from another document. It just feels
> >> clunky to me and I often find myself using eclipse instead.
> >
> > For me, Vim works just like any other application, as far as pasting
> > goes. If the other app is a GUI, then with the mouse:
> >
> > a) Highlight the text to be copied - one word or a thousand.
> > b) Move cursor over the Vim window and whack the middle mouse button.
> >
> > Vim just stays in insert mode, so alternation between typing and pasting
> > is seamless. Going back to edit the imported cruft costs one Esc, as
> > always. I'm having trouble seeing any clunkiness there, other than
> > having to reach for the mouse. ;-)
> >
> > OK, I tend to leave autoindent on, and so have to set "paste" in Vim
> > beforehand, to avoid staircase text while pasting, and then set nopaste
> > afterwards. To minimise keystrokes, I have in .vimrc:
> >
> > set pastetoggle=<F12>
>
> Though, if you use the native xclipboard (and have the feature - I
> think it's called 'clipboard') then you can just do "+p and not have
> to worry about toggling anything or 'staircase' issues.

You don't even need to use "+p. Since your hand is already on the
mouse, just press the middle button and the text will be pasted,
without stair-stepping. It works in either normal or insert mode.

It works well with vim in an xterm, which is what I use mostly.
With insert mode in gvim it's a little flaky: insertion is done at
the start of the current line instead of at the cursor location.

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.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment