2024-08-22 05:33:31 -04:00
|
|
|
colorscheme ron
|
2024-08-21 04:08:00 -04:00
|
|
|
set viminfo+=n~/.config/vim/viminfo
|
2024-08-22 05:33:31 -04:00
|
|
|
set omnifunc=syntaxcomplete#Complete
|
|
|
|
set gp=git\ grep\ -n
|
|
|
|
set relativenumber number
|
|
|
|
set clipboard+=unnamedplus
|
|
|
|
set wildmenu
|
|
|
|
set hidden
|
|
|
|
|
|
|
|
filetype plugin on
|
|
|
|
syntax on
|
|
|
|
|
|
|
|
inoremap jj <Esc>
|
2024-08-21 04:08:00 -04:00
|
|
|
noremap <Up> <Nop>
|
|
|
|
noremap <Down> <Nop>
|
|
|
|
noremap <Left> <Nop>
|
|
|
|
noremap <Right> <Nop>
|
|
|
|
inoremap <Up> <Nop>
|
|
|
|
inoremap <Down> <Nop>
|
|
|
|
inoremap <Left> <Nop>
|
|
|
|
inoremap <Right> <Nop>
|
2024-08-22 05:33:31 -04:00
|
|
|
|
|
|
|
call plug#begin()
|
|
|
|
|
|
|
|
Plug 'prabirshrestha/vim-lsp'
|
|
|
|
Plug 'dense-analysis/ale'
|
|
|
|
|
|
|
|
call plug#end()
|
|
|
|
|
|
|
|
if executable('pylsp')
|
|
|
|
" pip install python-lsp-server
|
|
|
|
au User lsp_setup call lsp#register_server({
|
|
|
|
\ 'name': 'pylsp',
|
|
|
|
\ 'cmd': {server_info->['pylsp']},
|
|
|
|
\ 'allowlist': ['python'],
|
|
|
|
\ })
|
|
|
|
endif
|
|
|
|
|
|
|
|
function! s:on_lsp_buffer_enabled() abort
|
|
|
|
setlocal omnifunc=lsp#complete
|
|
|
|
setlocal signcolumn=yes
|
|
|
|
if exists('+tagfunc') | setlocal tagfunc=lsp#tagfunc | endif
|
|
|
|
nmap <buffer> gd <plug>(lsp-definition)
|
|
|
|
nmap <buffer> gs <plug>(lsp-document-symbol-search)
|
|
|
|
nmap <buffer> gS <plug>(lsp-workspace-symbol-search)
|
|
|
|
nmap <buffer> gr <plug>(lsp-references)
|
|
|
|
nmap <buffer> gi <plug>(lsp-implementation)
|
|
|
|
nmap <buffer> gt <plug>(lsp-type-definition)
|
|
|
|
nmap <buffer> <leader>rn <plug>(lsp-rename)
|
|
|
|
nmap <buffer> [g <plug>(lsp-previous-diagnostic)
|
|
|
|
nmap <buffer> ]g <plug>(lsp-next-diagnostic)
|
|
|
|
nmap <buffer> K <plug>(lsp-hover)
|
|
|
|
nnoremap <buffer> <expr><c-f> lsp#scroll(+4)
|
|
|
|
nnoremap <buffer> <expr><c-d> lsp#scroll(-4)
|
|
|
|
|
|
|
|
let g:lsp_format_sync_timeout = 1000
|
|
|
|
autocmd! BufWritePre *.rs,*.go call execute('LspDocumentFormatSync')
|
|
|
|
|
|
|
|
" 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
|
|
|
|
|
|
|
|
let g:lsp_diagnostics_echo_cursor = 1
|
|
|
|
let g:ale_completion_enabled = 1
|
|
|
|
let g:ale_lsp_suggestions = 1
|