temp!
This commit is contained in:
parent
eabec4e9b6
commit
c87bc88ec0
@ -4,6 +4,7 @@
|
||||
- vim-vint
|
||||
- yamllint
|
||||
- cmakelint
|
||||
- compdb
|
||||
- repo:
|
||||
- remote: https://github.com/k-takata/minpac.git
|
||||
location: ~/.vim/pack/minpac/opt/minpac
|
||||
|
@ -48,17 +48,28 @@ function! build#dir(...) abort
|
||||
endif
|
||||
endif
|
||||
if exists('l:dir')
|
||||
" Set build directory and restart YouCompleteMe.
|
||||
let $BUILD_DIR = getcwd().'/'.substitute(l:dir, '\/$', '', '')
|
||||
" Set build directory.
|
||||
let l:cwd = substitute(getcwd(), '\\', '\/', 'g')
|
||||
let $BUILD_DIR = l:cwd.'/'.substitute(l:dir, '\/$', '', '')
|
||||
let l:database_dir = $BUILD_DIR
|
||||
if executable('compdb')
|
||||
" TODO: Post-process compile_commands.json with compdb.
|
||||
let l:database_dir = l:cwd.'/.vim'
|
||||
call systemlist('compdb -p '.$BUILD_DIR.' list > '.l:compile_commands)
|
||||
endif
|
||||
call system('')
|
||||
" Read/create .vim/coc-settings.json
|
||||
let l:coc_settings = {}
|
||||
if isdirectory('.vim')
|
||||
let l:coc_settings = json_decode(join(readfile('.vim/coc-settings.json'), ''))
|
||||
else
|
||||
call mkdir('.vim')
|
||||
endif
|
||||
let l:coc_settings['clangd.compilationDatabasePath'] = $BUILD_DIR
|
||||
" Update .vim/coc-settings.json with new build directory.
|
||||
let l:coc_settings['clangd.compilationDatabasePath'] = l:database_dir
|
||||
let l:coc_settings['cmake.lsp.buildDirectory'] = $BUILD_DIR
|
||||
call writefile([json_encode(l:coc_settings)], '.vim/coc-settings.json')
|
||||
" Finally coc.nvim with new config.
|
||||
CocRestart
|
||||
endif
|
||||
endfunction
|
||||
|
Loading…
x
Reference in New Issue
Block a user