robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

Christian Clasonvim-patch:4927dae: runtime(compiler): fix escaping of arguments passed to :CompilerSetfd57f39766

master
1.6 KiB45 linesraw
1" Vim compiler file
2" Compiler:     Groff
3" Maintainer:   Konfekt
4" Last Change:	2024 Nov 19
5"
6" Expects output file extension, say `:make html` or `:make pdf`.
7" Supported devices as of Sept 2024 are: (x)html, pdf, ps, dvi, lj4, lbp ...
8" Adjust command-line flags, language, encoding by buffer-local/global variables
9" groff_compiler_args, groff_compiler_lang, and groff_compiler_encoding,
10" which default to '', &spelllang and 'utf8'.
11
12if exists("current_compiler")
13  finish
14endif
15
16let s:keepcpo = &cpo
17set cpo&vim
18
19let current_compiler = 'groff'
20
21silent! function s:groff_compiler_lang()
22  let lang = get(b:, 'groff_compiler_lang',
23      \ &spell ? matchstr(&spelllang, '^\a\a') : '')
24  if lang ==# 'en' | let lang = '' | endif
25  return empty(lang) ? '' : '-m'..lang
26endfunction
27
28" Requires output format (= device) to be set by user after :make.
29execute 'CompilerSet makeprg=groff'..escape(
30    \ ' '..s:groff_compiler_lang()..
31    \ ' -K'..get(b:, 'groff_compiler_encoding', get(g:, 'groff_compiler_encoding', 'utf8'))..
32    \ ' '..get(b:, 'groff_compiler_args', get(g:, 'groff_compiler_args', ''))..
33    \ ' -mom -T$* -- %:S > %:r:S.$*', ' \|"')
34" From Gavin Freeborn's https://github.com/Gavinok/vim-troff under Vim License
35" https://github.com/Gavinok/vim-troff/blob/91017b1423caa80aba541c997909a4f810edd275/compiler/troff.vim#L39
36CompilerSet errorformat=%o:<standard\ input>\ (%f):%l:%m,
37			\%o:\ <standard\ input>\ (%f):%l:%m,
38			\%o:%f:%l:%m,
39			\%o:\ %f:%l:%m,
40			\%f:%l:\ macro\ %trror:%m,
41			\%f:%l:%m,
42			\%W%tarning:\ file\ '%f'\\,\ around\ line\ %l:,%Z%m
43
44let &cpo = s:keepcpo
45unlet s:keepcpo