In vim 8.0 when I try to paste a vim command from clipboard, it behaves as if vim was in insert mode: the command is pasted into the file itself instead of being executed.

I'm using mintty. Mouse is off. Same result when pasting from the terminal's context menu or using a hotkey.

  • It works for me in command mode. If you are not in command mode it paste as insert mode.
    – matzeri
    Commented Feb 20, 2017 at 16:51
  • 2
    I WAS having the same problem, though for me it started after patching my Fedora 25 system. I have been pasting VI and VIM commands for more than 30 years and find this change of behaviour very annoying... Link to my question, and the solution.... unix.stackexchange.com/questions/364047/…
    – anthony
    Commented May 11, 2017 at 0:46

3 Answers 3


Vim 8 added support for "bracketed paste" (wherein the terminal wraps pasted text in escape codes which indicate to vim that the text is a paste vs a typed string; see Patch 8.0.0210). It seems like the default behavior is to automatically enable insert mode before accepting pasted text.

You can disable bracketed paste and go back to the old behavior by adding set t_BE= to your vimrc.


I usually manually type the : to get the command prompt, then paste the command in. Vim doesn't care that a command starts with a double ::.

  • Only works for a single vim command line. I often paste 200+ vim commands in one single paste, to do major reformatting of thousands of files.
    – anthony
    Commented Aug 6, 2019 at 1:11
  • @anthony The user in the question asked for a way to "paste a command", not 200. Also, for 200 editing commands, you're better off saving them in a separate Vim script and then executing that. This would additionally give you the opportunity to review the commands, change them etc.
    – Kusalananda
    Commented Aug 6, 2019 at 6:23

I also had this problem, And a detailed solution has also been given, explaining not only how you can stop this (using set t_BE=) but also how you can stop it just for the vim 'command mode' allowing you to paste using 'paste mode' from 'insert mode'.

Link to my question and answer... Stop vim pasting selections as text!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .