1. JSHint errors in your Vim quickfix window

    To use JSHint as your “compiler” for Javascript files in Vim put this into ~/.vim/compilers/jshint.vim 1:

    CompilerSet errorformat=%-P[jshint]\ Error(s)\ in\ %f:,%E%m.\ (line:\ %l\\,\ character:\ %c),%C%s%>,%Z
    CompilerSet makeprg=jshint
    

    Then you can do :compiler jshint to set the compiler (although you might want to do that in an ftplugin) and :make % to run the current file through JSHint and put any errors into your Vim quickfix window.

    Update: If using node-jshint then the error format is a little simpler:

    CompilerSet errorformat=%f:\ line\ %l\\,\ col\ %c\\,\ %m
    

    1. This assumes that “jshint” is an executable in your path that runs JSHint, adjust makeprg accordingly. 

Notes

  1. layzie313 reblogged this from preciselythat
  2. preciselythat posted this