Problem: Why can't I paste commands into vim?
I've had this problem in at least two environments I work in. It came up against just recently, so I'm taking a moment to document it. Let us say you have the following in your clipboard:
:set tabstop=4 shiftwidth=4 expandtab
So you are inside vim and you press your usual paste keystroke for your terminal e.g. SHIFT
+ INSERT
. You expect the command to appear in the vim command line area, but instead something else happens and maybe some of the clipboard content is pasted into the buffer instead?
😡🤬
Impact: frustration and lost productivity...
Everyone hates to lose their flow state because of annoying issues like this. At least from my 20+ years of experience with Linux, it's a non-standard behaviour (or perhaps a change in the old/legacy behaviour).
Solution:
It is possible that this issue only affects xterm-like terminals. I use mintty heavily in my daily workflows.
" disable bracketed-paste - which prevents pasting commands into vim
set t_BE=
It helps to understand bracketed-paste: https://en.wikipedia.org/wiki/Bracketed-paste. In addition it helps to understand the relevant bracketed-paste sections of the vim manual on bracketed-paste.
No comments:
Post a Comment