Skip to content

Instantly share code, notes, and snippets.

@timo
Created April 5, 2011 22:35
Show Gist options
  • Save timo/904723 to your computer and use it in GitHub Desktop.
Save timo/904723 to your computer and use it in GitHub Desktop.
a part of flymake-vim (or rather: my version of it)
function! s:FlyMakeDisplay(buf, type, msg, regexp)
let source_file = expand("%")
let dic = s:FlyMakeParseDictionary(a:msg, a:regexp)
if len(keys(dic)) == 0
return 0
endif
let sorted_keys = sort(keys(dic), function('s:FlyMakeNumberSort'))
execute 'match' a:type "'\\%" . sorted_keys[0] . "l'"
call cursor(sorted_keys[0], 1)
10 new
setlocal bufhidden=wipe buftype=nofile noswapfile
file `=a:buf`
for n in reverse(sorted_keys)
for mes in reverse(dic[n])
call s:FlyMakeSendCommand(a:buf,
\ ('call append(line($), "' . source_file . ':' . n . ': '
\ . a:type . ' ' . escape(mes, '"()') . '")'))
endfor
endfor
call s:FlyMakeSendCommand(a:buf, 'call cursor(1, 1)')
cgetbuffer
call s:FlyMakeSendCommand(a:buf, 'q')
cwindow
redr
return len(keys(dic))
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment