-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
241 lines (203 loc) · 5.92 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
" Alacritty color fix
if &term == "alacritty"
let &term = "xterm-256color"
endif
" new dir for temp and swap files
set backupdir=~/vimtmp//,.
set directory=~/vimtmp//,.
" Auto plugin install for plug
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
" vim-plug: {{{
call plug#begin('~/.vim/plugged')
Plug 'omnisharp/omnisharp-vim'
" Mappings, code-actions available flag and statusline integration
Plug 'nickspoons/vim-sharpenup'
" Linting/error highlighting
Plug 'dense-analysis/ale'
" Vim FZF integration, used as OmniSharp selector
Plug 'junegunn/fzf'
Plug 'junegunn/fzf.vim'
" Colorscheme
Plug 'gruvbox-community/gruvbox'
" Statusline
Plug 'itchyny/lightline.vim'
Plug 'shinchu/lightline-gruvbox.vim'
Plug 'maximbaz/lightline-ale'
" Pairing brackets etc
Plug 'jiangmiao/auto-pairs'
" Snippets
Plug 'sirver/ultisnips'
Plug 'honza/vim-snippets'
" had to add this plugin cuz utils break sessions.
Plug 'tpope/vim-obsession'
" Autocompletion
Plug 'prabirshrestha/asyncomplete.vim'
" Xml commenting for c#
Plug 'jpfeiffer16/angeldoc-vim'
nnoremap /// :call AngelDoc#InsertXmlDoc()<CR>
call plug#end()
" }}}
" Settings: {{{
filetype indent plugin on
if !exists('g:syntax_on') | syntax enable | endif
set encoding=utf-8
scriptencoding utf-8
set completeopt=menuone,noinsert,noselect,popuphidden
set completepopup=highlight:Pmenu,border:off
set backspace=indent,eol,start
set expandtab
set shiftround
set shiftwidth=4
set softtabstop=-1
set tabstop=8
set textwidth=80
set title
set hidden
set nofixendofline
set nostartofline
set splitbelow
set splitright
set hlsearch
set incsearch
set laststatus=2
set noruler
set noshowmode
set signcolumn=yes
set mouse=a
set updatetime=1000
set cindent
set number
" Set space key to nothing
nnoremap <SPACE> <Nop>
" Make space into leader
let mapleader = "\<Space>"
" Selects all text in file
map <Leader>a ggVG
" }}}
" Ultisnips: {{{
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
" }}}
" Colors: {{{
augroup ColorschemePreferences
autocmd!
" These preferences clear some gruvbox background colours, allowing transparency
autocmd ColorScheme * highlight Normal ctermbg=NONE guibg=NONE
autocmd ColorScheme * highlight SignColumn ctermbg=NONE guibg=NONE
autocmd ColorScheme * highlight Todo ctermbg=NONE guibg=NONE
" Link ALE sign highlights to similar equivalents without background colours
autocmd ColorScheme * highlight link ALEErrorSign WarningMsg
autocmd ColorScheme * highlight link ALEWarningSign ModeMsg
autocmd ColorScheme * highlight link ALEInfoSign Identifier
augroup END
" Use truecolor in the terminal, when it is supported
if has('termguicolors')
set termguicolors
endif
set background=dark
colorscheme gruvbox
" }}}
" ALE: {{{
let g:ale_sign_error = '•'
let g:ale_sign_warning = '•'
let g:ale_sign_info = '·'
let g:ale_sign_style_error = '·'
let g:ale_sign_style_warning = '·'
let g:ale_linters = { 'cs': ['OmniSharp'] }
highlight clear ALEErrorSign
highlight clear ALEWarningSign
" }}}
" Asyncomplete: {{{
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
inoremap <expr> <cr> pumvisible() ? asyncomplete#close_popup() : "\<cr>"
let g:asyncomplete_auto_popup = 1
let g:asyncomplete_auto_completeopt = 0
" }}}
" Sharpenup: {{{
" All sharpenup mappings will begin with `<leader>`, e.g. `<leader>gd` for
" :OmniSharpGotoDefinition
let g:sharpenup_map_prefix = '<leader>'
let g:sharpenup_statusline_opts = { 'Text': '%s (%p/%P)' }
let g:sharpenup_statusline_opts.Highlight = 0
augroup OmniSharpIntegrations
autocmd!
autocmd User OmniSharpProjectUpdated,OmniSharpReady call lightline#update()
augroup END
" }}}
" Lightline: {{{
let g:lightline = {
\ 'colorscheme': 'gruvbox',
\ 'active': {
\ 'right': [
\ ['linter_checking', 'linter_errors', 'linter_warnings', 'linter_infos', 'linter_ok'],
\ ['lineinfo'], ['percent'],
\ ['fileformat', 'fileencoding', 'filetype', 'sharpenup']
\ ]
\ },
\ 'inactive': {
\ 'right': [['lineinfo'], ['percent'], ['sharpenup']]
\ },
\ 'component': {
\ 'sharpenup': sharpenup#statusline#Build()
\ },
\ 'component_expand': {
\ 'linter_checking': 'lightline#ale#checking',
\ 'linter_infos': 'lightline#ale#infos',
\ 'linter_warnings': 'lightline#ale#warnings',
\ 'linter_errors': 'lightline#ale#errors',
\ 'linter_ok': 'lightline#ale#ok'
\ },
\ 'component_type': {
\ 'linter_checking': 'right',
\ 'linter_infos': 'right',
\ 'linter_warnings': 'warning',
\ 'linter_errors': 'error',
\ 'linter_ok': 'right'
\ }
\}
" Use unicode chars for ale indicators in the statusline
let g:lightline#ale#indicator_checking = "\uf110 "
let g:lightline#ale#indicator_infos = "\uf129 "
let g:lightline#ale#indicator_warnings = "\uf071 "
let g:lightline#ale#indicator_errors = "\uf05e "
let g:lightline#ale#indicator_ok = "\uf00c "
" }}}
" OmniSharp: {{{
let g:OmniSharp_popup_position = 'peek'
if has('nvim')
let g:OmniSharp_popup_options = {
\ 'winhl': 'Normal:NormalFloat'
\}
else
let g:OmniSharp_popup_options = {
\ 'highlight': 'Normal',
\ 'padding': [0, 0, 0, 0],
\ 'border': [1]
\}
endif
let g:OmniSharp_popup_mappings = {
\ 'sigNext': '<C-n>',
\ 'sigPrev': '<C-p>',
\ 'pageDown': ['<C-f>', '<PageDown>'],
\ 'pageUp': ['<C-b>', '<PageUp>']
\}
let g:OmniSharp_want_snippet = 1
let g:OmniSharp_highlight_groups = {
\ 'ExcludedCode': 'NonText'
\}
" }}}
hi clear ModeMsg gui=underline
hi ModeMsg gui=underline
hi clear Identifier gui=underline
hi Identifier gui=underline
hi clear WarningMsg gui=underline
hi WarningMsg gui=underline
hi clear GruvboxYellowUnderline
hi GruvboxYellowUnderline gui=underline term=underline cterm=underline guifg=NONE guibg=NONE
let g:ale_set_highlights = 0