From d960053dfcc1177f88317608530e405e7f8ed229 Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Tue, 6 Oct 2020 17:12:06 +0100 Subject: [PATCH] Add :BuildDir to select YouCompleteMe build directory --- autoload/build.vim | 6 ++++++ plugin/commands.vim | 3 +++ 2 files changed, 9 insertions(+) create mode 100644 autoload/build.vim 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()