" ---------------------------------------------------------------------------- " vundle essentials " ---------------------------------------------------------------------------- set nocompatible filetype off " set the runtime path to include Vundle and initialize set rtp+=~/.vim/bundle/Vundle.vim call vundle#begin() " let vundle manage vundle... Plugin 'VundleVim/Vundle.vim' " Basic plugins Plugin 'jiangmiao/auto-pairs' Plugin 'preservim/nerdtree' Plugin 'jeetsukumaran/vim-buffergator' " IDE like plugins Plugin 'prabirshrestha/vim-lsp' Plugin 'prabirshrestha/asyncomplete.vim' Plugin 'prabirshrestha/asyncomplete-lsp.vim' Plugin 'mattn/vim-lsp-settings' "Plugin 'yami-beta/asyncomplete-omni.vim' Plugin 'prabirshrestha/asyncomplete-file.vim' Plugin 'dense-analysis/ale' Plugin 'rhysd/vim-lsp-ale' " Language autocomplete for English Plugin 'htlsne/asyncomplete-look' " an additional colorscheme I like Plugin 'altercation/vim-colors-solarized' " a nice statusbar Plugin 'vim-airline/vim-airline' Plugin 'vim-airline/vim-airline-themes' " no load my personal plugins let _plugins_list = _vimrc_dir . "/" . $USER . "_plugins.list" if filereadable(_plugins_list) "echomsg "found user plugins " . _plugins_list execute 'source '.fnameescape(_plugins_list) endif call vundle#end() filetype plugin indent on " ---------------------------------------------------------------------------- " plugin configuration " ---------------------------------------------------------------------------- " NERDTree " -------- " map a keyboard shortcut to show and hide NERDTree nnoremap :NERDTreeToggle " Exit Vim if NERDTree is the only window remaining in the only tab. autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif " vim-lsp " ------- " general vim-lsp settings " ------------------------ " maps quite q few keyboad shortcuts " this is taken staight off the github page with one added shortcut to peak at " the definition of a function or class function! s:on_lsp_buffer_enabled() abort setlocal omnifunc=lsp#complete "setlocal signcolumn=no " messes with some autocomplete! if exists('+tagfunc') | setlocal tagfunc=lsp#tagfunc | endif nmap gd (lsp-definition) nmap gpd (lsp-peek-definition) nmap gs (lsp-document-symbol-search) nmap gS (lsp-workspace-symbol-search) nmap gr (lsp-references) nmap gi (lsp-implementation) nmap gt (lsp-type-definition) nmap rn (lsp-rename) nmap [g (lsp-previous-diagnostic) nmap ]g (lsp-next-diagnostic) nmap K (lsp-hover) inoremap lsp#scroll(+4) inoremap lsp#scroll(-4) let g:lsp_format_sync_timeout = 2000 autocmd! BufWritePre *.rs,*.go call execute('LspDocumentFormatSync') 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 " asyncomplete " ------------ " make tab complete work inoremap pumvisible() ? "\" : "\" inoremap pumvisible() ? "\" : "\" inoremap pumvisible() ? asyncomplete#close_popup() : "\" " force refresh with CTRL-SPACE imap (asyncomplete_force_refresh) " asyncomplete-file " ----------------- au User asyncomplete_setup call asyncomplete#register_source(asyncomplete#sources#file#get_source_options({ \ 'name': 'file', \ 'allowlist': ['*'], \ 'priority': 10, \ 'completor': function('asyncomplete#sources#file#completor') \ })) " asyncomplete-omni " ----------------- "autocmd User asyncomplete_setup call asyncomplete#register_source(asyncomplete#sources#omni#get_source_options({ " \ 'name': 'omni', " \ 'allowlist': ['*'], " \ 'blocklist': ['c', 'cpp', 'html'], " \ 'completor': function('asyncomplete#sources#omni#completor'), " \ 'config': { " \ 'show_source_kind': 1, " \ }, " \ })) " asyncomplete-look " ----------------- au User asyncomplete_setup call asyncomplete#register_source({ \ 'name': 'look', \ 'allowlist': ['text', 'markdown'], \ 'completor': function('asyncomplete#sources#look#completor'), \ }) " source the additional config let _plugins_list = _vimrc_dir . "/" . $USER . "_plugins.vimrc" if filereadable(_plugins_list) "echomsg "found user plugin configuration " . _plugins_list execute 'source '.fnameescape(_plugins_list) endif