Powerline Escape Fix

Last week I wrote about Powerline Alternatives, and there was also a Hacker News thread about vim-airline where one of the posters had this useful tip about Powerline:

The delay in leaving insert mode used to drive me nuts in vim-powerline. I posted an issue and the author pointed me to this helpful Vim config snippet as a workaround (original link gone as the vim-powerline issue tracker has been removed, so reposting as a gist): https://gist.github.com/brendonrapp/5944296.

The issue is that Powerline causes a delay when leaving Insert mode, but this can be fixed by changing the InsertEnter timeoutlen setting to 0:

The time in milliseconds that is waited for a key code or mapped key sequence to complete. Also used for CTRL-\ CTRL-N and CTRL-\ CTRL-G when part of a command has been typed. Normally only 'timeoutlen' is used and 'ttimeoutlen' is -1. When a different timeout value for key codes is desired set 'ttimeoutlen' to a non-negative number.

The Powerline author has posted this to the project's growing documentation.

This is the source for the fix:

if ! has('gui_running')
  set ttimeoutlen=10
  augroup FastEscape
    au InsertEnter * set timeoutlen=0
    au InsertLeave * set timeoutlen=1000
  augroup END
blog comments powered by Disqus