Home

Awesome

filestyle

filestyle is a Vim plugin that highlights unwanted whitespace and characters.

Highlights include:

filestyle also lets you fix these issues (experimental).

Examples

Example 1

Example 2

Example 3

Installation

Step 1: Install filestyle

Pathogen
$ cd ~/.vim/bundle
$ git clone https://github.com/aserebryakov/filestyle.git
NeoBundle
NeoBundle 'aserebryakov/filestyle'
Without plugin manager

Clone or download this repository and copy its contents to your ~/.vim/ directory.

Step 2: Check your colorscheme (Vim only)

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

Usage

filestyle automatically checks each opened file.

Commands
Highlighting rules
  1. If 'expandtab' is set, highlight tabs (RED), if not, highlight spaces at the beginning of a line (YELLOW).
  2. Highlight trailing spaces (CYAN)
  3. Highlight line parts that exceed 'textwidth' (INVERT)
  4. Highlight control characters (BLUE)
FileStyleFix rules
  1. Remove control characters
  2. Remove trailing spaces
  3. If 'expandtab' is set, replace tabs with spaces, if not, replace spaces at the beginning of a line with tabs
Ignore file types

By 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']
Ignore patterns

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 = ['^\(> \?\)\+$']
Change highlight groups

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
Known issues

Contribution

Source code and issues are hosted on GitHub:

https://github.com/aserebryakov/filestyle

License

Apache License, Version 2.0

Changelog

1.2.0

1.1.2

1.1.1

1.1.0

1.0.0

0.7.1

0.7.0

0.6.1

0.6.0

0.5.2

0.5.1

0.5.0

Credits