Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
  • 2 commits
  • 1 file changed
  • 0 commit comments
  • 1 contributor
Commits on May 20, 2012
@Raimondi Define autocmds inside an augroup.
Details in :help autocmd-groups.
2468915
@Raimondi Prevent error E122 when re-sourcing the script.
Add bang to the :function commands to allow re-defining the functions.
f2b0cc9
Showing with 9 additions and 6 deletions.
  1. +9 −6 plugin/javaScriptLint.vim
View
15 plugin/javaScriptLint.vim
@@ -24,12 +24,15 @@ if !exists("jslint_highlight_color")
endif
" set up auto commands
-autocmd BufWritePost,FileWritePost *.js call JavascriptLint()
-autocmd BufWinLeave * call s:MaybeClearCursorLineColor()
+augroup javaScriptLint
+ au!
+ autocmd BufWritePost,FileWritePost *.js call JavascriptLint()
+ autocmd BufWinLeave * call s:MaybeClearCursorLineColor()
+augroup END
" Runs the current file through javascript lint and
" opens a quickfix window with any warnings
-function JavascriptLint()
+function! JavascriptLint()
" run javascript lint on the current file
let current_file = shellescape(expand('%:p'))
let cmd_output = system(g:jslint_command . ' ' . g:jslint_command_options . ' ' . current_file)
@@ -71,7 +74,7 @@ function JavascriptLint()
endfunction
" sets the cursor line highlight color to the error highlight color
-function s:SetCursorLineColor()
+function! s:SetCursorLineColor()
" check for disabled cursor line
if(!exists("g:jslint_highlight_color") || strlen(g:jslint_highlight_color) == 0)
return
@@ -99,14 +102,14 @@ endfunction
" Conditionally reverts the cursor line color based on the presence
" of the quickfix window
-function s:MaybeClearCursorLineColor()
+function! s:MaybeClearCursorLineColor()
if(exists("s:qfix_buffer") && s:qfix_buffer == bufnr("%"))
call s:ClearCursorLineColor()
endif
endfunction
" Reverts the cursor line color
-function s:ClearCursorLineColor()
+function! s:ClearCursorLineColor()
" only revert if our highlight is currently enabled
if(exists("s:highlight_on") && s:highlight_on)
let s:highlight_on = 0

No commit comments for this range

Something went wrong with that request. Please try again.