wincent / terminus

🖥 Enhanced terminal integration for Vim
BSD 2-Clause "Simplified" License
463 stars 25 forks source link

<Esc> doesn't leave insert mode immediately in TMUX #9

Closed jceb closed 6 years ago

jceb commented 9 years ago

I noticed that with let g:TerminusBracketedPaste = 1 in a TMUX session <Esc> doesn't leave insert mode right away. For instance <Esc>l or <Esc>h writes è to the buffer and vim stays in insert mode. Outside TMUX sessions <Esc> works as expected.

With the bracketed-paste plugin I didn't have these issues. I assume this is because the plugin doesn't map anything to <Esc>. https://github.com/ConradIrwin/vim-bracketed-paste/blob/master/plugin/bracketed-paste.vim#L31

wincent commented 9 years ago

Hm, interesting. I can't repro this. What are your settings for 'timeout', 'timeoutlen', 'ttimeout' and 'ttimeoutlen'?

jceb commented 9 years ago

Here are my settings: timeout = 1 timeoutlen = 1000 ttimeout = 1

mikedfunk commented 7 years ago

+1 I have the same problem

wincent commented 7 years ago

@mikedfunk: Any tips on how to repro?

I can certainly look at changing the implementation, but without the ability to verify that the changes actually fix the bug, I'd really be flying blind.

natemaia commented 6 years ago

This is a known issue with tmux + (n)vim, the following resolves it

tmux.conf

set -s escape-time 0                       # Faster key escapes
set -g focus-events on                     # Let focus events through

vimrc

set ttimeoutlen=0          " Timeout for escape sequences

Source Here

wincent commented 6 years ago

Ah, yes. The need for focus-events is already documented:

https://github.com/wincent/terminus/blob/fc032fd0deb76b75d1422e54281505452e244871/doc/terminus.txt#L264-L267

But we should add something about escape-time. I've had that in my dotfiles for 7 years now and had totally forgotten about adding it:

https://github.com/wincent/wincent/blob/11b0bfacf23d6dab5b2317668e22c643a5477ca7/roles/dotfiles/files/.tmux.conf#L100-L101