Code Monkey home page Code Monkey logo

jshint2.vim's Introduction

jshint2.vim

Lightweight, customizable and functional Vim plugin for JSHint integration.

jshint2.vim

Features

  • Linting whole file or selected lines without saving to disk.
  • Using project-specific (locally installed) version of JSHint and JSHint configuration files if available.
  • Setting lint flags from command line with autocompletion.
  • Optionally opening list of linting errors with useful shortcuts.
  • Optionally validating files after reading or saving.
  • Working on Linux, Windows (with JSHint 2.1.5 and newer) and OS X.

Installation

  1. Install Node.js and JSHint.
  2. Clone plugin into your ~/.vim/bundle/jshint2.vim/.
  3. Install Pathogen or just add set runtimepath+=~/.vim/bundle/jshint2.vim/ into your .vimrc.
  4. Optionally place .jshintrc into your home and/or project directory.
  5. ???
  6. PROFIT!

Usage

Use :JSHint command inside Vim to lint whole file or :'<,'>JSHint to lint only selected lines.
Add ! to suppress opening error list (number of lint errors still will be shown), add space and use tab key to complete space separated lint flags — :JSHint! white:true eqeqeq:true. Use - to ignore errors by their codes — :JSHint -E001 -W002 -I003.

Error List Shortcuts

t — open error in new tab.
T — open error in new tab with error list.
v — open error in new vertical split.
V — open error in new vertical split with error list.
s — open error in new horizontal split.
S — open error in new horizontal split with error list.
i — ignore selected error.
n — scroll to selected error.
q — close error list.

Configuration

Set global JSHint command path (mostly for Windows):

let jshint2_command = '~/path/to/node_mobules/.bin/jshint'

Lint JavaScript files after reading it:

let jshint2_read = 1

Lint JavaScript files after saving it:

let jshint2_save = 1

Do not automatically close orphaned error lists:

let jshint2_close = 0

Skip lint confirmation for non JavaScript files:

let jshint2_confirm = 0

Do not use colored messages:

let jshint2_color = 0

Hide error codes in error list (if you don't use error ignoring or error codes confuses you):

let jshint2_error = 0

Set min and max height of error list:

let jshint2_min_height = 3
let jshint2_max_height = 12

Tips

Quick lint mapping:

" jshint validation
nnoremap <silent><F1> :JSHint<CR>
inoremap <silent><F1> <C-O>:JSHint<CR>
vnoremap <silent><F1> :JSHint<CR>

" show next jshint error
nnoremap <silent><F2> :lnext<CR>
inoremap <silent><F2> <C-O>:lnext<CR>
vnoremap <silent><F2> :lnext<CR>

" show previous jshint error
nnoremap <silent><F3> :lprevious<CR>
inoremap <silent><F3> <C-O>:lprevious<CR>
vnoremap <silent><F3> :lprevious<CR>

Author & License

Written by Nikolay S. Frantsev under GNU GPL 3 License.

jshint2.vim's People

Contributors

gurdiga avatar nikolayfrantsev avatar staeff avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.