[wellylug] Staircase effect in vim...
Cameron Hart
sexy at cam.rebel.net.nz
Thu Feb 19 12:47:01 NZDT 2004
On Thu, 19 Feb 2004 07:17, Grant McLean wrote:
> Cameron Hart wrote:
> > But then you have to forsake lovely autoindent! :)
> >
> > Try using vim's paste mode. In vim type
> >
> > :set paste
> >
> > go into insert mode and paste your text.
> >
> > Paste mode should turn off all indenting and other features which can
> > mess up pasted text. When you have finished pasting, go out of insert
> > mode, and type
> >
> > :set nopaste
> >
> > refer to ":help paste" in vim, and ":help set" if need be.
>
> Unfortunately, the original poster was using vim via an ssh connection.
> In this case, paste is handled by putty firing the clipboard data
> across as if it had been typed. Vim would have no way to distinguish
> between pasted text and typed text. Your tip is good for gvim though.
>
> In this case I'd recommend:
> :set noai
>
> paste
>
> :set ai
>
> Cheers
> Grant
>
> Regards
> Grant
No, I disagree. My tip is good for terminal based vim, as I was using exactly
the same setup to do this, that is: SSHing from a windows box to a linux box
and copy and pasting into the Putty window.
Vim's paste mode is designed exactly for this, and not for gvim, (although it
may work there as well) because gvim should know the difference between
pasted and typed text.
From vim's ":help paste" screen :
---
Put Vim in Paste mode. This is useful if you want to cut or copy
some text from one window and paste it in Vim. This will avoid
unexpected effects.
Setting this option is useful when using Vim in a terminal, where Vim
cannot distinguish between typed text and pasted text. In the GUI, Vim
knows about pasting and will mostly do the right thing without 'paste'
being set. The same is true for a terminal where Vim handles the
mouse clicks itself.
---
More information about the wellylug
mailing list