I was reading here Other ways to exit Insert mode besides Escape and in various other places.

The problem I have is if I enter visual select mode I cannot use jj or kj to exit that mode, because kj is used to travel up and down.

Is there another way to exit that mode there without using esc?

I'm using ideavim

  • it just doesnt work, thats the problem. It doesnt escape the mode
    – Toskan
    Feb 4, 2020 at 15:10

3 Answers 3


At least in Vim, there are a few more ways to leave Visual mode. Not sure if they're available in ideavim, but you might consider giving them a try.

  • The combination Ctrl+[ is a synonym for Esc, it produces the same keycode. So if you're avoiding the Esc key because it's in an awkward position (or your keyboard doesn't have one), you might like that combination.
  • The Ctrl+C combination is the usual keystroke to cancel commands and (at least in Vim) it ends Visual mode. You can try to see if it works in ideavim as well.
  • You can also leave Visual mode by pressing one of v, V (which is Shift+v) or Ctrl+v, depending on which Visual mode you're in (character-wise, linewise or blockwise.) Pressing one of this while on another Visual mode will switch you to the Visual mode enabled by this keystroke, but if you press it while on that Visual mode already Vim will leave Visual mode. So one nice trick is to just press v, then if you're still in Visual mode, just press v again and you'll be out.
  • You can set up a mapping to generate Esc in Visual mode when pressing a different key (or combination of keys.) For example, to leave Visual mode on pressing the spacebar:

    xnoremap <Space> <Esc>

(Note that xnoremap is the command to create a mapping for Visual mode only.)

Additionally, if the issue you have is that you don't have an "Escape" key, consider using some mapping at the O.S. keyboard driver level to map another key (such as "Caps Lock") to "Escape". In the MacOS, you'll find such an option under keyboard preferences. (Search Google or other StackExchange sites and you'll find instructions on how to set that up.)

  • 1
    A simple trick is to hit v once—if you're still in visual mode, hitting it again will get you out.
    – D. Ben Knoble
    Feb 4, 2020 at 4:07
  • 1
    CTRL+[ seems to work fine in ideavim, not so much Ctrl+C but could be because that is bound to copy in idea
    – Toskan
    Feb 4, 2020 at 15:15

If you're already using kj to get from insert mode to normal mode, there's no reason you can't do the same for visual mode. It shouldn't really interfere with movements, because you won't generally move the cursor up and then immediately down again.

Your existing insert mode mapping won't work in visual mode; you'll need a specific visual mode mapping:

xnoremap kj <Esc>
  • it feels bad, because my ide starts to act a bit strange, e.g. waiting "is he gonna exit" once I then press k so I guess using a separate hotkey is probably better. Not decided which one yet
    – Toskan
    Feb 6, 2020 at 1:46

If you still want to use kj/jk instead of v but the delay as it waits to see if you're doing the full key combination is bugging you, you can also set the timeout to wait for a shorter amount of time:

set timeoutlen=100

You'd still need to set the shortcut for visual mode of course as well.

xnoremap jk <esc>
xnoremap kj <esc>

A lower timeout setting helps avoid similar awkward pauses when you're ending a word in k or j.

Of course, this still has the problem of exiting visual mode if you accidentally overshoot going up/down and try to correct it quickly.

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.