diff --git a/neostrophic.vim b/neostrophic.vim index cee92e5..19967fa 100644 --- a/neostrophic.vim +++ b/neostrophic.vim @@ -51,6 +51,10 @@ function! s:set_indent() endfunction +function! s:read_clangflags() + return split(join(readfile(getcwd() . "/.clang_complete"), "\n")) +endfunction + " --- Start if(!has("python3")) echo "You should install python neovim module. `pip install neovim`" @@ -325,6 +329,24 @@ let g:SuperTabDefaultCompletionType = "" " LessSpace 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 " Commonly used commands nnoremap :u