5 ms·
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 on
by oelmekki 9y ago
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.
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?
- vram22 9y ago>* 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)?
- oelmekki 9y agoyep, 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`.
- vram22 9y agoThen 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). https://en.wikipedia.org/wiki/Esc_key https://en.wikipedia.org/wiki/Esc_key
- oelmekki 9y agoI see. thanks for sharing!
- vram22 9y ago>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.
- oelmekki 9y agoThis 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.
- vram22 9y ago>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.