Monday, May 23, 2016

Re: Vim is too clever for me

On Mon, May 23, 2016, Mikołaj Machowski wrote:
> Dnia Poniedziałek, 23 Maja 2016 10:44 Michał Urban <motivaproductions@gmail.com> napisał(a)
> > Hi,
> >
> > If I write quotation mark " and then press "o" (new line) then I've got the same quotation mark on the new line. How to disable it? The same behavior I noticed when pasting text from clipboard.
> >
>
> :help formatoptions
> :help fo-table

Also, when pasting text into Vim in a terminal, it's best not to just
use the terminal's paste capability because, as you saw, sometimes Vim
tries to do clever things with the pasted text. Besides continuation of
comment characters, it can try to keep existing indentation, and
probably some other things I can't think of, which in my experience is
often unwanted when I'm pasting. So, if you're using a version of
terminal Vim with GUI integration (e.g. vim-gnome under X11, MacVim
under OS X; I think it's just sort of standard in Windows Vim), learn
the use of the clipboard register "+. You can paste using "+gP.

Another way to do it, which works even if your Vim has no GUI
integration, is to use the pastetoggle functionality. You set up a
certain key to put Vim into paste mode, which makes it ignore most of
its clever insert-mode behaviors (and input mode key mappings too).
Press that key once, paste, and then press it again. It works in insert
or normal mode. Since insert-mode mappings are disabled in paste mode,
it's best to set the toggle key using :set pastetoggle instead of :imap.

See:
:h "+
:h 'paste'
:h 'pastetoggle'

--
Eric Christopherson

--
--
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/d/optout.

No comments: