4 ms·
FTA: “Plus, there’s some ergonomic benefits to not having to strain one’s hand over to reach the ESC key.” Honest question: Is it that uncommon knowledge that
by easygenes 4y ago
FTA: “Plus, there’s some ergonomic benefits to not having to strain one’s hand over to reach the ESC key.”
Honest question: Is it that uncommon knowledge that Ctrl+[ is equivalent to ESC in vim default keybinds?
- bornfreddy 4y agoThis person here didn't know. Thank you, need to try it out.
- keybored 4y agoThere is no reason to assume that people don’t know of it simply because they don’t use it. For me: annoying to use a modifier for a common key + doesn’t work on my keyboard.
- Jedd 4y agoYup, this is what I've been using since I started with vi[m] (~30 years ago). It's pure muscle memory after the first week or two, is obviously faster than fumbling around for ESC (which may move slightly between keyboards). It works on every terminal, also on every keyboard, doesn't require customisation of your vim environment (compare to remapping CAPSLOCK) which is highly preferable if you're moving between ephemeral hosts and/or hosts you don't own or can't conveniently customise.
- gorgoiler 4y agoIt’s equivalent in any terminal, not just in vim. ASCII “control” characters are paired up nicely with the letters and punctuation on a keyboard. Instead of having a key for each letter and another key for each control code, the control code can instead be typed by holding the control key and pressing the equivalent letter. This is why it is called the control key. The pairings are offset by 0100 in octal. The octal ordinal for escape is 033. 0133 maps to [ so ^[ (control-open-square-bracket) is equivalent to escape. Some other common ones are: line feed/^J, backspace/^H, tab/^I, and end-of-transmission/^D. If you ever type “exit<enter>” to end a shell session you can do the same with ^D. Similarly of course you don’t have keys for upper and lower case letters. You use the shift key for that, which shifts the code by 040 instead of 0100. Technically it’s down by 040 because while most keys are labelled in capitals their default behaviour is to send the lower case letter.
- vram22 4y ago>Some other common ones are: line feed/^J, backspace/^H, tab/^I, and end-of-transmission/^D. If you ever type “exit<enter>” to end a shell session you can do the same with ^D. Yes. Also line feed/^J, form feed/^L, carriage return/^M. And, related: anyone not knowing the basics of vi, can check out my vi quickstart tutorial below. I had first written it at the request of two Windows sysadmin friends of mine, in a company where I was working at the time. They had been given additional charge of two Unix boxes and I wrote the tutorial to enable them to hit the ground running with common sysadmin editing tasks. After reading it and using Unix for a few days, they told me that it was useful and met their need. The tutorial is small, so it can be read soon and you can start applying it right away: https://vasudevram.gumroad.com/l/vi_quick?layout=profile https://vasudevram.gumroad.com/l/vi_quick?layout=profile