summary refs log tree commit diff
diff options
context:
space:
mode:
authorRobert Günzler <r@gnzler.io>2020-05-25 17:43:31 +0200
committerRobert Günzler <r@gnzler.io>2020-05-25 17:43:31 +0200
commit4d467775057808e793df696ce2569f15927a5286 (patch)
tree368275b831d01918c815949ee8ea5a6ec149c54a
parentf71a4833e4574b017c2f33a9b0eae1b4ef8e7b33 (diff)
vim: use nvim-lsp + completion-nvim instead of coc
-rw-r--r--.vim/after/plugin/coc.vim2
-rw-r--r--.vim/after/plugin/lsp.vim27
-rw-r--r--.vim/init.vim8
-rw-r--r--.vim/plug.vim11
4 files changed, 30 insertions, 18 deletions
diff --git a/.vim/after/plugin/coc.vim b/.vim/after/plugin/coc.vim
index 2ebe27a..c0e8f38 100644
--- a/.vim/after/plugin/coc.vim
+++ b/.vim/after/plugin/coc.vim
@@ -1,4 +1,6 @@
 " coc json config -> ../../coc-settings.json
+finish
+
 if !exists('g:did_coc_loaded')
   finish
 endif
diff --git a/.vim/after/plugin/lsp.vim b/.vim/after/plugin/lsp.vim
index d31886a..ffdea10 100644
--- a/.vim/after/plugin/lsp.vim
+++ b/.vim/after/plugin/lsp.vim
@@ -1,18 +1,21 @@
-" if !has('nvim-0.5.0')
-"   echoerr 'nvim_lsp only works with neovim>=0.5.0'
-"   finish
-" endif
-finish
+if !has('nvim-0.5.0')
+  " echoerr 'nvim_lsp only works with neovim>=0.5.0'
+  finish
+endif
 
-silent LspInstall bashls
-silent LspInstall cssls
+lua << EOF
+local lsp   = require 'nvim_lsp'
+local util  = require 'nvim_lsp/util'
+local compl = require 'completion'
 
-" call nvim_lsp#setup("gopls", {})
-call nvim_lsp#setup("pyls", {})
-call nvim_lsp#setup("rust_analyzer", {})
-call nvim_lsp#setup("texlab", {})
+lsp.gopls.setup{
+  on_attach = compl.on_attach;
+  root_dir = util.root_pattern("go.mod");
+}
+EOF
 
-autocmd Filetype bash,shell,css,go,python,rust,tex,latex setl omnifunc=lsp#omnifunc
+" autocmd Filetype bash,shell,css,go,python,rust,tex,latex setl omnifunc=lsp#omnifunc
+" au Filetype lua setl omnifunc=v:lua.vim.lsp.omnifunc
 
 nnoremap <silent> gd  :call lsp#text_document_definition()<CR>
 nnoremap <silent> gdc :call lsp#text_document_declaration()<CR>
diff --git a/.vim/init.vim b/.vim/init.vim
index 14fad32..c08e6b0 100644
--- a/.vim/init.vim
+++ b/.vim/init.vim
@@ -228,7 +228,7 @@ let g:neoformat_only_msg_on_error = 1
 let g:neoterm_size = 20
 let g:neoterm_autoinsert = 1
 
-let g:UltiSnipsExpandTrigger = "<tab>"
+let g:UltiSnipsExpandTrigger = "<c-y>"
 let g:UltiSnipsJumpForwardTrigger = "<c-n>"
 let g:UltiSnipsJumpBackwardTrigger = "<c-p>"
 " }}}1
@@ -249,6 +249,11 @@ function! s:fmt() abort
   try | undojoin | Neoformat | catch /^Vim\%((\a\+)\)\=:E790/ | finally | silent Neoformat | endtry
 endfunction
 
+augroup DoFmt
+  au!
+  au BufWritePre * :call <SID>fmt()
+augroup END
+
 " autogroups {{{
 augroup SpecialBuffers
   au!
@@ -270,7 +275,6 @@ augroup init
   au VimEnter * if &diff | runtime after/ftplugin/diff.vim | endif
 
   au BufEnter,BufLeave,BufWritePost * rshada|wshada
-  " au BufWritePre * :call <SID>fmt()
   " au FileType dirvish call fugitive#detect(@%)
   au BufReadPost *
 	\ if line("'\"") > 1 && line("'\"") <= line("$") && &ft !~# 'commit'
diff --git a/.vim/plug.vim b/.vim/plug.vim
index 165f16f..01302af 100644
--- a/.vim/plug.vim
+++ b/.vim/plug.vim
@@ -19,7 +19,11 @@ call plug#begin('~/.vim/plugged')
   Plug 'justinmk/vim-dirvish'   " folder browser
   Plug 'justinmk/vim-sneak'     " powerful missing vim motions
 
-  " Plug 'neovim/nvim-lsp'
+  if has('nvim-0.5.0')
+    Plug 'neovim/nvim-lsp'
+    Plug 'haorenW1025/completion-nvim'
+  endif
+
   Plug 'SirVer/ultisnips'
     \| Plug 'honza/vim-snippets'
 
@@ -62,8 +66,7 @@ call plug#begin('~/.vim/plugged')
   Plug 'rhysd/git-messenger.vim'         " git-blame in a popup
   Plug 'bling/vim-bufferline'            " needed to put buffers into tabline
 
-  Plug 'kassio/neoterm',
-    \ { 'on': ['T', 'Tnew'] }
+  Plug 'kassio/neoterm'
 
 " Languages
   " NOTE: these should only be loaded when they are required...
@@ -73,7 +76,7 @@ call plug#begin('~/.vim/plugged')
   Plug 'plasticboy/vim-markdown', { 'for': ['markdown'] }
   Plug 'masukomi/vim-markdown-folding', { 'for': ['markdown'] }
   Plug 'mattn/emmet-vim',         { 'for': ['html', 'vue'] }        " super-fast HTML editing
-  Plug 'valloric/matchtagalways', { 'for': ['html', 'vue', 'xml'] } " visually match HTML tags enclosing cursor location
+  " Plug 'valloric/matchtagalways', { 'for': ['html', 'vue', 'xml'] } " visually match HTML tags enclosing cursor location
   Plug 'ledger/vim-ledger',       { 'for': ['ledger'] }
   Plug 'jceb/vim-orgmode',        { 'for': ['org'] }
     \| Plug 'tpope/vim-speeddating'  " easy time/date incrementing