All Projects → aserebryakov → filestyle

aserebryakov / filestyle

Licence: Apache-2.0 license
filestyle is a Vim plugin that highlights unwanted whitespace and characters.

Programming Languages

Vim Script
2826 projects

Projects that are alternatives of or similar to filestyle

VimConfig
Configuration files for Vi-IMproved.
Stars: ✭ 23 (-23.33%)
Mutual labels:  vim-plugin, vim-plugins, vim-scripts
Vimux
easily interact with tmux from vim
Stars: ✭ 1,980 (+6500%)
Mutual labels:  vim-plugin, vim-plugins
swifty-vim
⌨️ A Vim plugin for Swift which provides file detection, syntax highlighting, support for compiling and running tests, and optional support for formatting and linting tools.
Stars: ✭ 18 (-40%)
Mutual labels:  vim-plugin, vim-plugins
Exit Vim
Vim plugin that exits Vim on startup
Stars: ✭ 176 (+486.67%)
Mutual labels:  vim-plugin, vim-plugins
Vimpanel
A modern side panel for Vim
Stars: ✭ 97 (+223.33%)
Mutual labels:  vim-plugin, vim-plugins
Vim Todo Lists
Vim plugin for TODO lists
Stars: ✭ 126 (+320%)
Mutual labels:  vim-plugin, vim-plugins
Vim Dadbod Completion
Database autocompletion powered by https://github.com/tpope/vim-dadbod
Stars: ✭ 163 (+443.33%)
Mutual labels:  vim-plugin, vim-plugins
Hot Reload.vim
A (Neo)vim plugin for Flutter to automatically hot reload the project every time a file is saved
Stars: ✭ 33 (+10%)
Mutual labels:  vim-plugin, vim-plugins
Vifm.vim
Vim plugin that allows use of vifm as a file picker
Stars: ✭ 197 (+556.67%)
Mutual labels:  vim-plugin, vim-plugins
Nerdtree
A tree explorer plugin for vim.
Stars: ✭ 16,380 (+54500%)
Mutual labels:  vim-plugin, vim-plugins
vim-sass-colors
sass/scss/less/css color literal and color variable highlighting (works with imports)
Stars: ✭ 24 (-20%)
Mutual labels:  vim-plugin, vim-plugins
Fzf Filemru
File MRU with fzf.vim
Stars: ✭ 76 (+153.33%)
Mutual labels:  vim-plugin, vim-plugins
Vim Systemd Syntax
Syntax highlighting for systemd service files in Vim.
Stars: ✭ 57 (+90%)
Mutual labels:  vim-plugin, vim-plugins
Ale
Check syntax in Vim asynchronously and fix files, with Language Server Protocol (LSP) support
Stars: ✭ 11,380 (+37833.33%)
Mutual labels:  vim-plugin, vim-plugins
Vim Strand
A barebones Vim plugin manger written in Rust
Stars: ✭ 38 (+26.67%)
Mutual labels:  vim-plugin, vim-plugins
Targets.vim
Vim plugin that provides additional text objects
Stars: ✭ 2,114 (+6946.67%)
Mutual labels:  vim-plugin, vim-plugins
vim-phpstan
A Vim plugin for PHPStan - https://github.com/phpstan/phpstan. It calls `phpstan` to do static analysis of your PHP code and displays the errors in Vim's quickfix list.
Stars: ✭ 26 (-13.33%)
Mutual labels:  vim-plugin, vim-plugins
Context.vim
Vim plugin that shows the context of the currently visible buffer contents
Stars: ✭ 688 (+2193.33%)
Mutual labels:  vim-plugin, vim-plugins
Vimcompletesme
You don't Complete Me; Vim Completes Me! A super simple, super minimal, super light-weight tab completion plugin for Vim.
Stars: ✭ 752 (+2406.67%)
Mutual labels:  vim-plugin, vim-plugins
Visual Split.vim
Vim plugin to control splits with visual selections or text objects
Stars: ✭ 190 (+533.33%)
Mutual labels:  vim-plugin, vim-plugins

filestyle

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

Highlights include:

  • Trailing spaces
  • Tabs or spaces depending on 'expandtab'
  • Lines longer than 'textwidth'
  • Control characters

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
  • :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
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
  • 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

Contribution

Source code and issues are hosted on GitHub:

https://github.com/aserebryakov/filestyle

License

Apache License, Version 2.0

Changelog

1.2.0

  • Added FileStyleToggle command
  • Fixed the error if default colorscheme is used

1.1.2

  • Fixed error messages when Vim is started in a narrow terminal
  • Fixed tag and version number in help file

1.1.1

  • Fixed cursor positioning after FileStyleFix call

1.1.0

  • Added support for user-defined highlight groups
  • Fixed issue with tabs switching in INSERT mode

1.0.0

  • Implemented ignored patterns
  • Removed highlighting of trailing spaces in current line when in Insert mode
  • Improved order of highlights

0.7.1

  • Fixed issue with highlighting after colorscheme change

0.7.0

  • Implemented style errors fixing (experimental)
  • Added commands to enable/disable filestyle globally
  • Fixed highlighting of the EOL
  • Fixed disabling filestyle for specific buffers

0.6.1

  • Fixed compatibility with other plugins when Vundle is used

0.6.0

  • Added option to ignore certain file types
  • Changed :FileStyleDeactivate to turn off highlighting in all windows of the current buffer
  • Added highlighting of control characters

0.5.2

  • Fixed the undefined variable filestyle_active error

0.5.1

  • Added commands to enable/disable filestyle
  • Fixed several bugs
  • Changed highlighting to use distinct colors for different violations of buffer settings

0.5.0

  • Added highlighting of trailing spaces
  • Added highlighting of incorrect indentation

Credits

  • Alexander Serebryakov, original author (GitHub)
  • Markus Weimar (GitHub)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].