I use some maps while I code :
imap ( ()<C-[>i
imap [ []<C-[>i
imap { {}<C-[>i
so that when I put "(" , it writes "()" (same thing for "[" and "{" ). The problem is that when i paste something into Vim :
for (i = 0; i < count; i++) {
tab[i] = something()
}
I get
for (i = 0; i < count; i++) {
tab[i] = something()
}
)]})
Is it possible to avoid the extra brackets?
You want the 'paste'
option; set it with :set paste
. It disables insert mode mappings, abbreviations, and other autoformatting options.
The other thing is that there are multiple ways to paste:
"+p
:set mouse=a
and then middle-click<C-R>+
:a!
and then use your terminal's paste commandAll of these will correctly paste. The only one that confuses vim is when you use your terminal's "paste" command without first warning it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With