" Vimball Archiver by Charles E. Campbell, Jr., Ph.D. UseVimball finish autoload/phpErrorMarker.vim [[[1 147 "============================================================================= " Author: Frédéric Hardy - http://blog.mageekbox.net " Date: Mar 18 déc 2012 16:04:19 CET " Licence: GPL version 2.0 license "============================================================================= let s:id = 666 if !exists('g:phpErrorMarker#autowrite') let g:phpErrorMarker#autowrite = 0 endif if !exists('g:phpErrorMarker#openQuickfix') let g:phpErrorMarker#openQuickfix = 1 endif if !exists('g:phpErrorMarker#automake') let g:phpErrorMarker#automake = 0 endif if !exists('g:phpErrorMarker#php') let g:phpErrorMarker#php = 'php' endif if !exists('g:phpErrorMarker#errorformat') let g:phpErrorMarker#errorformat = '%m\ in\ %f\ on\ line\ %l' endif if !exists('g:phpErrorMarker#textError') let g:phpErrorMarker#textError = '!!' endif if !exists('g:phpErrorMarker#textWarning') let phpErrorMarker#textWarning = '!' endif highlight default phpErrorMarkerWarning guifg=LightRed ctermfg=lightRed term=underline cterm=underline gui=underline highlight default phpErrorMarkerError guifg=Red ctermfg=Red term=underline cterm=underline gui=underline if has('signs') execute 'sign define phpErrorMarkerError text=' . g:phpErrorMarker#textError . ' linehl=phpErrorMarkerError texthl=phpErrorMarkerError' execute 'sign define phpErrorMarkerWarning text=' . g:phpErrorMarker#textWarning . ' linehl=phpErrorMarkerWarning texthl=phpErrorMarkerWarning' endif "automake {{{1 function phpErrorMarker#automake() if g:phpErrorMarker#automake execute 'normal m`' silent! make if b:phpErrorMarker_counter <= 0 execute 'normal ``' endif endif endfunction "autowrite {{{1 function phpErrorMarker#autowrite() if g:phpErrorMarker#autowrite && &modified w endif endfunction "markErrors {{{1 function phpErrorMarker#markErrors() ccl if !exists('b:phpErrorMarker_counter') let b:phpErrorMarker_counter = 0 endif call phpErrorMarker#unmarkErrors() let errors = getqflist() if len(errors) for error in errors if error['valid'] > 0 let b:phpErrorMarker_counter += 1 silent! execute 'sign place ' . (s:id + b:phpErrorMarker_counter) . ' line=' . error['lnum'] . ' name=phpErrorMarker' . (error['text'] =~ '\cwarning' ? 'Warning' : 'Error') . ' buffer=' . error['bufnr'] endif endfor if b:phpErrorMarker_counter > 0 redraw! call cursor(errors[0]['lnum'], errors[0]['col']) normal! zv if g:phpErrorMarker#openQuickfix cw endif endif endif endfunction "unmarkErrors {{{1 function phpErrorMarker#unmarkErrors() if exists('b:phpErrorMarker_counter') && b:phpErrorMarker_counter > 0 while b:phpErrorMarker_counter > 0 silent! execute 'sign unplace ' . (s:id + b:phpErrorMarker_counter) let b:phpErrorMarker_counter -= 1 endwhile endif endfunction " vim:filetype=vim foldmethod=marker shiftwidth=3 tabstop=3 "makeVimball {{{1 function phpErrorMarker#makeVimball() split phpErrorMarkerVimball setlocal bufhidden=delete setlocal nobuflisted setlocal noswapfile let files = 0 for file in split(globpath(&runtimepath, '**/phpErrorMarker*'), "\n") for runtimepath in split(&runtimepath, ',') if file =~ '^' . runtimepath if getftype(file) != 'dir' let files += 1 call setline(files, substitute(file, '^' . runtimepath . '/', '', '')) else for subFile in split(glob(file . '/**'), "\n") if getftype(subFile) != 'dir' let files += 1 call setline(files, substitute(subFile, '^' . runtimepath . '/', '', '')) endif endfor endif endif endfor endfor try execute '%MkVimball! phpErrorMarker' setlocal nomodified bwipeout echomsg 'Vimball is in ''' . getcwd() . '''' catch /.*/ echohl ErrorMsg echomsg v:exception echohl None endtry endfunction " vim:filetype=vim foldmethod=marker shiftwidth=3 tabstop=3 ftplugin/php/phpErrorMarker.vim [[[1 40 "============================================================================= " Author: Frédéric Hardy - http://blog.mageekbox.net " Date: Mar 18 déc 2012 16:03:55 CET " Licence: GPL version 2.0 license " GetLatestVimScripts: 2794 11432 :AutoInstall: phpErrorMarker.vim "============================================================================= if (!exists('phpErrorMarker#disable') || phpErrorMarker#disable <= 0) && !exists('b:phpErrorMarker_loaded') let b:phpErrorMarker_loaded = 1 if &cp echomsg 'No compatible mode is required by phpErrorMarker' elseif !has('signs') echomsg 'Signs feature is required by phpErrorMarker' else let s:cpo = &cpo setlocal cpo&vim let &makeprg = g:phpErrorMarker#php . ' -nl %' let &errorformat = g:phpErrorMarker#errorformat augroup phpErrorMarker au! * au QuickFixCmdPre make call phpErrorMarker#autowrite() au BufWritePost call phpErrorMarker#automake() au QuickFixCmdPost make call phpErrorMarker#markErrors() au InsertLeave call phpErrorMarker#unmarkErrors() augroup end command -buffer -nargs=0 MarkPhpErrors call phpErrorMarker#markErrors() command -buffer -nargs=0 UnmarkPhpErrors call phpErrorMarker#unmarkErrors() command -buffer -nargs=0 PhpErrorMarkerVimball call phpErrorMarker#makeVimball() let &cpo = s:cpo unlet s:cpo endif endif finish " vim:filetype=vim foldmethod=marker shiftwidth=3 tabstop=3