Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Highlight syntax errors to make them stand out

  • Loading branch information...
commit 9e42b06b5db276d04689da751d88f001f69688b4 1 parent 79a5476
Peter Odding authored June 14, 2011
15  autoload/xolox/lua.vim
@@ -79,6 +79,7 @@ function! xolox#lua#checksyntax() " {{{1
79 79
         execute 'silent make! -p' shellescape(expand('%'))
80 80
         cwindow
81 81
         execute winnr . 'wincmd w'
  82
+        call s:highlighterrors()
82 83
       finally
83 84
         let &makeprg = mp_save
84 85
         let &errorformat = efm_save
@@ -87,6 +88,20 @@ function! xolox#lua#checksyntax() " {{{1
87 88
   endif
88 89
 endfunction
89 90
 
  91
+function! s:highlighterrors()
  92
+  let hlgroup = 'luaCompilerError'
  93
+  if !hlexists(hlgroup)
  94
+    execute 'highlight def link' hlgroup 'Error'
  95
+  else
  96
+    call clearmatches()
  97
+  endif
  98
+  let pattern = '^\%%%il.*\n\?'
  99
+  for entry in getqflist()
  100
+    call matchadd(hlgroup, '\%' . min([entry.lnum, line('$')]) . 'l')
  101
+    call xolox#misc#msg#warn("%s: Syntax error on line %i: %s", s:script, entry.lnum, entry.text)
  102
+  endfor
  103
+endfunction
  104
+
90 105
 function! xolox#lua#help() " {{{1
91 106
   " Get the expression under the cursor.
92 107
   let cword = ''
2  ftplugin/lua.vim
@@ -3,7 +3,7 @@
3 3
 " Author: Peter Odding <peter@peterodding.com>
4 4
 " Last Change: June 14, 2011
5 5
 " URL: http://peterodding.com/code/vim/lua-ftplugin
6  
-" Version: 0.6.4
  6
+" Version: 0.6.5
7 7
 
8 8
 " Support for automatic update using the GLVS plug-in.
9 9
 " GetLatestVimScripts: 3625 1 :AutoInstall: lua.zip

0 notes on commit 9e42b06

Please sign in to comment.
Something went wrong with that request. Please try again.