This is a plugin for Vim to dim inactive windows.
It provides two methods, which can be used independent:
colorcolumn
methodWith this method colorcolumn
gets set to a list containing every column for
the inactive windows, effectively resulting in a different background color
(see hl-CursorColumn
).
This is enabled by default and can be disabled, e.g. if you want to use the syntax method only:
let g:diminactive_use_colorcolumn = 0
Vim's ColorColumn highlighting group is being used for this, which is red by default, and pink if undefined):
:hi ColorColumn
ColorColumn xxx term=reverse ctermbg=1 guibg=DarkRed
You can define a custom color yourself, in case your colorscheme does not use something sensible:
:hi ColorColumn ctermbg=0 guibg=#eee8d5
syntax
methodThere is an option to disable syntax highlighting for inactive windows. It is disabled by default, and you can enable it using:
let g:diminactive_use_syntax = 1
FocusLost
and FocusGained
eventsYou can enable (un)dimming windows on Vim's FocusLost
and FocusGained
events by adding the following line to your .vimrc
(defaults to 0):
let g:diminactive_enable_focus = 1
NOTE: If you are using tmux it is recommended to install the
vim-tmux-focus-events plugin for Vim and add set -g focus-events on
to your ~/.tmux.conf
to enable better support for Vim's FocusLost
and
FocusGained
events in tmux.
The following commands are provided to control it:
DimInactive / DimInactiveOn
DimInactiveOff
DimInactiveToggle
DimInactiveSyntaxOn
DimInactiveSyntaxOff
DimInactiveColorcolumnOn
DimInactiveColorcolumnOff
Dimming can be controlled on the window level, which overrides any buffer-local configuration (a buffer can be displayed in multiple windows).
DimInactiveWindowOff
Disable for this window.
DimInactiveWindowOn
Enable for this window.
DimInactiveWindowReset
Reset config on window level.
Dimming can be controlled on the buffer level. This gets overridden by window-local configuration (a buffer can be displayed in multiple windows).
DimInactiveBufferOff
Disable for this buffer.
DimInactiveBufferOn
Enable for this buffer.
DimInactiveBufferReset
Reset config on buffer level.
You can disable the dimming based on buftype
or filetype
with the
following settings.
g:diminactive_buftype_blacklist
A list of buffer types where dimming gets disabled. Default:
let g:diminactive_buftype_blacklist = ['nofile', 'nowrite', 'acwrite', 'quickfix', 'help']
g:diminactive_filetype_blacklist
A list of filetypes where dimming gets disabled. Default:
let g:diminactive_filetype_blacklist = ['startify']
g:diminactive_buftype_whitelist
A list of buffer types where dimming gets enabled (overrides the blacklist). Default:
let g:diminactive_buftype_whitelist = []
g:diminactive_filetype_whitelist
A list of filetypes where dimming gets enabled (overrides the whitelist). Default:
let g:diminactive_filetype_whitelist = ['dirvish']
It is based on an idea from Paul Isambert, which got turned into a StackOverflow answer and then into a plugin, incorporating the suggestions made by joeytwiddle.
~
(non-lines)).cursorcolumn
and cursorline
handling".