aboutsummaryrefslogtreecommitdiff
path: root/dotfiles/.local/share/nvim/site/autoload/neomake/makers/ft/c.vim
diff options
context:
space:
mode:
authorYaroslav <contact@yaroslavps.com>2020-03-31 17:52:49 +0300
committerYaroslav <contact@yaroslavps.com>2020-03-31 17:52:49 +0300
commit7217c7749e5403c9c7856c1d12c7986eb9c3b460 (patch)
treed60a112d9119a51af1cf5f590c5efad81751edf6 /dotfiles/.local/share/nvim/site/autoload/neomake/makers/ft/c.vim
parent9a3aa7b20a67c1b7991da1da9508ad5f78f76352 (diff)
downloadvimrice-7217c7749e5403c9c7856c1d12c7986eb9c3b460.tar.gz
vimrice-7217c7749e5403c9c7856c1d12c7986eb9c3b460.zip
Goodbye vim, been using neovim for ages now; home directory cleanup
Diffstat (limited to 'dotfiles/.local/share/nvim/site/autoload/neomake/makers/ft/c.vim')
-rw-r--r--dotfiles/.local/share/nvim/site/autoload/neomake/makers/ft/c.vim110
1 files changed, 110 insertions, 0 deletions
diff --git a/dotfiles/.local/share/nvim/site/autoload/neomake/makers/ft/c.vim b/dotfiles/.local/share/nvim/site/autoload/neomake/makers/ft/c.vim
new file mode 100644
index 0000000..1d0cda8
--- /dev/null
+++ b/dotfiles/.local/share/nvim/site/autoload/neomake/makers/ft/c.vim
@@ -0,0 +1,110 @@
+" vim: ts=4 sw=4 et
+
+function! neomake#makers#ft#c#EnabledMakers() abort
+ let makers = executable('clang') ? ['clang', 'clangtidy', 'clangcheck'] : ['gcc']
+ call add(makers, 'checkpatch')
+ call add(makers, 'cppcheck')
+ return makers
+endfunction
+
+let g:neomake#makers#ft#c#project_root_files = ['configure', 'CMakeLists.txt']
+
+function! neomake#makers#ft#c#clang() abort
+ " as a single-file maker, include the current directory in the default
+ " search path
+ return {
+ \ 'args': ['-fsyntax-only', '-Wall', '-Wextra', '-I./'],
+ \ '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
+
+function! neomake#makers#ft#c#clangcheck() abort
+ return {
+ \ 'exe': 'clang-check',
+ \ '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
+
+function! neomake#makers#ft#c#gcc() abort
+ " as a single-file maker, include the current directory in the default
+ " search path
+ return {
+ \ 'args': ['-fsyntax-only', '-Wall', '-Wextra', '-I./'],
+ \ 'errorformat':
+ \ '%-G%f:%s:,' .
+ \ '%-G%f:%l: %#error: %#(Each undeclared identifier is reported only%.%#,' .
+ \ '%-G%f:%l: %#error: %#for each function it appears%.%#,' .
+ \ '%-GIn file included%.%#,' .
+ \ '%-G %#from %f:%l\,,' .
+ \ '%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
+
+" The -p option followed by the path to the build directory should be set in
+" the maker's arguments. That directory should contain the compile command
+" database (compile_commands.json).
+function! neomake#makers#ft#c#clangtidy() abort
+ return {
+ \ 'exe': 'clang-tidy',
+ \ 'errorformat':
+ \ '%E%f:%l:%c: fatal error: %m,' .
+ \ '%E%f:%l:%c: error: %m,' .
+ \ '%W%f:%l:%c: warning: %m,' .
+ \ '%-G%\m%\%%(LLVM ERROR:%\|No compilation database found%\)%\@!%.%#,' .
+ \ '%E%m',
+ \ 'short_name': 'ctdy',
+ \ }
+endfunction
+
+function! neomake#makers#ft#c#checkpatch() abort
+ return {
+ \ 'exe': 'checkpatch.pl',
+ \ 'args': ['--no-summary', '--no-tree', '--terse', '--file'],
+ \ 'errorformat':
+ \ '%f:%l: %tARNING: %m,' .
+ \ '%f:%l: %tRROR: %m',
+ \ }
+endfunction
+
+function! neomake#makers#ft#c#cppcheck() abort
+ " Uses --force to avoid:
+ " nofile:0:0:information:Too many #ifdef configurations - cppcheck only checks 12 configurations.
+ " NOTE: '--language=c' should be the first args, it gets replaced in
+ " neomake#makers#ft#cpp#cppcheck.
+ return {
+ \ 'args': ['--language=c', '--quiet', '--enable=warning', '--force',
+ \ '--template="{file}:{line}:{column}:{severity}:{message}"'],
+ \ 'errorformat':
+ \ 'nofile:0:0:%trror:%m,' .
+ \ '%f:%l:%c:%trror:%m,' .
+ \ 'nofile:0:0:%tarning:%m,'.
+ \ '%f:%l:%c:%tarning:%m,'.
+ \ 'nofile:0:0:%tnformation:%m,'.
+ \ '%f:%l:%c:%tnformation:%m',
+ \ }
+endfunction