There's No Escape!

Posted on 2025-04-23

If you’re not already at the point where all your little AI agents are churning out code for you — well, I guess it’s true if you’re extensively prompting via text too — chances are you’re spending a significant time bashing on your keyboards still?

Thought so!

This is a short post on the very niche topic of how I exit back to <NORMAL> mode in the misc vim emulations I use — which includes (neo)vim itself.

If you’re here just for the tricks, jump straight to it.

⌨ Key background information

Personally I’m not in the “fancy keyboard camp”1. I’m not sporting some split-keyboard variant, configured with some less-than-usual key layout (my layout “family” is QWERTY). I do require easy access to some weird “A”s and “O”s with circles and lines through them to fully articulate my native tongue2 — Norwegian — in writing.

The standard no layout is horrible for coding, due to how all the special characters are laid out and require modifiers, so I mostly try to find and apply the us alt-intl-unicode variant where available (which is most Linuxes, but not stock on Windows, afaik3).

What I can say is that I don’t go very overboard with my keyboard setup. I’m reluctant to build habits on top of very unconventional setups, for a couple of reasons:

  1. I’ve been fortunate enough to never experience anything resembling RSI.
  2. Until I have to worry about point number 1, I think it’s nice to stick close to how most computers are setup by default.

That said, I do find ergonomics and efficiency on the keyboard to be very important. Which is why I also do opt for having “regular” tenkeyless or mini mechanical keyboards for my desktop setups, because it’s just more comfortable. It is also why I use vim emulation in any editor I use as well as my browser.

🕹 Control yourself

If you’ve used vim emulation modes — or vim itself, obviously — for any extended amount of time, you know there’s a whole lot of <esc> action going on. The Escape key is used to switch from most modes back to <NORMAL> mode (used for general text navigation through vim motions.) On most keyboards one might say this is a bit of a stretch. It gets your fingers off the home row and generally hampers your flow.

I know there are many out there that for instance remap the CapsLock key to Escape, or even to Control (I mean, WHO’S USING CAPSLOCK, RIGHT!?) I don’t fancy that too much, as I mentioned I don’t want my setup to be too custom.

Instead, I’ve built my escape around what I think is a fairly unknown feature of terminal emulators: Hitting ^[ fires off an <esc> (that is Control+[).

But isn’t that, uhm, like pressing two keys to get an escape?

Well, yes, indeed it is.

But the big difference is, although you’re pressing two keys at once, your hand position is almost not affected by reaching for the two keys with each of your pinkies. This felt so strange to me when I started incorporating it, but now I much prefer keeping my hands still at the cost of pressing two keys at once.

If you find yourself exclusively in vim, another <esc> alternative is the classical ^c or Ctrl+c. It’s not an option for me who switch frequently between vim and emacs, as C-c (yet another notation for ^c)4 is a very common prefix for many sequential “key chords”.

In evil-mode it does work to use the traditional emacs “quit” binding of C-g to escape back into <NORMAL> mode. But — and I bet you guessed it — it does not translate well back into vim. Which is a muscle memory issue I still struggle with on a frequent basis.

🍒 Terminal escapes? There are dozens of us!

There are a bunch of these Ctrl+<key> sequences — sitting at various levels of useful — when typing on a typical terminal emulator5:

^[
Escape
^i
Tab (Rarely used it)
^m
Carriage return (nah, not for me)
^j
New line (well, it’s somewhat of an emacs thing)
^c
Interrupt current command (I bet you know this)
^d
End of file (this one too!)
^w
Delete previous word (careful doing so in your browser)
^l
Clear screen
^h
Backspace
^k
Kill/delete to the end of line (super useful)
^a
Move cursor to the start of line
^e
Move cursor to the end of line
^/
Undo
^_
Redo

Who am I kidding, I’m not going to list them all.

Like I said, some of these are mostly a curiosity and not all that useful in everyday, programming life. Others are surprisingly handy, and you should consider to get them into your typing habits.

I would suggest to have a look in the READLINE section of man 1 bash. Similarly to vim bindings, you find readline bindings in quite a number of places too, so mastering both is a useful skill to possess — even in 2025.

Footnotes


  1. Although I could definitely see myself in it.↩︎

  2. Ææ, Øø, and Åå, to be precise.↩︎

  3. There are various projects providing this on e.g. GitHub. I can’t remember exactly what I’ve tried to use before, but I’ve later opted for just switching layouts with hotkeys on Windows as opposed to installing third-party extensions to get the layout I want.↩︎

  4. I’m doing my best to avoid any kind of consistency here!↩︎

  5. Some of these should already be familiar to regular users of the terminal, like ^w to delete the previous word (I’ve closed one too many browser tabs due to this habit.)↩︎