Improve coc.nvim
This commit is contained in:
parent
72e211f5e5
commit
a54ce118f4
2 changed files with 28 additions and 4 deletions
|
@ -1,9 +1,12 @@
|
|||
{
|
||||
"languageserver": {
|
||||
"golang": {
|
||||
"command": "gopls",
|
||||
"command": "/home/bca/.go/bin/gopls",
|
||||
"rootPatterns": ["go.mod", ".vim/", ".git/", ".hg/"],
|
||||
"filetypes": ["go"]
|
||||
"filetypes": ["go"],
|
||||
"initializationOptions": {
|
||||
"usePlaceholders": true
|
||||
}
|
||||
},
|
||||
"bash": {
|
||||
"command": "bash-language-server",
|
||||
|
|
25
vim/.vimrc
25
vim/.vimrc
|
@ -219,6 +219,7 @@ nmap <space>lc :lclose<CR>
|
|||
|
||||
autocmd BufNewFile,BufRead *.tmpl set syntax=gohtmltmpl
|
||||
|
||||
" Coc mappings
|
||||
nmap <silent> gd <Plug>(coc-definition)
|
||||
nmap <silent> gy <Plug>(coc-type-definition)
|
||||
nmap <silent> gi <Plug>(coc-implementation)
|
||||
|
@ -227,8 +228,6 @@ nmap <silent> go :CocList outline<CR>
|
|||
|
||||
nnoremap <silent> K :call <SID>show_documentation()<CR>
|
||||
nmap <leader>rn <Plug>(coc-rename)
|
||||
"inoremap <silent><expr> <TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
|
||||
"inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<CR>"
|
||||
|
||||
function! s:show_documentation()
|
||||
if (index(['vim','help'], &filetype) >= 0)
|
||||
|
@ -238,6 +237,28 @@ function! s:show_documentation()
|
|||
endif
|
||||
endfunction
|
||||
|
||||
" Use tab for trigger completion with characters ahead and navigate.
|
||||
inoremap <silent><expr> <TAB>
|
||||
\ pumvisible() ? "\<C-n>" :
|
||||
\ <SID>check_back_space() ? "\<TAB>" :
|
||||
\ coc#refresh()
|
||||
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
|
||||
|
||||
function! s:check_back_space() abort
|
||||
let col = col('.') - 1
|
||||
return !col || getline('.')[col - 1] =~# '\s'
|
||||
endfunction
|
||||
|
||||
" Use <cr> to confirm completion, `<C-g>u` means break undo chain at current
|
||||
" position. Coc only does snippet and additional edit on confirm.
|
||||
if has('patch8.1.1068')
|
||||
" Use `complete_info` if your (Neo)Vim version supports it.
|
||||
inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
|
||||
else
|
||||
imap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
|
||||
endif
|
||||
|
||||
|
||||
nmap <C-p> :Clap files<CR>
|
||||
nmap <C-p>b :Clap buffers<CR>
|
||||
nmap <C-p>r :Clap grep<CR>
|
||||
|
|
Loading…
Add table
Reference in a new issue