forked from aniani/vim
runtime(groff): Add compiler plugin for groff
Groff MOM (Macros for Manuscripts) is a macro package for the GNU troff (groff) typesetting system, a light-weight alternative to LaTeX for professional-quality documents. closes: #15646 Signed-off-by: Konfekt <Konfekt@users.noreply.github.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
parent
c2285a8cf3
commit
7cc0e9145d
1
.github/MAINTAINERS
vendored
1
.github/MAINTAINERS
vendored
@ -65,6 +65,7 @@ runtime/compiler/gawk.vim @dkearns
|
|||||||
runtime/compiler/gjs.vim @dkearns
|
runtime/compiler/gjs.vim @dkearns
|
||||||
runtime/compiler/gm2.vim @dkearns
|
runtime/compiler/gm2.vim @dkearns
|
||||||
runtime/compiler/go.vim @dbarnett
|
runtime/compiler/go.vim @dbarnett
|
||||||
|
runtime/compiler/groff.vim @Konfekt
|
||||||
runtime/compiler/haml.vim @tpope
|
runtime/compiler/haml.vim @tpope
|
||||||
runtime/compiler/hare.vim @selenebun
|
runtime/compiler/hare.vim @selenebun
|
||||||
runtime/compiler/icon.vim @dkearns
|
runtime/compiler/icon.vim @dkearns
|
||||||
|
45
runtime/compiler/groff.vim
Normal file
45
runtime/compiler/groff.vim
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
" Vim compiler file
|
||||||
|
" Compiler: Groff
|
||||||
|
" Maintainer: Konfekt
|
||||||
|
" Last Change: 2024 Sep 8
|
||||||
|
"
|
||||||
|
" Expects output file extension, say `:make html` or `:make pdf`.
|
||||||
|
" Supported devices as of Sept 2024 are: (x)html, pdf, ps, dvi, lj4, lbp ...
|
||||||
|
" Adjust command-line flags, language, encoding by buffer-local/global variables
|
||||||
|
" groff_compiler_args, groff_compiler_lang, and groff_compiler_encoding,
|
||||||
|
" which default to '', &spelllang and 'utf8'.
|
||||||
|
|
||||||
|
if exists("current_compiler")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
let s:keepcpo = &cpo
|
||||||
|
set cpo&vim
|
||||||
|
|
||||||
|
let current_compiler = 'groff'
|
||||||
|
|
||||||
|
silent! function s:groff_compiler_lang()
|
||||||
|
let lang = get(b:, 'groff_compiler_lang',
|
||||||
|
\ &spell ? matchstr(&spelllang, '^\a\a') : '')
|
||||||
|
if lang ==# 'en' | let lang = '' | endif
|
||||||
|
return empty(lang) ? '' : '-m'..lang
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Requires output format (= device) to be set by user after :make.
|
||||||
|
execute 'CompilerSet makeprg=groff'..escape(
|
||||||
|
\ ' '..s:groff_compiler_lang()..
|
||||||
|
\ ' -K'..get(b:, 'groff_compiler_encoding', get(g:, 'groff_compiler_encoding', 'utf8'))..
|
||||||
|
\ ' '..get(b:, 'groff_compiler_args', get(g:, 'groff_compiler_args', ''))..
|
||||||
|
\ ' -mom -T$* -- %:S > %:r:S.$*', ' ')
|
||||||
|
" From Gavin Freeborn's https://github.com/Gavinok/vim-troff under Vim License
|
||||||
|
" https://github.com/Gavinok/vim-troff/blob/91017b1423caa80aba541c997909a4f810edd275/compiler/troff.vim#L39
|
||||||
|
CompilerSet errorformat=%o:<standard\ input>\ (%f):%l:%m,
|
||||||
|
\%o:\ <standard\ input>\ (%f):%l:%m,
|
||||||
|
\%o:%f:%l:%m,
|
||||||
|
\%o:\ %f:%l:%m,
|
||||||
|
\%f:%l:\ macro\ %trror:%m,
|
||||||
|
\%f:%l:%m,
|
||||||
|
\%W%tarning:\ file\ '%f'\\,\ around\ line\ %l:,%Z%m
|
||||||
|
|
||||||
|
let &cpo = s:keepcpo
|
||||||
|
unlet s:keepcpo
|
@ -1,4 +1,4 @@
|
|||||||
*quickfix.txt* For Vim version 9.1. Last change: 2024 Aug 20
|
*quickfix.txt* For Vim version 9.1. Last change: 2024 Sep 09
|
||||||
|
|
||||||
|
|
||||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||||
@ -1335,6 +1335,18 @@ If Vim was started from the compiler, the :sh and some :! commands will not
|
|||||||
work, because Vim is then running in the same process as the compiler and
|
work, because Vim is then running in the same process as the compiler and
|
||||||
stdin (standard input) will not be interactive.
|
stdin (standard input) will not be interactive.
|
||||||
|
|
||||||
|
GROFF *quickfix-groff* *compiler-groff*
|
||||||
|
|
||||||
|
The GROFF compiler plugin uses the mom macro set (documented in the groff_mom
|
||||||
|
manpage) as input and expects that the output file type extension is passed to
|
||||||
|
make, say :make html or :make pdf.
|
||||||
|
|
||||||
|
Additional arguments can be passed to groff by setting them in
|
||||||
|
`b:groff_compiler_args` or `g:groff_compiler_args`. The `language` argument
|
||||||
|
passed to groff is set using 'spelllang'; it can be overridden by setting
|
||||||
|
`b:groff_compiler_lang`. The default enconding is `UTF-8` and can be changed
|
||||||
|
by setting `b:groff_compiler_encoding` or `g:groff_compiler_encoding`.
|
||||||
|
|
||||||
PANDOC *quickfix-pandoc* *compiler-pandoc*
|
PANDOC *quickfix-pandoc* *compiler-pandoc*
|
||||||
|
|
||||||
The Pandoc compiler plugin expects that an output file type extension is
|
The Pandoc compiler plugin expects that an output file type extension is
|
||||||
|
@ -6545,6 +6545,7 @@ compiler-decada ft_ada.txt /*compiler-decada*
|
|||||||
compiler-dotnet quickfix.txt /*compiler-dotnet*
|
compiler-dotnet quickfix.txt /*compiler-dotnet*
|
||||||
compiler-gcc quickfix.txt /*compiler-gcc*
|
compiler-gcc quickfix.txt /*compiler-gcc*
|
||||||
compiler-gnat ft_ada.txt /*compiler-gnat*
|
compiler-gnat ft_ada.txt /*compiler-gnat*
|
||||||
|
compiler-groff quickfix.txt /*compiler-groff*
|
||||||
compiler-hpada ft_ada.txt /*compiler-hpada*
|
compiler-hpada ft_ada.txt /*compiler-hpada*
|
||||||
compiler-javac quickfix.txt /*compiler-javac*
|
compiler-javac quickfix.txt /*compiler-javac*
|
||||||
compiler-manx quickfix.txt /*compiler-manx*
|
compiler-manx quickfix.txt /*compiler-manx*
|
||||||
@ -9640,6 +9641,7 @@ quickfix-directory-stack quickfix.txt /*quickfix-directory-stack*
|
|||||||
quickfix-error-lists quickfix.txt /*quickfix-error-lists*
|
quickfix-error-lists quickfix.txt /*quickfix-error-lists*
|
||||||
quickfix-functions usr_41.txt /*quickfix-functions*
|
quickfix-functions usr_41.txt /*quickfix-functions*
|
||||||
quickfix-gcc quickfix.txt /*quickfix-gcc*
|
quickfix-gcc quickfix.txt /*quickfix-gcc*
|
||||||
|
quickfix-groff quickfix.txt /*quickfix-groff*
|
||||||
quickfix-index quickfix.txt /*quickfix-index*
|
quickfix-index quickfix.txt /*quickfix-index*
|
||||||
quickfix-manx quickfix.txt /*quickfix-manx*
|
quickfix-manx quickfix.txt /*quickfix-manx*
|
||||||
quickfix-pandoc quickfix.txt /*quickfix-pandoc*
|
quickfix-pandoc quickfix.txt /*quickfix-pandoc*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user