1" Vim compiler file 2" Compiler: ConTeXt typesetting engine 3" Maintainer: Nicola Vitacolonna <[email protected]> 4" Last Change: 2016 Oct 21 5 6if exists("current_compiler") 7 finish 8endif 9let s:keepcpo= &cpo 10set cpo&vim 11 12if exists(":CompilerSet") != 2 " older Vim always used :setlocal 13 command -nargs=* CompilerSet setlocal <args> 14endif 15 16" If makefile exists and we are not asked to ignore it, we use standard make 17" (do not redefine makeprg) 18if get(b:, 'context_ignore_makefile', get(g:, 'context_ignore_makefile', 0)) || 19 \ (!filereadable('Makefile') && !filereadable('makefile')) 20 let current_compiler = 'context' 21 " The following assumes that the current working directory is set to the 22 " directory of the file to be typeset 23 let &l:makeprg = get(b:, 'context_mtxrun', get(g:, 'context_mtxrun', 'mtxrun')) 24 \ . ' --script context --autogenerate --nonstopmode --synctex=' 25 \ . (get(b:, 'context_synctex', get(g:, 'context_synctex', 0)) ? '1' : '0') 26 \ . ' ' . get(b:, 'context_extra_options', get(g:, 'context_extra_options', '')) 27 \ . ' ' . shellescape(expand('%:p:t')) 28else 29 let current_compiler = 'make' 30endif 31 32let b:context_errorformat = '' 33 \ . '%-Popen source%.%#> %f,' 34 \ . '%-Qclose source%.%#> %f,' 35 \ . "%-Popen source%.%#name '%f'," 36 \ . "%-Qclose source%.%#name '%f'," 37 \ . '%Etex %trror%.%#mp error on line %l in file %f:%.%#,' 38 \ . 'tex %trror%.%#error on line %l in file %f: %m,' 39 \ . '%Elua %trror%.%#error on line %l in file %f:,' 40 \ . '%+Emetapost %#> error: %#,' 41 \ . '! error: %#%m,' 42 \ . '%-C %#,' 43 \ . '%C! %m,' 44 \ . '%Z[ctxlua]%m,' 45 \ . '%+C<*> %.%#,' 46 \ . '%-C%.%#,' 47 \ . '%Z...%m,' 48 \ . '%-Zno-error,' 49 \ . '%-G%.%#' " Skip remaining lines 50 51execute 'CompilerSet errorformat=' . escape(b:context_errorformat, ' ') 52 53let &cpo = s:keepcpo 54unlet s:keepcpo 55