From 350f8087e702cb2a7c2d2e1a96801e9a69dee9c4 Mon Sep 17 00:00:00 2001 From: Jannik Zander <59698@grundfos.com> Date: Sun, 15 Jul 2018 16:58:32 +0200 Subject: [PATCH] Cmake with project root --- .vim/vimrc | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/.vim/vimrc b/.vim/vimrc index 7655b2e..9c71bc7 100644 --- a/.vim/vimrc +++ b/.vim/vimrc @@ -109,19 +109,26 @@ let &t_EI.="\e[1 q" let &t_te.="\e[0 q" " make -let mycomp="msvc" - -if mycomp == "msvc" - compiler msvc +function! s:Msvc(path) let &errorformat="%f(%l) : %t%*\\D%n: %m,%*[^\"]\"%f\"%*\\D%l: %m,%f(%l) : %m,%*[^ ] %f %l: %m,%f:%l:%c:%m,%f(%l):%m,%f|%l| %m" - set makeprg=cmake -elseif mycomp == "doxygen" + let &makeprg='cd ' . a:path . '; cmake ' + let b:asyncrun_root = '~/projects/applayer' + exe 'AsyncRun -cwd= mkdir -p ' . fnameescape(a:path) +endfunction +command! -bang -nargs=1 -complete=file Msvc call s:Msvc() + +function! s:Doxygen() set errorformat+=%f:%l:\ %m set makeprg=doxygen -elseif mycomp == "iar" +endfunction +command! -bang -nargs=0 -complete=file Doxygen call s:Doxygen() + +function! s:Iar(path) set errorformat=%f(%l)\ :\ %m set makeprg=vim-iarbuild.cmd -endif +endfunction +command! -bang -nargs=0 -complete=file Iar call s:Iar() + " grep " file:line:coloumn:message @@ -155,7 +162,7 @@ let GtagsCscope_Ignore_Case = 1 let GtagsCscope_Absolute_Path = 1 let GtagsCscope_Keep_Alive = 1 let GtagsCscope_Auto_Load = 1 -"cscope add GTAGS +let GtagsCscope_Quiet = 1 " Unimpaired packadd! vim-unimpaired @@ -169,6 +176,7 @@ let g:ranger_replace_netrw = 1 packadd! vim-airline let g:airline#extensions#tabline#enabled = 1 let g:airline#extensions#tabline#formatter = 'unique_tail_improved' +let g:airline_section_error = airline#section#create_right(['%{g:asyncrun_status}']) " Editorconfig "packadd! editorconfig-vim @@ -201,11 +209,9 @@ packadd asyncrun.vim let g:asyncrun_open = 8 let g:asyncrun_status = "stopped" let g:asyncrun_auto = "make" -let g:airline_section_error = airline#section#create_right(['%{g:asyncrun_status}']) -command! -bang -nargs=* -complete=file Make AsyncRun -program=make @ -"augroup asyncrun -" autocmd QuickFixCmdPost * call asyncrun#quickfix_toggle(8, 1) -"augroup END +let g:asyncrun_rootmarks = ['.git'] +command! -bang -nargs=* -complete=file Make AsyncRun -cwd= -program=make @ +command! -bang -nargs=* -complete=file Grep AsyncRun -cwd= -program=grep @ " Error markers packadd errormarker.vim @@ -237,10 +243,6 @@ tnoremap j tnoremap k tnoremap l -" My functions -function! SetCmakeRoot(path) - let &makeprg="cmake ". a:path -endfunction " Autocommands if has('autocmd') @@ -273,6 +275,7 @@ if has('autocmd') augroup quickfix autocmd QuickFixCmdPost [^l]* nested cwindow autocmd QuickFixCmdPost l* nested lwindow +" autocmd QuickFixCmdPost * call asyncrun#quickfix_toggle(8, 1) augroup END endif -- 2.43.0