116 lines
3.9 KiB
VimL
116 lines
3.9 KiB
VimL
set nocompatible " be iMproved, required
|
|
filetype off " required
|
|
|
|
" set the runtime path to include Vundle and initialize
|
|
set rtp+=~/.vim/bundle/Vundle.vim
|
|
call vundle#begin()
|
|
" alternatively, pass a path where Vundle should install plugins
|
|
"call vundle#begin('~/some/path/here')
|
|
|
|
" let Vundle manage Vundle, required
|
|
Plugin 'VundleVim/Vundle.vim'
|
|
|
|
" Pretty
|
|
Plugin 'itchyny/lightline.vim'
|
|
"Plug 'morhetz/gruvbox'
|
|
Plugin 'ShowTrailingWhitespace'
|
|
Plugin 'Yggdroot/indentLine'
|
|
|
|
" Functional
|
|
Plugin 'tpope/vim-fugitive'
|
|
Plugin 'jiangmiao/auto-pairs'
|
|
Plugin 'tpope/vim-surround'
|
|
Plugin 'dhruvasagar/vim-dotoo'
|
|
Plugin 'sheerun/vim-polyglot'
|
|
" Language C++/glsl
|
|
"Plugin 'ycm-core/YouCompleteMe'
|
|
Plugin 'prabirshrestha/vim-lsp'
|
|
Plugin 'mattn/vim-lsp-settings'
|
|
Plugin 'prabirshrestha/asyncomplete.vim'
|
|
Plugin 'tikhomirov/vim-glsl'
|
|
|
|
|
|
" All of your Plugins must be added before the following line
|
|
call vundle#end() " required
|
|
filetype plugin indent on " required
|
|
" To ignore plugin indent changes, instead use:
|
|
"filetype plugin on
|
|
"
|
|
" Brief help
|
|
" :PluginList - lists configured plugins
|
|
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
|
|
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
|
|
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
|
|
"
|
|
" see :h vundle for more details or wiki for FAQ
|
|
" Put your non-Plugin stuff after this line
|
|
|
|
" Tab completion
|
|
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
|
|
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
|
|
inoremap <expr> <cr> pumvisible() ? asyncomplete#close_popup() : "\<cr>"
|
|
|
|
" clangd vim lsp
|
|
let g:lsp_settings = {
|
|
\ 'clangd': {'cmd': ['clangd-8']},
|
|
\ 'efm-langserver': {'disabled': v:false}
|
|
\}
|
|
|
|
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> gj <plug>(lsp-document-diagnostics)
|
|
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)
|
|
|
|
let g:lsp_format_sync_timeout = 1000
|
|
autocmd! BufWritePre *.rs,*.go,*.cpp,*.c,*.h,*.cs 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
|
|
|
|
" C++ Clangd if installed on system already
|
|
if executable('clangd')
|
|
augroup lsp_clangd
|
|
autocmd!
|
|
autocmd User lsp_setup call lsp#register_server({
|
|
\ 'name': 'clangd',
|
|
\ 'cmd': {server_info->['clangd']},
|
|
\ 'whitelist': ['h', 'c', 'cpp', 'objc', 'objcpp'],
|
|
\ })
|
|
autocmd FileType c setlocal omnifunc=lsp#complete
|
|
autocmd FileType cpp setlocal omnifunc=lsp#complete
|
|
autocmd FileType objc setlocal omnifunc=lsp#complete
|
|
autocmd FileType objcpp setlocal omnifunc=lsp#complete
|
|
augroup end
|
|
endif
|
|
|
|
" GLSL
|
|
autocmd! BufNewFile,BufRead *.vs,*.fs,*.glsl,*.frag,*.vert set ft=glsl
|
|
|
|
" dotoo
|
|
let g:dotoo#agenda#files = ['~/org/*.org']
|
|
let g:dotoo#capture#refile = expand('~/org/refile.org')
|
|
autocmd! BufNewFile,BufRead *.org set filetype=dotoo
|
|
augroup dotoo
|
|
autocmd!
|
|
autocmd BufNewFile,BufRead *.org *.dotoo set hidden
|
|
autocmd FileType dotoo,org,tex,text setlocal textwidth=80
|
|
autocmd FileType dotoo,org,tex,text setlocal spell spelllang=en_gb
|
|
|
|
augroup END
|