Skip to content

Instantly share code, notes, and snippets.

@sideshowcoder
Created December 18, 2012 08:56
Show Gist options
  • Save sideshowcoder/4326296 to your computer and use it in GitHub Desktop.
Save sideshowcoder/4326296 to your computer and use it in GitHub Desktop.
Run JSHint via <leader>h
" Run JSHint if there is a jshint.json present in the project
autocmd FileType javascript map <leader>h :call RunJSHint()<cr>
function! RunJSHint(...)
let to_hint_file = match(expand("%"), '\(.js\)$') != -1
let options_file = "jshint.json"
if filereadable(options_file) && to_hint_file
echo to_hint_file
:w
:silent !echo;echo;echo;echo;echo;echo;echo;echo;echo;echo
:silent !echo;echo;echo;echo;echo;echo;echo;echo;echo;echo
:silent !echo;echo;echo;echo;echo;echo;echo;echo;echo;echo
:silent !echo;echo;echo;echo;echo;echo;echo;echo;echo;echo
:silent !echo;echo;echo;echo;echo;echo;echo;echo;echo;echo
:silent !echo;echo;echo;echo;echo;echo;echo;echo;echo;echo
exec ":!jshint --config " . options_file . " " . @%
end
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment