Vim plugin and command line tool for running JSLint.
The source code for jshint.vim is hosted at http://github.com/hallettj/jshint.vim.
This is alpha software and is under heavy development.
In Ubuntu you can install the Spidermonkey shell with this command:
$ sudo apt-get install spidermonkey-bin
Latest Ubuntu versions don't have spidermonkey in the default repositories. You can use rhino instead:
$ sudo apt-get install rhino
Or you can find instructions for installing node.js on the node.js website.
On Windows you can use
cscript.exe- which is probably already installed.
If you have rake installed, run:
$ rake install
Otherwise copy the directory ftplugin/ into your Vim ftplugin directory. Usually this is
~/.vim/ftplugin/. On Windows it is
Finally, activate filetype plugins in your .vimrc, by adding the following line:
filetype plugin on
It also will display more information about the error in the commandline if the curser is in the same line.
You also can call it manually via
You can toggle automatic checking on or off with the command
:JSLintToggle. You can modify your
~/.vimrcfile to bind this command to a key or to turn off error checking by default.
(optional) Add any valid JSLint options to
bin/jshint executable in a terminal. For example:
$ bin/jshint ftplugin/jshint/fulljshint.js
You can copy
bin/jshint into for
PATH for easier access. The executable
requires that the Vim plugin is installed and also requires Ruby.
To disable error highlighting altogether add this line to your
let g:JSHintHighlightErrorLine = 0
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
: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.
jsl.vim uses Vim's compiler infrastructure making its use consistent with syntax checkers for other languages.
- Jesse Hallett -- original author
- Nathan Smith -- Windows compatibility, quickfix integration, better OS X compatibility, support for node.js, and other improvements
- Travis Jeffery -- Easy plugin installation with rake
- Sam Goldstein -- Display of problem report for the current line and bug fixes
- Bryan Chow -- Fixes for formatting issues and typos
- Jeff Buttars -- Options to remove and to disable error highlighting
- Rainux Luo -- Support for reading JSLint options from a
~/.jslintrcfile, Pathogen compatibility on Windows
- Pascal Hartig -- Support for running jslint with rhino and other updates
- Martin Schürrer -- Fixing path issues and error handling
- Nik Graf -- Documentation updates
- Ian McCracken -- Real-time error checking
- Luke Smith -- Enhancement of OS X support
- Szilágyi Szilveszter -- Fixes for bugs when running in Windows
- Yasuhiro Matsumoto -- Pathogen compatibility and
- Ben Loveridge -- Integrated quickfix with automatic error checking
- Brian Egan -- Documentation for enabling filetype plugins
- Trent Mick -- Feature to ignore #! lines for compatibility with shell scripts
Copyright (c) 2008-2011 Jesse Hallett firstname.lastname@example.org, except where otherwise noted
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
The Software shall be used for Good, not Evil.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.