filestyle is a Vim plugin that highlights unwanted whitespace and characters.
filestyle is a Vim plugin that highlights unwanted whitespace and characters.
Highlights include:
'expandtab'
'textwidth'
filestyle also lets you fix these issues (experimental).
$ cd ~/.vim/bundle
$ git clone https://github.com/aserebryakov/filestyle.git
NeoBundle 'aserebryakov/filestyle'
Clone or download this repository and copy its contents to your ~/.vim/
directory.
When using Vim (not gVim), make sure your colorscheme explicitly defines
ctermbg
in a Normal
highlight group as it is required for the ignore
patterns feature. For example:
hi Normal ctermbg=15
filestyle automatically checks each opened file.
:FileStyleEnable
- enable plugin globally:FileStyleDisable
- disable plugin globally:FileStyleToggle
- toggle enable/disable plugin globally:FileStyleActivate
- enable plugin for current buffer:FileStyleDeactivate
- disable plugin for current buffer:FileStyleCheck
- check current buffer:FileStyleFix
- fix style errors'expandtab'
is set, highlight tabs (RED), if not, highlight spaces at
the beginning of a line (YELLOW).'textwidth'
(INVERT)'expandtab'
is set, replace tabs with spaces, if not, replace spaces
at the beginning of a line with tabsBy default, filestyle checks all file types. To ignore a file type, for
example text
, add the following line to your .vimrc
:
let g:filestyle_ignore = ['text']
filestyle allows you to specify patterns that should be ignored. To ignore
a pattern, for example quoted lines starting with >
, add the following line
to your .vimrc
:
let g:filestyle_ignore_patterns = ['^\(> \?\)\+$']
filestyle currently uses these highlight groups:
FileStyleTabsError
FileStyleTrailingSpacesError
FileStyleSpacesError
FileStyleControlCharacter
FileStyleTooLongLine
FileStyleIgnoredPattern
Note that FileStyleIgnoredPattern
is only used in gVim.
You can change a highlight group in your .vimrc
or color scheme like this:
highlight FileStyleTabsError ctermbg=3 guibg=Yellow
filestyle cannot detect 'textwidth'
changes. If you change 'textwidth'
,
execute :FileStyleCheck
to ensure the new width is used for highlighting long
lines.
Error E315 is be thrown by Vim in case of 'splitbelow'
option is set
when 'help'
command is called
Source code and issues are hosted on GitHub:
https://github.com/aserebryakov/filestyle
FileStyleToggle
command:FileStyleDeactivate
to turn off highlighting in all windows of the
current bufferundefined variable filestyle_active
error