From 3d39ea3ea9b6e66640e59731d155d731218e7e62 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 26 May 2024 07:11:50 +0800 Subject: vim-patch:9.1.0442: hare runtime files outdated (#29011) Problem: hare runtime files outdated Solution: runtime(hare): update hare.vim to match upstream (Amelia Clarke) closes: vim/vim#14836 https://github.com/vim/vim/commit/35dfe58a540e2fb0eff953630f8e4fcbf4bc26ca Co-authored-by: Amelia Clarke --- runtime/compiler/hare.vim | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'runtime/compiler') diff --git a/runtime/compiler/hare.vim b/runtime/compiler/hare.vim index c98bbb9c63..33edb3a281 100644 --- a/runtime/compiler/hare.vim +++ b/runtime/compiler/hare.vim @@ -1,28 +1,29 @@ -" Vim compiler file -" Compiler: Hare Compiler -" Maintainer: Amelia Clarke -" Last Change: 2022-09-21 -" 2024 Apr 05 by The Vim Project (removed :CompilerSet definition) +" Vim compiler file. +" Compiler: Hare +" Maintainer: Amelia Clarke +" Last Change: 2024-05-23 +" Upstream: https://git.sr.ht/~sircmpwn/hare.vim -if exists("g:current_compiler") +if exists('current_compiler') finish endif -let g:current_compiler = "hare" +let current_compiler = 'hare' let s:cpo_save = &cpo set cpo&vim -if filereadable("Makefile") || filereadable("makefile") +if filereadable('Makefile') || filereadable('makefile') CompilerSet makeprg=make else CompilerSet makeprg=hare\ build endif CompilerSet errorformat= - \Error\ %f:%l:%c:\ %m, - \Syntax\ error:\ %.%#\ at\ %f:%l:%c\\,\ %m, + \%f:%l:%c:\ syntax\ error:\ %m, + \%f:%l:%c:\ error:\ %m, \%-G%.%# let &cpo = s:cpo_save unlet s:cpo_save -" vim: tabstop=2 shiftwidth=2 expandtab + +" vim: et sts=2 sw=2 ts=8 -- cgit From c3cb56d8ec2cab6842a8678c84d7fed4776822ca Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 16 Jun 2024 17:00:30 +0200 Subject: vim-patch:0ddab58: runtime(java): Add a config variable for commonly used compiler options The value of g:javac_makeprg_params, if set, is added to the value of 'makeprg' as an option string. closes: vim/vim#14999 https://github.com/vim/vim/commit/0ddab582fa13d1d653800494e45ecfba00974a18 Co-authored-by: Doug Kearns --- runtime/compiler/javac.vim | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'runtime/compiler') diff --git a/runtime/compiler/javac.vim b/runtime/compiler/javac.vim index f5fe84124f..9bd4cdf270 100644 --- a/runtime/compiler/javac.vim +++ b/runtime/compiler/javac.vim @@ -1,7 +1,7 @@ " Vim compiler file " Compiler: Java Development Kit Compiler " Maintainer: Doug Kearns -" Last Change: 2024 Apr 03 +" Last Change: 2024 Jun 14 if exists("current_compiler") finish @@ -11,7 +11,12 @@ let current_compiler = "javac" let s:cpo_save = &cpo set cpo&vim -CompilerSet makeprg=javac +if exists("g:javac_makeprg_params") + execute $'CompilerSet makeprg=javac\ {escape(g:javac_makeprg_params, ' \|"')}' +else + CompilerSet makeprg=javac +endif + CompilerSet errorformat=%E%f:%l:\ error:\ %m, \%W%f:%l:\ warning:\ %m, \%-Z%p^, -- cgit From a0fd51c1e2db17ab21e2a2c907b232d05dfffc88 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Mon, 15 Jul 2024 20:02:22 +0200 Subject: vim-patch:1cc4cae: runtime(typst): Add typst runtime files closes: vim/vim#15234 https://github.com/vim/vim/commit/1cc4cae961a7b49608ef7bd56837cc723d49db4d Co-authored-by: Gregory Anders --- runtime/compiler/typst.vim | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 runtime/compiler/typst.vim (limited to 'runtime/compiler') diff --git a/runtime/compiler/typst.vim b/runtime/compiler/typst.vim new file mode 100644 index 0000000000..33e55818e9 --- /dev/null +++ b/runtime/compiler/typst.vim @@ -0,0 +1,15 @@ +" Vim compiler file +" Language: Typst +" Maintainer: Gregory Anders +" Last Change: 2024-07-14 +" Based on: https://github.com/kaarmu/typst.vim + +if exists('current_compiler') + finish +endif +let current_compiler = get(g:, 'typst_cmd', 'typst') + +" With `--diagnostic-format` we can use the default errorformat +let s:makeprg = [current_compiler, 'compile', '--diagnostic-format', 'short', '%:S'] + +execute 'CompilerSet makeprg=' . join(s:makeprg, '\ ') -- cgit From 78e48cd9b5c8f8ac698fe545685f4abfcab08c03 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Wed, 21 Aug 2024 00:29:12 +0200 Subject: vim-patch:d55e698: runtime(pandoc): refine pandoc compiler settings closes: vim/vim#15529 https://github.com/vim/vim/commit/d55e698fa02195bf451b072eb2fb20cfbf7bddf5 Co-authored-by: Konfekt --- runtime/compiler/pandoc.vim | 46 ++++++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 21 deletions(-) (limited to 'runtime/compiler') diff --git a/runtime/compiler/pandoc.vim b/runtime/compiler/pandoc.vim index 6c151930c5..68ac001b97 100644 --- a/runtime/compiler/pandoc.vim +++ b/runtime/compiler/pandoc.vim @@ -1,6 +1,7 @@ " Vim compiler file " Compiler: Pandoc " Maintainer: Konfekt +" Last Change: 2024 Aug 20 " " Expects output file extension, say `:make html` or `:make pdf`. " Passes additional arguments to pandoc, say `:make html --self-contained`. @@ -25,31 +26,34 @@ let s:supported_filetypes = silent! function s:PandocFiletype(filetype) abort let ft = a:filetype - if ft ==# 'pandoc' - return 'markdown' - elseif ft ==# 'tex' - return 'latex' - elseif ft ==# 'xml' - " Pandoc does not support XML as a generic input format, but it does support - " EndNote XML and Jats XML out of which the latter seems more universal. - return 'jats' - elseif ft ==# 'text' || empty(ft) - return 'markdown' - elseif index(s:supported_filetypes, &ft) >= 0 - return ft + + if ft ==# 'pandoc' | return 'markdown' + elseif ft ==# 'tex' | return 'latex' + " Pandoc does not support XML as a generic input format, but it does support + " EndNote XML and Jats XML out of which the latter seems more universal. + elseif ft ==# 'xml' | return 'jats' + elseif ft ==# 'text' || empty(ft) | return 'markdown' + elseif index(s:supported_filetypes, &ft) >= 0 | return ft else - echomsg 'Unsupported filetype: ' . ft . ', falling back to Markdown as input format!' + echomsg 'Unsupported filetype: '..ft..', falling back to Markdown as input format!' return 'markdown' endif endfunction -execute 'CompilerSet makeprg=pandoc\ --standalone' . - \ '\ --metadata\ title=%:t:r:S' . - \ '\ --metadata\ lang=' . matchstr(&spelllang, '^\a\a') . - \ '\ --from=' . s:PandocFiletype(&filetype) . - \ '\ ' . escape(get(b:, 'pandoc_compiler_args', get(g:, 'pandoc_compiler_args', '')), ' ') . - \ '\ --output\ %:r:S.$*\ %:S' - -CompilerSet errorformat="%f",\ line\ %l:\ %m + +let b:pandoc_compiler_from = get(b:, 'pandoc_compiler_from', s:PandocFiletype(&filetype)) +let b:pandoc_compiler_lang = get(b:, 'pandoc_compiler_lang', &spell ? matchstr(&spelllang, '^\a\a') : '') + +execute 'CompilerSet makeprg=pandoc'..escape( + \ ' --standalone' . + \ (b:pandoc_compiler_from ==# 'markdown' && (getline(1) =~# '^%\s\+\S\+' || (search('^title:\s+\S+', 'cnw') > 0)) ? + \ '' : ' --metadata title=%:t:r:S') . + \ (empty(b:pandoc_compiler_lang) ? + \ '' : ' --metadata lang='..b:pandoc_compiler_lang) . + \ ' --from='..b:pandoc_compiler_from . + \ ' '..get(b:, 'pandoc_compiler_args', get(g:, 'pandoc_compiler_args', '')) . + \ ' --output %:r:S.$* -- %:S', ' ') + +CompilerSet errorformat=%f,\ line\ %l:\ %m let &cpo = s:keepcpo unlet s:keepcpo -- cgit From a691858326430d1d5462161fd105aa419d3f54f2 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Wed, 21 Aug 2024 00:29:40 +0200 Subject: vim-patch:5f5f283: runtime(pandoc): escape quotes in &errorformat for pandoc closes: vim/vim#15535 https://github.com/vim/vim/commit/5f5f2832f5dcf845a93f7f62c1daf6cba9c17989 Co-authored-by: Konfekt --- runtime/compiler/pandoc.vim | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'runtime/compiler') diff --git a/runtime/compiler/pandoc.vim b/runtime/compiler/pandoc.vim index 68ac001b97..ecc935a836 100644 --- a/runtime/compiler/pandoc.vim +++ b/runtime/compiler/pandoc.vim @@ -52,8 +52,7 @@ execute 'CompilerSet makeprg=pandoc'..escape( \ ' --from='..b:pandoc_compiler_from . \ ' '..get(b:, 'pandoc_compiler_args', get(g:, 'pandoc_compiler_args', '')) . \ ' --output %:r:S.$* -- %:S', ' ') - -CompilerSet errorformat=%f,\ line\ %l:\ %m +CompilerSet errorformat=\"%f\",\ line\ %l:\ %m let &cpo = s:keepcpo unlet s:keepcpo -- cgit From def611111854612057421bb14f88ed161cfcb7f3 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Wed, 11 Sep 2024 09:20:34 +0200 Subject: vim-patch:7cc0e91: 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: vim/vim#15646 https://github.com/vim/vim/commit/7cc0e9145dbd6b25de849b3c218e51fb689e6dfc Co-authored-by: Konfekt --- runtime/compiler/groff.vim | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 runtime/compiler/groff.vim (limited to 'runtime/compiler') diff --git a/runtime/compiler/groff.vim b/runtime/compiler/groff.vim new file mode 100644 index 0000000000..640146d6a1 --- /dev/null +++ b/runtime/compiler/groff.vim @@ -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:\ (%f):%l:%m, + \%o:\ \ (%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 -- cgit From 830cf054bcd1b144562bd3530588083958cd15c6 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Wed, 11 Sep 2024 09:22:14 +0200 Subject: vim-patch:d30ffdc: runtime(pandoc): Update compiler plugin to use actual 'spelllang' Previously these would be cached in buffer-local variables and would not change on :compiler pandoc closes: vim/vim#15642 https://github.com/vim/vim/commit/d30ffdca495d116da359aaea806ad0da7b4b6c75 Co-authored-by: Christian Brabandt --- runtime/compiler/pandoc.vim | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'runtime/compiler') diff --git a/runtime/compiler/pandoc.vim b/runtime/compiler/pandoc.vim index ecc935a836..6c15e104c3 100644 --- a/runtime/compiler/pandoc.vim +++ b/runtime/compiler/pandoc.vim @@ -1,10 +1,12 @@ " Vim compiler file " Compiler: Pandoc " Maintainer: Konfekt -" Last Change: 2024 Aug 20 +" Last Change: 2024 Sep 8 " " Expects output file extension, say `:make html` or `:make pdf`. " Passes additional arguments to pandoc, say `:make html --self-contained`. +" Adjust command-line flags by buffer-local/global variable +" b/g:pandoc_compiler_args which defaults to empty. if exists("current_compiler") finish @@ -40,18 +42,21 @@ silent! function s:PandocFiletype(filetype) abort endif endfunction -let b:pandoc_compiler_from = get(b:, 'pandoc_compiler_from', s:PandocFiletype(&filetype)) -let b:pandoc_compiler_lang = get(b:, 'pandoc_compiler_lang', &spell ? matchstr(&spelllang, '^\a\a') : '') +silent! function s:PandocLang() + let lang = get(b:, 'pandoc_compiler_lang', + \ &spell ? matchstr(&spelllang, '^\a\a') : '') + if lang ==# 'en' | let lang = '' | endif + return empty(lang) ? '' : '--metadata lang='..lang +endfunction execute 'CompilerSet makeprg=pandoc'..escape( - \ ' --standalone' . - \ (b:pandoc_compiler_from ==# 'markdown' && (getline(1) =~# '^%\s\+\S\+' || (search('^title:\s+\S+', 'cnw') > 0)) ? - \ '' : ' --metadata title=%:t:r:S') . - \ (empty(b:pandoc_compiler_lang) ? - \ '' : ' --metadata lang='..b:pandoc_compiler_lang) . - \ ' --from='..b:pandoc_compiler_from . - \ ' '..get(b:, 'pandoc_compiler_args', get(g:, 'pandoc_compiler_args', '')) . - \ ' --output %:r:S.$* -- %:S', ' ') + \ ' --standalone'.. + \ (s:PandocFiletype(&filetype) ==# 'markdown' && (getline(1) =~# '^%\s\+\S\+' || (search('^title:\s+\S+', 'cnw') > 0)) ? + \ '' : ' --metadata title=%:t:r:S').. + \ ' '..s:PandocLang().. + \ ' --from='..s:PandocFiletype(&filetype).. + \ ' '..get(b:, 'pandoc_compiler_args', get(g:, 'pandoc_compiler_args', '')).. + \ ' --output %:r:S.$* -- %:S', ' ') CompilerSet errorformat=\"%f\",\ line\ %l:\ %m let &cpo = s:keepcpo -- cgit From 608ef83fc67ddefa3997441ac56caec0d4ae28bf Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Wed, 11 Sep 2024 09:23:56 +0200 Subject: vim-patch:077d1d2: runtime(make): add compiler/make.vim to reset compiler plugin settings closes: vim/vim#15645 https://github.com/vim/vim/commit/077d1d2cff20daec6f1efd504ef27fc09b927799 Co-authored-by: Konfekt Co-authored-by: K.Takata --- runtime/compiler/README.txt | 2 ++ runtime/compiler/make.vim | 13 +++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 runtime/compiler/make.vim (limited to 'runtime/compiler') diff --git a/runtime/compiler/README.txt b/runtime/compiler/README.txt index dccf4a9762..327d0a7fde 100644 --- a/runtime/compiler/README.txt +++ b/runtime/compiler/README.txt @@ -4,6 +4,8 @@ They are used with the ":compiler" command. These scripts usually set options, for example 'errorformat'. See ":help write-compiler-plugin". +To undo the effect of a compiler plugin, use the make compiler plugin. + If you want to write your own compiler plugin, have a look at the other files for how to do it, the format is simple. diff --git a/runtime/compiler/make.vim b/runtime/compiler/make.vim new file mode 100644 index 0000000000..748251bf8e --- /dev/null +++ b/runtime/compiler/make.vim @@ -0,0 +1,13 @@ +" Vim compiler plugin +" +" Maintainer: The Vim Project +" Last Change: 2024 Sep 10 +" Original Author: Konfekt +" +" This compiler plugin is used to reset previously set compiler options. + +if exists("g:current_compiler") | unlet g:current_compiler | endif +if exists("b:current_compiler") | unlet b:current_compiler | endif + +CompilerSet makeprg& +CompilerSet errorformat& -- cgit From 4ea0f1ec23eb74fb26b7137cdd83af3b0539f3be Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 5 Oct 2024 17:41:15 +0200 Subject: vim-patch:af449f6: runtime(compiler): add cppcheck linter compiler plugin closes: vim/vim#15804 https://github.com/vim/vim/commit/af449f69c7cc9f0ffafaa6e0d028dccd1c358763 Co-authored-by: Konfekt --- runtime/compiler/cppcheck.vim | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 runtime/compiler/cppcheck.vim (limited to 'runtime/compiler') diff --git a/runtime/compiler/cppcheck.vim b/runtime/compiler/cppcheck.vim new file mode 100644 index 0000000000..ed7c46e90f --- /dev/null +++ b/runtime/compiler/cppcheck.vim @@ -0,0 +1,40 @@ +" vim compiler file +" Compiler: cppcheck (C++ static checker) +" Maintainer: Vincent B. (twinside@free.fr) +" Last Change: 2024 Oct 4 by @Konfekt + +if exists("cppcheck") + finish +endif +let current_compiler = "cppcheck" + +let s:cpo_save = &cpo +set cpo-=C + +if !exists('g:c_cppcheck_params') + let g:c_cppcheck_params = '--verbose --force --inline-suppr' + \ ..' '..'--enable=warning,style,performance,portability,information,missingInclude' + \ ..' '..(executable('getconf') ? '-j' .. systemlist('getconf _NPROCESSORS_ONLN')[0] : '') + let s:undo_compiler = 'unlet! g:c_cppcheck_params' +endif + +let &l:makeprg = 'cppcheck --quiet' + \ ..' --template="{file}:{line}:{column}: {severity}: [{id}] {message} {callstack}"' + \ ..' '..get(b:, 'c_cppcheck_params', + \ g:c_cppcheck_params..' '..(&filetype ==# 'cpp' ? ' --language=c++' : '')) + \ ..' '..get(b:, 'c_cppcheck_includes', get(g:, 'c_cppcheck_includes', + \ (filereadable('compile_commands.json') ? '--project=compile_commands.json' : + \ (empty(&path) ? '' : '-I')..join(map(filter(split(&path, ','), 'isdirectory(v:val)'),'shellescape(v:val)'), ' -I')))) +silent CompilerSet makeprg + +CompilerSet errorformat= + \%f:%l:%c:\ %tarning:\ %m, + \%f:%l:%c:\ %trror:\ %m, + \%f:%l:%c:\ %tnformation:\ %m, + \%f:%l:%c:\ %m, + \%.%#\ :\ [%f:%l]\ %m + +exe get(s:, 'undo_compiler', '') + +let &cpo = s:cpo_save +unlet s:cpo_save -- cgit