Search code examples
vim

Vim-commands pasted from clipboard inserts commands instead of executing them


For quick execution of some commands I want to type them somewhere, then paste them into vim for execution. A while (some years or 10 years ago) this worked. Nowadays, vim enters insert mode and my commands get inserted into my file. I know that I can have macros for that, but for quick repetition of some commands this was very useful. Couldnt find anything about it, coz when asking for vim and paste only answers related to :set paste etc show up. Example of pasted text:

/foo
yy?bar
p/foo
j

Should, when pasted in command mode, search for the next foo, yank the line, search backwards for next bar, then paste the yanked foo-line, then go behind that foo-line. Again, to make it clear: I dont want to know about workarounds (makros, scripts, and so on), I want to know how to disable (temporarily) vim from distinguishing between text typed with keyboard and text pasted.


Solution

  • This is the result of "bracketed paste mode". See :help xterm-bracketed-paste.

    Disable "bracketed paste mode" by clearing 't_BE':

    set t_BE=