vim-patch:84baba3: runtime(compiler): do not override &l:makeprg on :compiler! (#36470)

closes: vim/vim#18686

84baba329a

Co-authored-by: Konfekt <Konfekt@users.noreply.github.com>
This commit is contained in:
zeertzjq
2025-11-07 08:22:50 +08:00
committed by GitHub
parent f2bfde9140
commit af5ac171bd
4 changed files with 16 additions and 14 deletions

View File

@@ -1,7 +1,7 @@
" vim compiler file
" Compiler: cppcheck (C++ static checker)
" Maintainer: Vincent B. (twinside@free.fr)
" Last Change: 2024 Nov 19 by @Konfekt
" Last Change: 2025 Nov 06 by @Konfekt
if exists("current_compiler") | finish | endif
let current_compiler = "cppcheck"
@@ -18,14 +18,14 @@ if !exists('g:c_cppcheck_params')
let s:undo_compiler = 'unlet! g:c_cppcheck_params'
endif
let &l:makeprg = 'cppcheck --quiet'
exe 'CompilerSet makeprg=' .. escape('cppcheck --quiet'
\ ..' --template="{file}:{line}:{column}: {severity}: [{id}] {message} {callstack}"'
\ ..' '..get(b:, 'c_cppcheck_params', get(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(glob('*'..s:slash..'compile_commands.json', 1, 1)) ? '--project='..glob('*'..s:slash..'compile_commands.json', 1, 1)[0] :
\ (empty(&path) ? '' : '-I')..join(map(filter(split(&path, ','), 'isdirectory(v:val)'),'shellescape(v:val)'), ' -I')))))
exe 'CompilerSet makeprg='..escape(&l:makeprg, ' \|"')
\ (empty(&path) ? '' : '-I')..join(map(filter(split(&path, ','), 'isdirectory(v:val)'),'shellescape(v:val)'), ' -I'))))),
\ ' \|"')
CompilerSet errorformat=
\%f:%l:%c:\ %tarning:\ %m,