I'm working on a server, that I can only SSH into via a browser. In there, I have to edit some files.

The problem is, that let's say I go to INSERT MODE and write some text. If I then want to go back to NORMAL MODE, then I would normally just press ESC. HOWEVER! When I do so, then the browser 'catches' the ESC-press and the SSH-session will become out-of-focus, and it'll stay in INSERT MODE.

So how do I go from INSERT MODE without the escape-key?

Solution attempt 1 - -- (insert) --

If I press CTRL o - then I can insert one command, before 'coming back' to insert mode. I could write :wq and then reopen the file afterwards. But I need to inject one big change at once, to several small ones (since it would leave the server in an error state).

Solution attempt 2 - Other browser

Try a different browser, didn't make any difference.

Solution attempt 3 - :set visualmode

I didn't find this anywhere - I'm simply grasping for straws. That command doesn't exist.

Solution attempt 4 - Read this: Avoid the escape key

I read that once, but apparently too quickly. I found the answer there later.


  • The SSH-connection is to a server on AWS.
  • I'm on a Macbook Pro (Big Sur).
  • VIM-version 8.0 (2016, Sep 12)
  • Fedora-Linux system.
  • 2
    Does <C-[> work?
    – D. Ben Knoble
    Commented Jan 12, 2022 at 17:45

1 Answer 1


The solution was a mix between attempt 1 and 4.

If you're stuck in INSERT MODE without escape

This procedure maps jj to the Escape-key.

Step 1

CTRL o -> Goes to -- (insert) ---mode (where you can type a single command.

Step 2

Write: :imap jj <Esc> Found here

... This maps (in insert mode) a double-press on j to an ESC.

Step 3

Press jj


If you're stuck in VISUAL MODE or VISUAL LINE MODE without escape

This sends a bollocks-command, which won't compute and will get you back to Normal-mode.


Write: :heyhomisterdj

Vim will tell you, that you typed a non-existing command, and take you back to NORMAL MODE. Hah! Gotcha, Vim!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.