DEV Community

Serhat Teker
Serhat Teker

Posted on • Originally published at tech.serhatteker.com on

Tmux Vim Active Pane Focus

If you are a best text editor —a.k.a Vim, user, and you want to use our "active-inactive pane focus" feature that we implemented for tmux panes in this tmux active focus post for vim/nvim as well, you need to make some tweak in your vim colourscheme.

Tmux Vim Focus Active Inactive Pane

The picture above shows how the inactive panes are slightly greyed, and that the border of the active panes is blue.

Active-inactive pane colors config

In order to apply active-inactive window style to Vim panes, it is necessary to check the line in your colorscheme.vim file that starts with hi Normal. Or write:

:hi Normal
Enter fullscreen mode Exit fullscreen mode

The output should be like this:

Normal          xxx ctermfg=145 ctermbg=234 guifg=#ABB2BF guibg=#1c1c1c
Enter fullscreen mode Exit fullscreen mode

We need to update these background settings to use our .tmux.conf settings set before.

delete:

highlight Normal ctermfg=145 guifg=#ABB2BF
Enter fullscreen mode Exit fullscreen mode

or set to none:

highlight Normal ctermfg=145 ctermbg=none guifg=#ABB2BF guibg=none
Enter fullscreen mode Exit fullscreen mode

I prefer latter since it is more verbose. Add this setting to your .vimrc after colorscheme xxx line and source it.

It is very important adding after, otherwise will not give any effect.

All done.

Discussion (0)