0

If I

  1. open (vanilla) vim by running $ vim [-u NONE],
  2. switch to insert mode by pressing a,
  3. add an 'a' by pressing a again,
  4. switch back to normal mode by pressing ESC, and
  5. repeat steps 2 and 4 several times,

I see my cursor switching from on top of the 'a' (normal mode) to after the 'a' (insert mode) and back instantly as I press the corresponding keys.

If I now

  1. exit vim by typing :q! and confirming with RETURN/ENTER,
  2. start a (vannilla) screen session by running $ screen [-c /dev/null], and
  3. repeat the above excercise,

the switch from normal to insert mode after pressing a is still instantly but there is a notable delay between me pressing ESC and vim switching back to normal mode.

I observed this with Screen version 4.01.00devel (GNU) and both, VIM - Vi IMproved 7.4 and NVIM 0.2.0-dev

How can I configure [n]vim/screen to avoid this delay?

  • How do you determine whether there is a delay? Is that based on the cursor changing, on the bar at the bottom of the screen or your inability to type anything until insert mode starts? – Octaviour Feb 13 '17 at 14:42
  • @Octaviour: All three metrics show the delay. But note that it's not the inabilty to type until insert mode starts but until normal mode starts. The switch from normal to insert is fine. – mschilli Feb 13 '17 at 15:32
1

I found the solution on http://vim.wikia.com/wiki/GNU_Screen_integration:

Getting the Esc key to work


If you use Vim under Screen, you might find that the Esc key doesn't work. To fix this, add the following to your .screenrc:

> maptimeout 5

This may be necessary so Screen will wait no more than 5 milliseconds between characters when detecting an input sequence.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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