validator.vim

by maralla

maralla / validator.vim

Check syntax on the fly asynchronously.

212 Stars 14 Forks Last release: Not found MIT License 164 Commits 0 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

Validator

Build Status

Syntax check framework for vim which checks syntax on the fly asynchronously.

Requirements

You should have a relatively new version of vim which supports such features:

job
,
timers
and
lambda
.

Your vim should be compiled with

python
or
python3
.

Validator relies on external syntax checkers, so you need to install the checkers fit for the files you are editting.

Builtin Checkers

  • c/c++,
    clang-tidy
  • python,
    flake8
  • cython,
    cython
  • css,
    csslint
  • javascript,
    jshint
    ,
    eslint
    ,
    jscs
  • ruby,
    mri
    ,
    rubocop
  • json,
    jsonlint
  • lua,
    luac
    ,
    luacheck
  • sh,
    sh
    ,
    shellcheck
  • rst,
    rst2pseudoxml
  • vim,
    vint
    ,
    vimlparser
  • go,
    gofmt
    ,
    golint
    ,
    gometalinter
  • rust,
    cargo check
    (not instant)

Configuration

Select checkers for a file type:

let g:validator_{filetype}_checkers = ['']

" for example, choose eslint to check javascript: let g:validator_javascript_checkers = ['eslint']

To customize error message:

let g:validator_error_msg_format = "[ ● %d/%d issues ]"

To auto open quickfix window:

let g:validator_auto_open_quickfix = 1

To handle file type alias:

let g:validator_filetype_map = {'': ''}

" for example let g:validator_filetype_map = {"python.django": "python"}

Ignore file types:

let g:validator_ignore = ['']

To customize the signs colors, you can use the following groups:

" For syntax errors & warnings
ValidatorErrorSign
ValidatorWarningSign

" For style errors & warnings " (By default, use the same colors as the 2 groups above) ValidatorStyleErrorSign ValidatorStyleWarningSign

To show permanently the sign column and prevent annonying behavior when the sign column appear and then it disappears.

sign

let g:validator_permament_sign = 1

To specify the checker executable path or pass checker arguments manually:

" If not specified `` is `_`.
let g:validator__args = ''
" If not specified `` is `_`.
let g:validator__binary = '/path/to/executable'

" For c/c++ let g:validator_clang_tidy_binary = '/path/to/executable'

" For flake8 let g:validator_python_flake8_args = '--max-line-length=120' let g:validator_python_flake8_binary = '/Users/maralla/.dotfiles/virtualenvs/py27/bin/flake8'

" For rubocop let g:validator_ruby_rubocop_args = '-f s -c .rubocop.yml' let g:validator_ruby_rubocop_binary = '/Users/maralla/.rvm/gems/ruby-2.3.0/bin/rubocop'

Install

$ pack install maralla/validator.vim
Plug 'maralla/validator.vim'

Usage

Validator.vim automatically checks syntax in the background when file content changes, so no need to do any trigger manually. If you do want to do a check manually use this command

ValidatorCheck
. This command is especially useful when you set the file type manually.

Debugging

Enable the debugging with:

let g:validator_debug = 1

The output is logged in plugin installation directory:

e.g.

/path/to/validator.vim/pythonx/validator.log

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.