Skip to content

Instantly share code, notes, and snippets.

@donchan922 donchan922/vim.txt
Created Jul 25, 2019

What would you like to do?
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.
This option is reset when starting the GUI. Thus if you set it in
your .vimrc it will work in a terminal, but not in the GUI. Setting
'paste' in the GUI has side effects: e.g., the Paste toolbar button
will no longer work in Insert mode, because it uses a mapping.
When the 'paste' option is switched on (also when it was already on):
- mapping in Insert mode and Command-line mode is disabled
- abbreviations are disabled
- 'autoindent' is reset
- 'expandtab' is reset
- 'formatoptions' is used like it is empty
- 'revins' is reset
- 'ruler' is reset
- 'showmatch' is reset
- 'smartindent' is reset
- 'smarttab' is reset
- 'softtabstop' is set to 0
- 'textwidth' is set to 0
- 'wrapmargin' is set to 0
These options keep their value, but their effect is disabled:
- 'cindent'
- 'indentexpr'
- 'lisp'
NOTE: When you start editing another file while the 'paste' option is
on, settings from the modelines or autocommands may change the
settings again, causing trouble when pasting text. You might want to
set the 'paste' option again.
When the 'paste' option is reset the mentioned options are restored to
the value before the moment 'paste' was switched from off to on.
Resetting 'paste' before ever setting it does not have any effect.
Since mapping doesn't work while 'paste' is active, you need to use
the 'pastetoggle' option to toggle the 'paste' option with some key.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.