josean-dev / dev-environment-files

2.64k stars 740 forks source link

Insert to Normal mode escape delay in tmux #17

Closed EdAllonby closed 1 year ago

EdAllonby commented 1 year ago

Hi Josean, thanks for the great video series and repository. Using your setup, exploring nvim and tmux in more detail, and getting used the the keymaps is a fun experience :)

I noticed that when I'm in a tmux session, open up a file in neovim (nvim .tmux.conf for example), and then enter insert mode: When I hit the <esc> key to exit from insert mode into normal mode there's a perceivable delay before it switches from insert->normal mode - maybe 500ms to a second? This only seems to happen when I use nvim within a tmux session. Outside of tmux the mode switch is instantaneous.

A bit of searching around showed the following 'official' solution by adding the line set -sg escape-time 10 to the .tmux.conf. This did seem to fix the <esc> insert->normal delay in my case. However, because this is my first experience with tmux, I might just be hiding an issue rather than fixing it with this tweak - https://github.com/neovim/neovim/wiki/FAQ#esc-in-tmux-or-gnu-screen-is-delayed.

A few questions, I suppose:

Cheers! Ed

josean-dev commented 1 year ago

Hi Ed!

Thanks for pointing this out. I had not realized this was the case, but testing it out now, it is happening to me as well. I hadn't realized because 9 times out of 10 I use "jk" to exit insert mode and barely use the ESC key. The fix seems suitable to me. I'll add it to the repo.

EdAllonby commented 1 year ago

Ahh yes, now I remember the jk remap in your video. Thanks for the quick response, great!