Reputation: 1327
In MacVim and terminal Vim, everything works fine and I have no problems. As soon as I jump into tmux and run Vim there, the escape key starts having a delay of about 1 second and shows up in Vim as ^[
.
I'll hit the escape key to exit insert mode but around a 1 second delay will happen before Vim reacts and takes me back to normal mode.
If I type Ctrl+o
to get temporarily to insert mode it immediately pops into normal mode with no delay.
If I type jj
to get to normal mode (a shortcut I set) it still takes around a second. This leads me to think that the problem may be with Vim and not tmux
I've already set set -sg escape-time 0
in my tmux.conf but it hasn't helped at all.
Any ideas?
Upvotes: 22
Views: 8903
Reputation: 2614
The issue is with a tmux escape delay. The tmux setting below should correct it:
set -s escape-time 0
Upvotes: 38
Reputation: 53614
The problem is that escape is the first character of all function keys, arrows, mouse clicks (they are sent to vim by a terminal using some escape sequence), … Hence vim waits for next character at most 'ttimeoutlen' ('timeoutlen' if 'ttimeoutlen' is -1) milliseconds in order to be sure you meant pressing escape and not, for example, <F1>
. There is no way to get rid of this delay, but you can narrow it down:
set timeout timeoutlen=1000 ttimeoutlen=100
. This way it will wait 1 second for you to finish the mapping, but only 0.1 second for terminal to finish sending the escape sequence.
Upvotes: 4