>On linux, I don't use ESC at all anymore, I just press alt + [a normal mode key], while in insert mode. Like `alt + j`, which will leave insert mode and move one line down.
Why does that work? Is it because Alt + some_key combos generate an escape sequence starting with the actual ESC character? I know that happens with many function key combos, don't remember or not sure about Alt combos.
This sounds plausible, but I have really no idea of why it works :) I found it by doing a mistype (like it often happens in vim), and didn't see it mentioned in any article that would try to get to the bottom of it yet.
>I found it by doing a mistype (like it often happens in vim)
Ha, I probably found it by some similar way, maybe in vim or maybe in DOS / Windows / Linux at the command prompt or in some curses or terminal application.
>* alt + shift + a : insert mode at the end of current line
Is that different from just Shift-a or capital A, which puts you into append mode at the end of the current line (no matter where you are on the line when you press it)?
yep, it does a 'A' in normal mode, after leaving the insert mode (thanks to alt). The different thing is that you do it (alt+shift+a) in insert mode. So the equivalent would be `ESC, A`.
Then I guess that the Alt key generates an ESC char (ASCII code 27 [1]). Seems to tie in with the fact that Emacs docs say that you can use either Alt or ESC for the Meta key -
which is used a lot in Emacs commands (IIRC - I am not an Emacs user, just had tried it out earlier and think I remember reading read that).
Some alt based sequences are really useful:
* alt + e, a : leave current parenthesis and continue inserting (eg, while typing parameters for a function)
* alt + shift + a : insert mode at the end of current line
* alt + shift + i : insert mode at the beginning of current line, with indentation
* alt + p, a : paste before current position, and continue inserting
Maybe there's a modifier key with a similar behavior on macosx?