How to paste commands into vim command mode?

It used to be possible to leave vim in command mode (rather than insert mode) and then paste some copied characters into the vim window to make it execute the characters as a sequence of commands. So you could copy n0dt@ and when you pasted it in, it would search for the next item you last searched for (n), go to the beginning of that line (0), and delete everything up to the first @ character in that line (dt@). Then you could paste it again and it would do it again on the next item, etc.

Now when I paste into the vim window, it somehow detects that I'm pasting rather than typing, and it "helpfully" switches into insert mode and just inserts the literal characters n0dt@, which isn't what I want. Is this a recent change to vim (like within the last couple of years)? Is there a way to turn off this automatic switch to insert mode on paste? (In case it's relevant, I'm running vim in Cygwin, pasting into a mintty window with a right-click.)

12

1 Answer

Turns out it's called bracketed paste. To revert to the old behavior, use

:set t_BE=

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like