回家装上archlinux,突发奇想装个SpaceVim写题
安装配置一路能够说是没有太大问题
最后在写题时出现以下问题linux
Error while trying to load a compilation database: Could not auto-detect compilation database for file "poj-1458.cpp" No compilation database found in /home/tanglizi/Code/acm/summerTraining/2018 or any parent directory fixed-compilation-database: Error while opening fixed database: No such file or directory json-compilation-database: Error while opening JSON database: No such file or directory Running without flags.
查了查google,发现这是clang-check的问题,clang-check须要一个compile_commands.json文件(可由cmake生成)作到工程化check
那么问题迎刃而解git
卸载clang,换上gcc
绝对暴力的方法,能够说很不优雅了github
手写compile_commands.json文件,或者cmake一个工程
可是对ACM刷题党来说,这个实在不方便json
瞬间抛弃了前两个方法,因而开始修改vim插件
仍是查了查google,发现问题在于一个名叫neomake插件
因而查找有关clang-check的文件,看看是怎么调用clang-check的vim
grep clang-check -R ~/.cache/vimfiles/repos/github.com # /home/tanglizi/.cache/vimfiles/repos/github.com/neomake/neomake/autoload/neomake/makers/ft/c.vim: " 'exe': 'clang-check' vim /home/tanglizi/.cache/vimfiles/repos/github.com/neomake/neomake/autoload/neomake/makers/ft/c.vim
能够看到第32行出现clang-checkc#
function! neomake#makers#ft#c#clangcheck() abort return { \ 'exe': 'clang-check', \ 'args': ['%:p'], \ 'errorformat': \ '%-G%f:%s:,' . \ '%f:%l:%c: %trror: %m,' . \ '%f:%l:%c: %tarning: %m,' . \ '%I%f:%l:%c: note: %m,' . \ '%f:%l:%c: %m,'. \ '%f:%l: %trror: %m,'. \ '%f:%l: %tarning: %m,'. \ '%I%f:%l: note: %m,'. \ '%f:%l: %m', \ } endfunction
因而在33行的args里面加上'--',同理处理clang-tidy(75行),就搞定了google
\ 'args': ['%:p', '--'],
思路是在原命令后加上'--',clang就不查找compilation database了插件
clang-check file.cpp --