When using vim's terminal mode (access by :term) if I put in two double quotes and then press the left button (such as if you were to type in git commit -m "" and then go back one character to start the message), the following happens:
D is inserted.The exact typed sequence is :term<cr>git commit -m ""<left>
Why is it that this series of events happens, and how can I prevent it in the future?
It turns out that in some terminals the arrow keys are represented with escape key sequences, such as the left arrow represented by Esc O D. In my vimrc I had the mapping tnoremap <esc> <c-w>:q!<cr> which was meant to close the terminal when I pressed the escape key. But due to how vim interpreted my arrow key sequences, it would close out the terminal when I pressed any of the arrows. I solved this by changing the mapping to tnoremap <esc><esc> <c-w>:q!<cr>.
More background can be found on this error here: https://github.com/vim/vim/issues/2216#issuecomment-337566816
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