Skip to content

sweh/vim-jslint

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

vim-jslint

vim-jslint is a Vim plugin that runs the currently open file through JSLint, a static syntax and style checker for JavaScript source code.

This is mainly inspired by the great vim-flake8 plugin, that runs the currently open file through Flake8

Installation

Install JSLint via npm:

npm install jslint -g

Use vundle if you're not using it already. Then, simply put

Bundle 'sweh/vim-jslint'

into your ~/.vimrc and run:

:so ~/.vimrc
:BundleInstall

Usage

  1. Open a JavaScript file
  2. Press <F7> to run jslint on it

It shows the errors inside a quickfix window, which will allow your to quickly jump to the error locations by simply pressing [Enter].

Customization

If you don't want to use the <F7> key for jslint-checking, simply remap it to another key. It autodetects whether it has been remapped and won't register the <F7> key if so. For example, to remap it to <F3> instead, use:

autocmd FileType javascipt map <buffer> <F3> :call JSLint()<CR>

To customize the location of your jslint binary, set g:jslint_cmd:

let g:jslint_cmd="/opt/strangebin/jslint000"

Tips

A tip might be to run the JSLint check every time you write a JavaScript file, to enable this, add the following line to your .vimrc file (thanks Godefroid!):

autocmd BufWritePost *.js call JSLint()

History

1.0: Initial version.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published