Skip to content

Commit

Permalink
Coc config changes
Browse files Browse the repository at this point in the history
  • Loading branch information
clvv committed Dec 3, 2022
1 parent 7dc16cd commit 73b7d09
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 25 deletions.
36 changes: 15 additions & 21 deletions .config/nvim/coc.vim
Expand Up @@ -15,17 +15,24 @@ else
endif

" Use tab for trigger completion with characters ahead and navigate.
" NOTE: There's always complete item selected by default, you may want to enable
" no select by `"suggest.noselect": true` in your configuration file.
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
" other plugin before putting this into your config.
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#pum#visible() ? coc#pum#next(1) :
\ CheckBackspace() ? "\<Tab>" :
\ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~ '\s'
" Make <CR> to accept selected completion item or notify coc.nvim to format
" <C-g>u breaks current undo, please make your own choice.
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm()
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
function! CheckBackspace() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction

" Use <c-space> to trigger completion.
Expand Down Expand Up @@ -145,19 +152,6 @@ command! -nargs=0 OR :call CocActionAsync('runCommand', 'editor.action.org
set statusline=%f\ %h%w%m%r%=%{coc#status()}%{get(b:,'coc_current_function','')}\ %(%l,%c%V\ %=\ %P%)

" Mappings for CoCList
" Show all diagnostics.
nnoremap <silent><nowait> <leader>d :<C-u>CocList diagnostics<cr>
" Manage extensions.
" nnoremap <silent><nowait> <space>e :<C-u>CocList extensions<cr>
" Show commands.
" nnoremap <silent><nowait> <space>c :<C-u>CocList commands<cr>
" Find symbol of current document.
" nnoremap <silent><nowait> <space>o :<C-u>CocList --normal outline<cr>
" Search workspace symbols.
" nnoremap <silent><nowait> <space>s :<C-u>CocList -I symbols<cr>
" Do default action for next item.
" nnoremap <silent><nowait> <space>j :<C-u>CocNext<CR>
" Do default action for previous item.
" nnoremap <silent><nowait> <space>k :<C-u>CocPrev<CR>
" Resume latest coc list.
" nnoremap <silent><nowait> <space>p :<C-u>CocListResume<CR>
nnoremap <silent><nowait> <leader>f :<C-u>CocList files<cr>
nnoremap <silent><nowait> <leader>s :<C-u>CocList grep<cr>
8 changes: 4 additions & 4 deletions .vimrc
Expand Up @@ -3,10 +3,10 @@ call plug#begin('~/.vim/plugged')

" IDE: Coc, Conquer of completion. Requires nodejs.
Plug 'neoclide/coc.nvim', {'branch': 'release',
\ 'for': ['rust', 'tex', 'markdown', 'typescript', 'solidity'],
\ 'on': 'CocInfo',
\ 'do': ':CocInstall coc-rust-analyzer coc-ltex coc-tsserver coc-solidity',
\ }
\ 'for': ['rust', 'tex', 'markdown', 'typescript', 'solidity'],
\ 'on': 'CocInfo',
\ 'do': ':CocInstall coc-rust-analyzer coc-ltex coc-tsserver coc-solidity coc-lists',
\ }
autocmd! User coc.nvim source ~/.config/nvim/coc.vim

" Theme:
Expand Down

0 comments on commit 73b7d09

Please sign in to comment.