Use coc and ultisnips and denite/denite-git

This commit is contained in:
Oliver Hartmann 2019-01-01 12:51:33 +01:00
parent ce1193a592
commit c457e58fb3
2 changed files with 44 additions and 8 deletions

13
coc-settings.json Normal file
View File

@ -0,0 +1,13 @@
{
"languageserver": {
"cquery": {
"command": "cquery",
"args": ["--log-file=/tmp/cq.log"],
"filetypes": ["c", "cpp"],
"rootPatterns": ["compile_flags.txt", "compile_commands.json", ".vim/", ".git/", ".hg/"],
"initializationOptions": {
"cacheDirectory": "/tmp/cquery"
}
}
}
}

View File

@ -2,6 +2,8 @@ let hostname = substitute(system('hostname'), '\n', '', '')
" =============Plugins==================
call plug#begin()
Plug 'morhetz/gruvbox'
Plug 'Shougo/denite.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'chemzqm/denite-git'
Plug 'tomtom/tcomment_vim'
Plug 'bling/vim-airline'
Plug 'vim-airline/vim-airline-themes'
@ -9,7 +11,7 @@ Plug 'vim-airline/vim-airline-themes'
Plug 'neoclide/coc.nvim', {'do': { -> coc#util#install()}}
Plug 'tpope/vim-fugitive'
Plug 'airblade/vim-gitgutter'
" Plug 'Shougo/neosnippet.vim'
Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'
Plug 'vim-scripts/a.vim'
Plug 'luochen1990/rainbow'
@ -143,13 +145,6 @@ end
let g:deoplete#enable_at_startup = 1
let g:deoplete#auto_complete_start_length = 1
let g:deoplete#enable_smart_case = 1
" =========================neosnippet==================
" " Enable snipMate compatibility feature.
let g:neosnippet#enable_snipmate_compatibility = 1
" Tell Neosnippet about the other snippets
imap <expr><TAB> neosnippet#expandable_or_jumpable() ? "\<Plug>(neosnippet_expand_or_jump)" : pumvisible() ? "\<C-n>" : "\<TAB>"
smap <expr><TAB> neosnippet#expandable_or_jumpable() ? "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
" conceal neosnippet markers
" =====================A======================
" Function for switching between header and c* files
map <F5> :wa <CR> :A<CR>
@ -162,6 +157,10 @@ let g:alternateSearchPath = 'sfr:../source,sfr:../src,sfr:../include,../../inclu
" Dont create the file if the .cpp or .h is not found
let g:alternateNoDefaultAlternate = 1
" ===================UltiSnips================
let g:UltiSnipsExpandTrigger = "<Plug>(ultisnips_expand)"
let g:UltiSnipsJumpForwardTrigger = "<C-J>"
let g:UltiSnipsJumpBackwardTrigger = "<C-K>"
" ===========RAINBOW====================
let g:rainbow_active = 1
let g:rainbow_conf = {
@ -210,3 +209,27 @@ if has("win32")
let g:chromatica#libclang_path='D:\Tools\LLVM\bin\libclang.dll'
end
end
" ===================COC=============================
inoremap <silent><expr> <c-space> coc#refresh()
autocmd CursorHold * silent call CocActionAsync('highlight')
" Remap for format selected region
vmap <leader>f <Plug>(coc-format-selected)
nmap <leader>f <Plug>(coc-format-selected)
" Use `:Format` for format current buffer
command! -nargs=0 Format :call CocAction('format')
" Shortcuts for denite interface
" Show extension list
nnoremap <silent> <space>e :<C-u>Denite coc-extension<cr>
" Show symbols of current buffer
nnoremap <silent> <space>o :<C-u>Denite coc-symbols<cr>
" Search symbols of current workspace
nnoremap <silent> <space>t :<C-u>Denite coc-workspace<cr>
" Show diagnostics of current workspace
nnoremap <silent> <space>a :<C-u>Denite coc-diagnostic<cr>
" Show available commands
nnoremap <silent> <space>c :<C-u>Denite coc-command<cr>
" Show available services
nnoremap <silent> <space>s :<C-u>Denite coc-service<cr>
" Show links of current buffer
nnoremap <silent> <space>l :<C-u>Denite coc-link<cr>