-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
87 lines (72 loc) · 2.26 KB
/
.vimrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
" Settings
set cursorline
set gp=git\ grep\ -n
set guioptions-=T guioptions-=m guioptions-=r
set hidden
set incsearch hlsearch ignorecase
set nocompatible
set number relativenumber
set path+=**
set ruler
set expandtab tabstop=4 softtabstop=4 shiftwidth=4 smarttab
set signcolumn=yes
set smartcase
set timeoutlen=20
set wildmenu
set termguicolors
" set spell
let g:lsp_diagnostics_virtual_text_align = "right"
syntax on
filetype plugin indent on
" Undofile Options
if !isdirectory($HOME."/.cache/vim-undodir")
call mkdir($HOME."/.cache/vim-undodir", "", 0700)
endif
set undodir=~/.cache/vim-undodir
set undofile
"""""" Autocommands """""
" Remove trailing whitespace
autocmd BufWritePre * %s/\s\+$//e
" Detect Helm templates as helm filetype
autocmd BufRead,BufNewFile */templates/*.y*ml,*/templates/*.tpl set filetype=helm
" Define syntax and indentation for helm filetype
augroup helm_syntax
autocmd!
autocmd FileType helm setlocal syntax=yaml
augroup END
"""""" Plugins """""
packadd! matchit
let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim'
if empty(glob(data_dir . '/autoload/plug.vim'))
silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call plug#begin()
" LSP
Plug 'prabirshrestha/vim-lsp'
Plug 'mattn/vim-lsp-settings'
" Colorscheme
Plug 'ericbn/vim-solarized'
call plug#end()
function! OnLspBufferEnabled() abort
setlocal omnifunc=lsp#complete
nmap <buffer> gi <plug>(lsp-definition)
nmap <buffer> gd <plug>(lsp-declaration)
nmap <buffer> gR <plug>(lsp-references)
nmap <buffer> gl <plug>(lsp-document-diagnostics)
nmap <buffer> gd <plug>(lsp-definition)
nmap <buffer> K <plug>(lsp-hover)
nmap <buffer> gs <plug>(lsp-document-symbol-search)
nmap <buffer> gS <plug>(lsp-workspace-symbol-search)
nmap <buffer> <f2> <plug>(lsp-rename)
nmap <buffer> [g <plug>(lsp-previous-diagnostic)
nmap <buffer> ]g <plug>(lsp-next-diagnostic)
nmap <buffer> K <plug>(lsp-hover)
endfunction
augroup lsp_install
au!
autocmd User lsp_buffer_enabled call OnLspBufferEnabled()
augroup END
"""""" Colorscheme """""
set background=dark
silent! colorscheme solarized