It's nice to have an auto-close plugin for brackets and quotes like coc-pairs. However, when I paste text from outside into vim insert (ctrl-C, ctrl-shift-v), the text seems to be pasted character-by-character. As a result, vim inserts extra quotes and brackets and messes up the copied texts.


Copied text:
(this is a test)

(this is a test))

This behavior gets annoying really fast, especially when trying to copy code. This is currently the only reason I'm not using an auto-close plugin.

How can I fix this behavior to make vim copy text as a whole block without making any change to such copied texts?

  • That's odd. Independently of 'paste' value, usually auto-pairing plugings jump over the next closing ) when typing it. Isn't it the case of the plugin you're using? Commented Jun 10, 2020 at 9:28

1 Answer 1


The typical way to fix this is to enable the 'paste' option before pasting external text into Vim.

Enabling 'paste' will disable options that usually mangle input, such as autoindent or expandtab, but it also disables all insert mode mappings (which is how auto-closing brackets is implemented.) So pasting external text with 'paste' enabled will prevent Vim settings and plug-ins from modifying the external pasted text.

See this question for some recommendations on how to enable paste for a single paste, so it gets disabled automatically after you're finished pasting, re-enabling the behavior that is useful while you're interactively inserting text, such as auto-closing brackets.

The linked question also has an answer that covers bracketed paste, which is a way to configure Vim and your terminal so that your terminal can indicate to Vim that a set of characters is a paste and Vim can automatically handle them the same as if the 'paste' option is enabled. (Essentially, it makes Vim "recognize" text that is coming through a Ctrl+Shift+V.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.