Wednesday, August 13, 2014

vim - Shift key has unexpected behavior in the terminal

I'm running macOS Mojave, and I'm getting strange behavior from my Shift key.


After I've typed in any text in the terminal, if I press and release the Shift key, it will add ;2D;10D to the end of that string. For example, if I type hello and immediately press and release Shift after, it will become hello;2D;10D, and it will add that additional string as many times as I press and release Shift, e.g. pressing Shift twice at the end of hello would create hello;2D;10D;2D;10D, etc. If I have not typed in any text yet and press and release Shift nothing happens.


When I am in Vim Insert Mode, or in colon command mode, if I have typed anything, pressing and releasing the Shift key moves my cursor to right after the first character of that recently created string of characters. For example, I press i to enter Insert Mode. | represents my cursor. If I type in hello and press and release Shift immediately after, my cursor ends up here h|ello. I noticed that in Normal Mode, when I press and release Shift, the bottom right corner that displays your key press combinations quickly flashes ~@#.


To debug, I have removed all my plugins and commented out my .vimrc file, and I am still getting the same behavior. This behavior occurs in any terminal emulator I've used (the standard Mac terminal, iTerm2, VSCode command line, etc.) I don't get this behavior outside of the command line, e.g. when I use Microsoft Word, or even typing this now, pressing and releasing the Shift key has no effect. Any feedback on why this may be occurring would help!

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...