Read clang checker flags from clang_complete file
Neomake didn't provide a way to pass clang flags, so I had to implement it myself. (It is not perfect though)
This commit is contained in:
parent
be4bf1a6ba
commit
637da03418
@ -51,6 +51,10 @@ function! s:set_indent()
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
function! s:read_clangflags()
|
||||||
|
return split(join(readfile(getcwd() . "/.clang_complete"), "\n"))
|
||||||
|
endfunction
|
||||||
|
|
||||||
" --- Start
|
" --- Start
|
||||||
if(!has("python3"))
|
if(!has("python3"))
|
||||||
echo "You should install python neovim module. `pip install neovim`"
|
echo "You should install python neovim module. `pip install neovim`"
|
||||||
@ -325,6 +329,24 @@ let g:SuperTabDefaultCompletionType = "<c-n>"
|
|||||||
" LessSpace
|
" LessSpace
|
||||||
let g:lessspace_blacklist = ['markdown']
|
let g:lessspace_blacklist = ['markdown']
|
||||||
|
|
||||||
|
" Neomake
|
||||||
|
let s:default_clang_args = ['-std=c++14', '-fsyntax-only', '-Wall', '-Wextra']
|
||||||
|
let g:neomake_cpp_clang_maker = {
|
||||||
|
\'args': s:default_clang_args
|
||||||
|
\ }
|
||||||
|
let g:neomake_cpp_enabled_makers = ['clang']
|
||||||
|
|
||||||
|
function! s:build_clang_args()
|
||||||
|
if filereadable(getcwd() . "/.clang_complete")
|
||||||
|
" Read flags
|
||||||
|
let newflags = s:default_clang_args + s:read_clangflags()
|
||||||
|
" Build list with no duplicates for sure
|
||||||
|
let g:neomake_cpp_clang_maker.args = filter(copy(newflags), 'index(newflags, v:val, v:key+1)==-1')
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
autocmd! FileType cpp nested call s:build_clang_args()
|
||||||
|
|
||||||
|
|
||||||
" --- Keymaps
|
" --- Keymaps
|
||||||
" Commonly used commands
|
" Commonly used commands
|
||||||
nnoremap <silent> <C-z> :u<CR>
|
nnoremap <silent> <C-z> :u<CR>
|
||||||
|
Reference in New Issue
Block a user