Highlight Active Window in Tmux and Neovim
With my recent upgrade to neovim. I was able to implement a really nice features that integrate with tmux. I am now able to seamlessly highlight the active split with a lighter background color.
The first thing you need to do is set up your
tmux.conf. With tmux I set the window style darker and then lighten the active window. We will also need to turn on
focus-events for later to let vim know when you have moved from a tmux pain into a vim buffer.
set -g window-style 'bg=colour235'
vim.init I have set the
InactiveWindow this dose most of the work by doing exactly what we want. However, when moving from vim into tmux it doesn’t deactivate the window. So we can use the focus events to set the background of the window on
FocusLost and then reset it again on
FocusGained. I have wrapped all of this in a
has('nvim') so I can keep the vim config working.