The autocmd events FocusGained and FocusLost work when switching focus between tmux panes. However, I want to know if vim is focused when it's first opened, I'd like to not run some things if that's the case, such as displaying a message only in the focused vim session.

If you're wondering how that can happen, the tmux session manager tmux-resurrect can open several panes with vim when restoring sessions.

I am using neovim, and the tmux option set -g focus-events on


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.