summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian T <julian@jtle.dk>2020-12-15 21:04:44 +0100
committerJulian T <julian@jtle.dk>2020-12-15 21:04:44 +0100
commitaa9f80fca454f99f5fa24b90ffd745ca60040552 (patch)
tree055718947c0603eae0570f19268e2b9a1cf78d9f
parent4af935c9576e237b6e8f87e6a28999d8d94d012e (diff)
Vim auto complete and stuff
-rw-r--r--vim-core/.vim/vimrc12
-rw-r--r--vim-extra/.vim/extra.vim82
2 files changed, 27 insertions, 67 deletions
diff --git a/vim-core/.vim/vimrc b/vim-core/.vim/vimrc
index 43f9910..70f3382 100644
--- a/vim-core/.vim/vimrc
+++ b/vim-core/.vim/vimrc
@@ -3,7 +3,6 @@ filetype plugin on
set shellslash
runtime extra.vim
-
filetype plugin indent on " required
" General vim settings
@@ -19,6 +18,8 @@ filetype plugin indent on " required
set expandtab
set colorcolumn=80
+ set softtabstop=4
+
set autoindent
set smartindent
@@ -53,8 +54,8 @@ filetype plugin indent on " required
" Exit insert mode on inactivity
" au CursorHoldI * stopinsert
-" Formatting
- autocmd FileType go set noet
+" Language specific
+ autocmd FileType python set et
" Latex stuff
let g:tex_flavor='latex'
@@ -83,6 +84,9 @@ filetype plugin indent on " required
let g:netrw_liststyle=2
" Keymapping
+ " Tab for cycling the completion meny, in insert mode
+ inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
+
" When moving more lines make it a jump. If couns i 2 it will run m'2j,
" thus storing it on the jumplist and then jumping
nnoremap <expr> j (v:count > 1 ? "m'" . v:count : '' ) . 'j'
@@ -108,5 +112,5 @@ filetype plugin indent on " required
" Spell check
set spelllang=en
- autocmd FileType tex,markdown,rst set spell
+ " autocmd FileType mail,tex,markdown,rst set spell
diff --git a/vim-extra/.vim/extra.vim b/vim-extra/.vim/extra.vim
index 809527f..716fed2 100644
--- a/vim-extra/.vim/extra.vim
+++ b/vim-extra/.vim/extra.vim
@@ -9,8 +9,10 @@
Plugin 'VundleVim/Vundle.vim'
" Completion
- Plugin 'prabirshrestha/vim-lsp'
+ "Plugin 'Shougo/deoplete.nvim'
Plugin 'ajh17/VimCompletesMe'
+ " Plugin 'prabirshrestha/vim-lsp'
+ Plugin 'autozimu/LanguageClient-neovim'
Plugin 'Shougo/echodoc.vim'
" Installed through vim-core
@@ -59,70 +61,24 @@
let g:echodoc#type = 'virtual'
endif
- " Lsp options
- let g:lsp_signature_help_enabled = 0
- let g:lsp_insert_text_enabled = 0
- let g:lsp_virtual_text_enabled = 0
- let g:lsp_diagnostics_echo_cursor = 1
- let g:lsp_highlights_enabled = 0
- let g:lsp_textprop_enabled = 0
- let g:lsp_signs_enabled = 1
+ "let g:deoplete#enable_at_startup = 1
+ "let g:deoplete#disable_auto_complete = 1
+
+ let b:vcm_tab_complete = 'omni'
" Close completion window
autocmd CompleteDone * pclose
- " Setup lsp servers
- if executable('clangd')
- au User lsp_setup call lsp#register_server({
- \ 'name': 'clangd',
- \ 'cmd': {server_info->['clangd']},
- \ 'whitelist': ['c', 'cpp'],
- \ })
- endif
- if executable('pyls')
- au User lsp_setup call lsp#register_server({
- \ 'name': 'pyls',
- \ 'cmd': {server_info->['pyls']},
- \ 'whitelist': ['py', 'python'],
- \ })
- endif
- if executable('gopls')
- au User lsp_setup call lsp#register_server({
- \ 'name': 'golang',
- \ 'cmd': {server_info->['gopls']},
- \ 'whitelist': ['go'],
- \ })
- endif
- if executable('rls')
- au User lsp_setup call lsp#register_server({
- \ 'name': 'rust',
- \ 'cmd': {server_info->['rls']},
- \ 'whitelist': ['rust', 'rs'],
- \ })
- endif
- if executable('solargraph')
- au User lsp_setup call lsp#register_server({
- \ 'name': 'ruby',
- \ 'cmd': {server_info->['solargraph', 'stdio']},
- \ 'whitelist': ['ruby', 'rb'],
- \ })
- endif
-
- " Enable csp if available, stolen from lsp github
- function! s:on_lsp_buffer_enabled() abort
- echo "Enabling lsp"
- set omnifunc=lsp#complete
- let b:vcm_tab_complete = 'omni'
- set signcolumn=yes
- nmap <buffer> gd <plug>(lsp-definition)
- nmap <buffer> <f2> <plug>(lsp-rename)
- nmap <buffer> zF <plug>(lsp-code-action)
- " refer to doc to add more commands
- endfunction
-
- augroup lsp_install
- au!
- " call s:on_lsp_buffer_enabled only for languages that has the server registered.
- autocmd User lsp_buffer_enabled call s:on_lsp_buffer_enabled()
- augroup END
+ " Lsp options
+ " let g:LanguageClient_setOmnifunc = 1
+ let g:LanguageClient_hoverPreview = "Never"
+ let g:LanguageClient_useVirtualText = "No"
+ " Setup lsp servers
+ let g:LanguageClient_serverCommands = {
+ \ 'c' : ['clangd'],
+ \ 'cpp' : ['clangd'],
+ \ 'python' : ['pyls'],
+ \ 'go' : ['gopls'],
+ \ 'rust' : ['rls'],
+ \ }