StatusLineHighlight : Change statusline color depending on buffer state.
| script karma |
Rating 17/5,
Downloaded by 377
|
Comments, bugs, improvements
|
Vim wiki
|
| created by |
| Ingo Karkat |
| |
| script type |
| utility |
| |
| description |
DESCRIPTION
This plugin indicates the state of the buffer (modified, readonly,
unmodifiable, special non-file "scratch") / window (is preview window) by
changing the highlighting of the window's status line. It defines additional
StatusLine... / StatusLine...NC highlight groups that are customizable and by
default use different colors to differentiate the buffer states.
An example screenshot can be found at
http://ingo-karkat.de/swdev/vim/StatusLineHighlight.png
HOW IT WORKS
Using different colors for the status line is trickier than it seems: Though
the 'statusline' setting supports inline expressions via %{expr}, the returned
text is taken as-is; highlight items %#hlgroup# and #* are not evaluated, only
printed as text. Evaluation does happen when one %!expr is used, but the
expression seems to be evaluated only once for a complete screen redraw cycle,
not for each individual status line, so one cannot use it to set different
highlightings for different status lines.
Therefore, this plugin sets up autocmds that continually adapt buffer-local
'statusline' settings (which prepend the highlight group to the (mostly)
global setting (though local 'statusline' settings set by ftplugins are kept,
too)).
USAGE
This plugin does not introduce any commands or mappings. Just observe the
changed status line colors, e.g. when using :view, :pedit, :help, etc.
You immediately see that a buffer is read-only because its status line is
gray, not black; unmodifiable buffers are even "more" gray. Unsaved, modified
buffers are indicated via a dark-red status line. Special windows like the
command and quickfix windows, as well as many "scratch" buffers used by
plugins are shown in dark blue. The preview window is now also easy to find,
because it has a blue status line. |
| |
| install details |
INSTALLATION
This script is packaged as a vimball. If you have the "gunzip" decompressor
in your PATH, simply edit the *.vba.gz package in Vim; otherwise, decompress
the archive first, e.g. using WinZip. Inside Vim, install by sourcing the
vimball or via the :UseVimball command.
vim StatusLineHighlight.vba.gz
:so %
To uninstall, use the :RmVimball command.
DEPENDENCIES
- Requires Vim 7.0 or higher.
CONFIGURATION
For a permanent configuration, put the following commands into your vimrc:
You may override the default highlightings and define your own colors in the
following form. As with the built-in status line highlighting, there is a
hl-StatusLine group for the current window and a hl-StatusLineNC for all
non-current windows.
highlight StatusLineModified term=bold,reverse cterm=bold,reverse ctermfg=DarkRed gui=bold,reverse guifg=DarkRed
highlight StatusLineModifiedNC term=reverse cterm=reverse ctermfg=DarkRed gui=reverse guifg=DarkRed
highlight StatusLinePreview term=bold,reverse cterm=bold,reverse ctermfg=Blue gui=bold,reverse guifg=Blue
highlight StatusLinePreviewNC term=reverse cterm=reverse ctermfg=Blue gui=reverse guifg=Blue
highlight StatusLineReadonly term=bold,reverse cterm=bold,reverse ctermfg=Grey gui=bold,reverse guifg=DarkGrey
highlight StatusLineReadonlyNC term=reverse cterm=reverse ctermfg=Grey gui=reverse guifg=DarkGrey
highlight StatusLineSpecial term=bold,reverse cterm=bold,reverse ctermfg=DarkBlue gui=bold,reverse guifg=DarkBlue
highlight StatusLineSpecialNC term=reverse cterm=reverse ctermfg=DarkBlue gui=reverse guifg=DarkBlue
highlight StatusLineUnmodifiable term=bold,reverse cterm=bold,reverse ctermfg=Grey gui=bold,reverse guifg=Grey
highlight StatusLineUnmodifiableNC term=reverse cterm=reverse ctermfg=Grey gui=reverse guifg=Grey |
| |
script versions (upload new version)
Click on the package to download.
ip used for rating: 54.234.67.55
|