context.vim 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 makefile exists and we are not asked to ignore it, we use standard make
  11. " (do not redefine makeprg)
  12. if get(b:, 'context_ignore_makefile', get(g:, 'context_ignore_makefile', 0)) ||
  13. \ (!filereadable('Makefile') && !filereadable('makefile'))
  14. let current_compiler = 'context'
  15. " The following assumes that the current working directory is set to the
  16. " directory of the file to be typeset
  17. let s:makeprg = get(b:, 'context_mtxrun', get(g:, 'context_mtxrun', 'mtxrun'))
  18. \ . ' --script context --autogenerate --nonstopmode --synctex='
  19. \ . (get(b:, 'context_synctex', get(g:, 'context_synctex', 0)) ? '1' : '0')
  20. \ . ' ' . get(b:, 'context_extra_options', get(g:, 'context_extra_options', ''))
  21. \ . ' ' . shellescape(expand('%:p:t'))
  22. execute 'CompilerSet makeprg=' .. escape(s:makeprg, ' ')
  23. else
  24. let current_compiler = 'make'
  25. endif
  26. let b:context_errorformat = ''
  27. \ . '%-Popen source%.%#> %f,'
  28. \ . '%-Qclose source%.%#> %f,'
  29. \ . "%-Popen source%.%#name '%f',"
  30. \ . "%-Qclose source%.%#name '%f',"
  31. \ . '%Etex %trror%.%#mp error on line %l in file %f:%.%#,'
  32. \ . 'tex %trror%.%#error on line %l in file %f: %m,'
  33. \ . '%Elua %trror%.%#error on line %l in file %f:,'
  34. \ . '%+Emetapost %#> error: %#,'
  35. \ . '! error: %#%m,'
  36. \ . '%-C %#,'
  37. \ . '%C! %m,'
  38. \ . '%Z[ctxlua]%m,'
  39. \ . '%+C<*> %.%#,'
  40. \ . '%-C%.%#,'
  41. \ . '%Z...%m,'
  42. \ . '%-Zno-error,'
  43. \ . '%-G%.%#' " Skip remaining lines
  44. execute 'CompilerSet errorformat=' . escape(b:context_errorformat, ' ')
  45. let &cpo = s:keepcpo
  46. unlet s:keepcpo