Bram Moolenaar | 46fceaa | 2016-10-23 21:21:08 +0200 | [diff] [blame] | 1 | " Vim compiler file |
| 2 | " Compiler: ConTeXt typesetting engine |
| 3 | " Maintainer: Nicola Vitacolonna <nvitacolonna@gmail.com> |
| 4 | " Last Change: 2016 Oct 21 |
| 5 | |
| 6 | if exists("current_compiler") |
| 7 | finish |
| 8 | endif |
| 9 | let s:keepcpo= &cpo |
| 10 | set cpo&vim |
| 11 | |
| 12 | if exists(":CompilerSet") != 2 " older Vim always used :setlocal |
| 13 | command -nargs=* CompilerSet setlocal <args> |
| 14 | endif |
| 15 | |
| 16 | " If makefile exists and we are not asked to ignore it, we use standard make |
| 17 | " (do not redefine makeprg) |
| 18 | if 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')) |
| 28 | else |
| 29 | let current_compiler = 'make' |
| 30 | endif |
| 31 | |
| 32 | let 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 | |
| 51 | execute 'CompilerSet errorformat=' . escape(b:context_errorformat, ' ') |
| 52 | |
| 53 | let &cpo = s:keepcpo |
| 54 | unlet s:keepcpo |