Skip to content
This repository

JSHint fork of jslint.vim

branch: master

This branch is 0 commits ahead and 0 commits behind master

Merge pull request #28 from eventualbuddha/fix-comment-stripping

Fix reading jshintrc files with comments in them.
latest commit 08f37b2009
Sam Breed authored
Octocat-spinner-32 ftplugin Merge pull request #28 from eventualbuddha/fix-comment-stripping February 27, 2014
Octocat-spinner-32 .gitignore Initial import into git December 14, 2008
Octocat-spinner-32 LICENSE Updated copyright dates in the LICENSE. April 09, 2009
Octocat-spinner-32 Makefile dry up and copy jsrunner November 14, 2013
Octocat-spinner-32 readme.md add install notes November 25, 2013
readme.md

jshint.vim

A jshint flavor of hallettj's jslint.vim.

v0.9.0

Installation

Node.js must be in your path.

Recommended for use with tpope's Pathogen plugin runtime management system or vundle.

If you're old school or not into pathogen, there is a Makefile to copy everything into your ~/.vim directory.

Install with Vundle

Add to vimrc:

Bundle "wookiehangover/jshint.vim"

And install it:

:so ~/.vimrc
:BundleInstall

Install with pathogen

git clone https://github.com/wookiehangover/jshint.vim.git ~/.vim/bundle/jshint.vim

Usage

Automatically

This plugin automatically checks the JavaScript source and highlights the lines with errors on file writes, entering a buffer and leaving insert mode. It also will display more information about the error in the commandline if the curser is in the same line.

To disable automatic checking and only check when the file is written, use the following in your ~/.vimrc or set it at runtime: let JSHintUpdateWriteOnly=1

Manually check the file

:JSHintUpdate

Toggle automatic checking of a file

This can also be set in the ~/.vimrc file to bind this command to a key or to turn off error checking by default:

:JSHintToggle

Working with quickfix

When automatic error checking is enabled, jshint.vim will automatically display errors in the quickfix window in addition to highlighting them.

You can open and close the quickfix window with the commands :copen and :cclose. Use the command :cn to go to the next error or :cc [nr] to go to a specific error, where [nr] is a number. The first error in the list is 1, the second is 2, and so on.

Once an error is fixed the corresponding quickfix line will disappear.

Configuration

~/.vimrc Options

Disable error highlighting

let g:JSHintHighlightErrorLine = 0

JSHint options

Add any valid JSHint options to a ~/.jshintrc file. These options will be used as global options for all JavaScript files. There is an example file at Official Example

/*jshint browser: true, laxcomma, true, asi: true */
/*global deepEqual, equal, notEqual, test, ok, raises */
Something went wrong with that request. Please try again.