context.vim 1.9 KB

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