From 52691520e86431299e891130ed45504eacee44fe Mon Sep 17 00:00:00 2001 From: Sijmen Schoon Date: Wed, 12 Aug 2020 00:18:22 +0200 Subject: [PATCH] nvim: coc hype --- config/nvim/init.vim | 85 ++++++++++++++++++++++++++++++-------------- 1 file changed, 59 insertions(+), 26 deletions(-) diff --git a/config/nvim/init.vim b/config/nvim/init.vim index 510ac40..4f5bcc3 100644 --- a/config/nvim/init.vim +++ b/config/nvim/init.vim @@ -21,18 +21,17 @@ Plug 'Yggdroot/indentLine' Plug 'rakr/vim-one' " Programming helpers -Plug 'Chiel92/vim-autoformat' -Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } +"Plug 'dense-analysis/ale' +"Plug 'deoplete-plugins/deoplete-jedi' +"Plug 'sebastianmarkow/deoplete-rust' +"Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } Plug 'bkad/CamelCaseMotion' -Plug 'ctrlpvim/ctrlp.vim' -Plug 'dense-analysis/ale' -Plug 'deoplete-plugins/deoplete-jedi' +Plug 'Chiel92/vim-autoformat' Plug 'easymotion/vim-easymotion' Plug 'godlygeek/tabular' Plug 'junegunn/vim-easy-align' -Plug 'keith/swift.vim' Plug 'majutsushi/tagbar' -Plug 'sebastianmarkow/deoplete-rust' +Plug 'neoclide/coc.nvim', {'branch': 'release'} Plug 'tpope/vim-commentary' Plug 'tpope/vim-eunuch' Plug 'tpope/vim-fugitive' @@ -51,12 +50,14 @@ Plug 'evanleck/vim-svelte' Plug 'gryf/kickass-syntax-vim' Plug 'hiphish/jinja.vim' Plug 'hsanson/vim-android' +Plug 'jceb/vim-orgmode' +Plug 'keith/swift.vim' Plug 'leafgarland/typescript-vim' Plug 'lervag/vimtex' Plug 'martinda/Jenkinsfile-vim-syntax' Plug 'MaxMEllon/vim-jsx-pretty' -Plug 'othree/yajs.vim' Plug 'mitsuhiko/vim-jinja' +Plug 'othree/yajs.vim' Plug 'peitalin/vim-jsx-typescript' Plug 'plasticboy/vim-markdown' Plug 'posva/vim-vue' @@ -64,8 +65,6 @@ Plug 'rust-lang/rust.vim' Plug 'tikhomirov/vim-glsl' Plug 'udalov/kotlin-vim' Plug 'ziglang/zig.vim' -Plug 'jceb/vim-orgmode' -Plug 'fatih/vim-go' call plug#end() @@ -87,6 +86,7 @@ let &colorcolumn="+".join(range(1, 255), ",+") set termguicolors nnoremap :buffers:buffer let maplocalleader="\" +let mapleader="," " Tagbar nmap :TagbarOpenAutoClose @@ -232,24 +232,24 @@ map :NERDTreeToggle autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif """ Deoplete -let g:deoplete#enable_at_startup = 1 -call deoplete#custom#option('omni_patterns', { 'go': '[^. *\t]\.\w*' }) +"let g:deoplete#enable_at_startup = 1 +"call deoplete#custom#option('omni_patterns', { 'go': '[^. *\t]\.\w*' }) """ ale -let g:ale_linters = { 'python': ['flake8', 'mypy'], 'go': ['gopls'], 'cpp': ['clangcheck'] } -let g:ale_fixers = { - \ 'python': ['black'], - \ 'cpp': ['clang-format'], - \ 'javascript': ['eslint', 'prettier'], - \ 'yaml': ['prettier'], - \ 'go': ['gofmt', 'goimports'], - \ } -let g:ale_python_flake8_options='--max-line-length=88' -let g:ale_python_mypy_options='--ignore-missing-imports' -let g:ale_c_parse_compile_commands = 1 -let g:ale_c_build_dir_names = ['build', 'bin', '.'] -let g:ale_completion_enabled = 0 -set omnifunc=ale#completion#OmniFunc +"let g:ale_linters = { 'python': ['flake8', 'mypy'], 'go': ['gopls'], 'cpp': ['clangcheck'] } +"let g:ale_fixers = { + "\ 'python': ['black'], + "\ 'cpp': ['clang-format'], + "\ 'javascript': ['eslint', 'prettier'], + "\ 'yaml': ['prettier'], + "\ 'go': ['gofmt', 'goimports'], + "\ } +"let g:ale_python_flake8_options='--max-line-length=88' +"let g:ale_python_mypy_options='--ignore-missing-imports' +"let g:ale_c_parse_compile_commands = 1 +"let g:ale_c_build_dir_names = ['build', 'bin', '.'] +"let g:ale_completion_enabled = 0 +"set omnifunc=ale#completion#OmniFunc " Python if executable('pyls') @@ -307,3 +307,36 @@ let g:easy_align_delimiters = { """ vim-go let g:go_imports_autosave = 1 let g:go_auto_type_info = 1 + +""" coc +function! s:cocActionsOpenFromSelected(type) abort + execute 'CocCommand actions.open ' . a:type +endfunction +xmap c :execute 'CocCommand actions.open ' . visualmode() +nmap c :set operatorfunc=cocActionsOpenFromSelectedg@ + +nmap select_current_word() +function! s:select_current_word() + if !get(g:, 'coc_cursors_activated', 0) + return "\(coc-cursors-word)" + endif + return "*\(coc-cursors-word):nohlsearch\" +endfunc + +nmap rn (coc-rename) +xmap a (coc-codeaction-selected) +nmap a (coc-codeaction-selected) +nmap ac (coc-codeaction) +nmap qf (coc-fix-current) + +nmap gd (coc-definition) +nmap gy (coc-type-definition) +nmap gi (coc-implementation) +nmap gr (coc-references) + +command! -nargs=0 Format :call CocAction('format') +command! -nargs=? Fold :call CocAction('fold', ) +command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport') + +""" ctrlp +let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files -co --exclude-standard']