Hacker News new | past | comments | ask | show | jobs | submit login

What do you use to get out of insert mode? Like, you've just finished typing some text and want to save and quit, what do you press?

EDIT: Thanks for the replies, other people. I personally use ^C, I was curious what 'mozumder specifically used. :)




The usual answer is 'C-[' or 'kj' (having added the appropriate line to your .vimrc).


Which is fine if you do everything locally (because you control that configuration), but not having escape really sucks when you are on servers a lot and you can't necessarily go changing vim settings around.


It's also difficult when using programs that emulate Vim's keybindings, because they tend to only use ESC by default.


C-[ is available by default; it's the actual control sequence sent by escape in many terminals.


CTRL-[ (of course if you're not using a QWERTY keyboard, it may be hard to hit)


I don't know why that would be anyone's preference given that if you used telnet to connect to a remote shell, ^] is the default escape character. So using ^[ to exit input mode is dangerously close to popping you out of your telnet session. Someone who claims to have used vi for 25+ years (get off my lawn, ssh didn't exist back then) would have likely used telnet and been bitten by that more than once.


I didn't switch to Ctrl-[ until sufficiently recently that anything I'm running vi-ish things on is over ssh.

I will, however, never forgive Excel for Esc being "abandon edit".


I have `jk` mapped to that in my vimrc. It's far nicer than ESC.


I love jk, been using that one for at least 8 years. I even got in the habit of tapping it a few times while thinking, sort of like how you might sometimes shake your leg or whatever. I trained myself off of that though when I had to use Eclipse more and more -- edits or undoes to a file can bring Eclipse to its knees....


I have 'jj' mapped to ESC.


Ah, I see. I didn't even consider that a function command.

I was expecting more commands to use the ESC key?


Yeah, I'm not sure I'd even call it a command - but it is pretty fundamental to vi usage, unless you're using some alternative like ^C or the "remap typing 'jk' to Esc" trick. When you're saying you've never used the Esc key, you mean you only use the Esc key to take you out of insert mode, I guess?


Yes. I do use ESC that to exit insert mode. Sorry for any confusion.

I was expecting commands to be anything you did after the typing in colon.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: