Compare commits
1 Commits
e3577cb7e3
...
17f7e3165d
Author | SHA1 | Date | |
---|---|---|---|
17f7e3165d |
@ -4,3 +4,23 @@ function! build#dir(dir) abort
|
|||||||
let g:ycm_clangd_args = ['--compile-commands-dir='.$BUILD_DIR]
|
let g:ycm_clangd_args = ['--compile-commands-dir='.$BUILD_DIR]
|
||||||
YcmRestartServer
|
YcmRestartServer
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! build#targets(ArgLead, CmdLine, CursorPos) abort
|
||||||
|
let l:targets = []
|
||||||
|
if filereadable($BUILD_DIR.'/build.ninja')
|
||||||
|
for l:target in split(system('ninja -C '.$BUILD_DIR.' -t targets'), '\n')
|
||||||
|
call add(l:targets, substitute(l:target, ':.*$', '', ''))
|
||||||
|
endfor
|
||||||
|
elseif filereadable($BUILD_DIR.'/Makefile')
|
||||||
|
" TODO: support make
|
||||||
|
endif
|
||||||
|
return join(l:targets, "\n")
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! build#run(...) abort
|
||||||
|
if filereadable($BUILD_DIR.'/build.ninja')
|
||||||
|
execute 'terminal ninja -C '.$BUILD_DIR.' '.join(a:000, ' ')
|
||||||
|
elseif filereadable($BUILD_DIR.'/Makefile')
|
||||||
|
execute 'terminal make -C '.$BUILD_DIR.' '.join(a:000, ' ')
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
@ -32,3 +32,4 @@ command! TodoFile lvimgrep /todo/ %
|
|||||||
|
|
||||||
" Change build directory
|
" Change build directory
|
||||||
command! -nargs=1 -complete=dir BuildDir call build#dir(<f-args>)
|
command! -nargs=1 -complete=dir BuildDir call build#dir(<f-args>)
|
||||||
|
command! -nargs=* -complete=custom,build#targets Build call build#run(<f-args>)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user