/
vimrc
268 lines (224 loc) · 7.03 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
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
" Specify a directory for plugins
" - For Neovim: stdpath('data') . '/plugged'
" - Avoid using standard Vim directory names like 'plugin'
let s:using_snippets = 1
" vim-plug: {{{
call plug#begin('~/.vim/plugged')
" Make sure you use single quotes
" Unmanaged plugin (manually installed and updated)
Plug '~/my-prototype-plugin'
" Rust
Plug 'rust-lang/rust.vim'
" bpftrace
Plug 'mmarchini/bpftrace.vim'
" python
Plug 'davidhalter/jedi-vim'
" go
Plug 'fatih/vim-go',{ 'do': ':GoUpdateBinaries' }
" C#
" Set this to 1 to use ultisnips for snippet handling
let s:using_snippets = 1
" 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'
" Autocompletion
Plug 'prabirshrestha/asyncomplete.vim'
" Colorscheme
Plug 'gruvbox-community/gruvbox'
" Statusline
Plug 'itchyny/lightline.vim'
Plug 'shinchu/lightline-gruvbox.vim'
Plug 'maximbaz/lightline-ale'
" Snippet support
if s:using_snippets
Plug 'sirver/ultisnips'
endif
"" indent
Plug 'nathanaelkane/vim-indent-guides'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
call plug#end()
" }}}
" Settings: {{{
filetype indent plugin on
if !exists('g:syntax_on') | syntax enable | endif
set encoding=utf-8
scriptencoding utf-8
syntax enable
set completeopt=menu,menuone,preview,noinsert,noselect,popuphidden
set completepopup=highlight:Pmenu,border:off
set backspace=indent,eol,start
set expandtab
set shiftround
set textwidth=80
set title
set hidden
set nofixendofline
set nostartofline
set splitbelow
set splitright
set hlsearch
set incsearch
set laststatus=2
set nonumber
set noruler
set noshowmode
set signcolumn=yes
set mouse=a
set updatetime=1000
" }}}
" 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_completion_enabled = 1
let g:ale_linters = { 'cs': ['OmniSharp'], 'rust': ['analyzer'] }
let g:ale_fixers = { 'rust': ['rustfmt', 'trim_whitespace', 'remove_trailing_lines'] }
" rust
let g:rustfmt_autosave = 1
let g:ale_rust_cargo_use_clippy = 1
let g:syntastic_rust_checkers = ['cargo']
" }}}
" Asyncomplete: {{{
let g:asyncomplete_auto_popup = 1
let g:asyncomplete_auto_completeopt = 0
" }}}
" Sharpenup: {{{
" All sharpenup mappings will begin with `<Space>os`, e.g. `<Space>osgd` for
" :OmniSharpGotoDefinition
let g:sharpenup_map_prefix = '<Space>os'
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 = {
\ 'winblend': 30,
\ 'winhl': 'Normal:Normal,FloatBorder:ModeMsg',
\ 'border': 'rounded'
\}
else
let g:OmniSharp_popup_options = {
\ 'highlight': 'Normal',
\ 'padding': [0],
\ 'border': [1],
\ 'borderchars': ['─', '│', '─', '│', '╭', '╮', '╯', '╰'],
\ 'borderhighlight': ['ModeMsg']
\}
endif
let g:OmniSharp_popup_mappings = {
\ 'sigNext': '<C-n>',
\ 'sigPrev': '<C-p>',
\ 'pageDown': ['<C-f>', '<PageDown>'],
\ 'pageUp': ['<C-b>', '<PageUp>']
\}
if s:using_snippets
let g:OmniSharp_want_snippet = 1
endif
let g:OmniSharp_highlight_groups = {
\ 'ExcludedCode': 'NonText'
\}
" }}}
" indent
filetype plugin indent on
let g:indent_guides_start_level = 2
let g:indent_guides_guide_size = 1
let g:indent_guides_enable_on_vim_startup = 1
let g:indent_guides_auto_colors = 1
let python_highlight_all = 1
if has('autocmd')
set autoindent
set cursorcolumn
set cursorline
set expandtab
filetype on
autocmd FileType typescript setlocal tabstop=2 shiftwidth=2
autocmd FileType javascript setlocal tabstop=2 shiftwidth=2
autocmd FileType sh setlocal tabstop=2 shiftwidth=2
autocmd FileType proto setlocal tabstop=2 shiftwidth=2
autocmd FileType rust setlocal tabstop=4 shiftwidth=4
"autocmd FileType rust setlocal tabstop=4 shiftwidth=4 tags=./rusty-tags.vi;/,$RUST_SRC_PATH/rusty-tags.vi
autocmd FileType groovy setlocal tabstop=4 shiftwidth=4
autocmd FileType python setlocal tabstop=4 shiftwidth=4
autocmd FileType cs setlocal shiftwidth=4 softtabstop=-1 tabstop=8
autocmd FileType c setlocal tabstop=4 shiftwidth=4
autocmd FileType go setlocal tabstop=4 shiftwidth=4
autocmd FileType indent plugin on
" enable below if you want to use prettier
"autocmd BufWritePost *.ts :silent! exec "!prettier --loglevel silent --write " . expand('%:p') | :silent! exec "e" | :silent! exec "!ctags -R &" | redraw!
autocmd BufWritePost *.ts :silent! exec "!ctags -R &" | redraw!
autocmd BufRead *.ts :setlocal tags=./tags;/
autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd guibg=gray ctermbg=17 | :hi IndentGuidesEven guibg=gray ctermbg=17
"autocmd VimEnter * :Vexplore
endif
nnoremap <C-LeftMouse> :ALEGoToDefinition<CR>