From 9e49d43dd0c5e5d8b4c2c06c498191e7f6e43e9f Mon Sep 17 00:00:00 2001 From: davidovski Date: Fri, 3 Mar 2023 03:34:21 +0000 Subject: Add coc to vim --- config/vim/vimrc | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) (limited to 'config/vim/vimrc') diff --git a/config/vim/vimrc b/config/vim/vimrc index 15d3cc4..67eb690 100644 --- a/config/vim/vimrc +++ b/config/vim/vimrc @@ -32,3 +32,90 @@ nnoremap nnoremap nnoremap :w:!chmod+x"%:p":!"%:p" + +set foldmethod=syntax +set foldlevel=99 +set conceallevel=2 + +call plug#begin() + +Plug 'preservim/nerdtree' +nnoremap :NERDTree + +Plug 'preservim/vim-markdown' +"let g:vim_markdown_math = 1 +"let g:vim_markdown_frontmatter = 1 +"let g:vim_markdown_toml_frontmatter = 1 +"let g:vim_markdown_json_frontmatter = 1 + + +Plug 'neoclide/coc.nvim' + +set updatetime=300 +set signcolumn=yes + +nmap [g (coc-diagnostic-prev) +nmap ]g (coc-diagnostic-next) + +nmap gd (coc-definition) +nmap gy (coc-type-definition) +nmap gi (coc-implementation) +nmap gr (coc-references) + +xmap f (coc-format-selected) +nmap f (coc-format-selected) + +nmap rn (coc-rename) +nmap re (coc-codeaction-refactor) +xmap r (coc-codeaction-refactor-selected) +" nmap r (coc-codeaction-refactor-selected) + +inoremap + \ coc#pum#visible() ? coc#pum#next(1) : + \ CheckBackspace() ? "\" : + \ coc#refresh() +inoremap coc#pum#visible() ? coc#pum#prev(1) : "\" + +inoremap coc#pum#visible() ? coc#pum#confirm() + \: "\u\\=coc#on_enter()\" + +function! CheckBackspace() abort + let col = col('.') - 1 + return !col || getline('.')[col - 1] =~# '\s' +endfunction + + +if has('nvim') + inoremap coc#refresh() +else + inoremap coc#refresh() +endif + +xmap a (coc-codeaction-selected) +nmap a (coc-codeaction-selected) + +autocmd CursorHold * silent call CocActionAsync('highlight') + + +function! ShowDocumentation() + if CocAction('hasProvider', 'hover') + call CocActionAsync('doHover') + else + call feedkeys('K', 'in') + endif +endfunction + +autocmd FileType python let b:coc_root_patterns = ['.git', '.env', '.'] + +Plug 'junegunn/fzf.vim' + +nnoremap :Files +nnoremap :Rg + +Plug 'heavenshell/vim-pydocstring', { 'do': 'make install', 'for': 'python' } + +call plug#end() + +highlight Pmenu ctermbg=black guibg=black ctermfg=white + + -- cgit v1.2.1