diff --git a/autoload/build.vim b/autoload/build.vim new file mode 100644 index 0000000..b7d7c8c --- /dev/null +++ b/autoload/build.vim @@ -0,0 +1,6 @@ +function! build#dir(dir) abort + let l:cwd = getcwd() + let $BUILD_DIR = l:cwd.'/'.a:dir + let g:ycm_clangd_args = ['--compile-commands-dir='.$BUILD_DIR] + YcmRestartServer +endfunction diff --git a/plugin/commands.vim b/plugin/commands.vim index 8d423ba..2fc7fd2 100644 --- a/plugin/commands.vim +++ b/plugin/commands.vim @@ -29,3 +29,6 @@ command! -nargs=+ -complete=file Debug call do#debug() " Find all TODO items in the current file and populate the location list command! TodoFile lvimgrep /todo/ % + +" Change build directory +command! -nargs=1 -complete=dir BuildDir call build#dir()