-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
307 lines (268 loc) · 7.75 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
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
set nocompatible
set notermguicolors
try
set background=dark
colorscheme selenized_bw
let g:dargor_full_moumoute = 1
catch
set background=light
let g:dargor_full_moumoute = 0
endtry
if &diff
if g:dargor_full_moumoute
colorscheme iceberg
endif
let g:dargor_full_moumoute = 0
endif
set autoindent
set backspace=indent,start,eol
set diffopt=filler,iwhiteall
set display=lastline,uhex
set errorbells
set expandtab
set foldenable
set foldlevelstart=99
set foldmethod=indent
set formatoptions=croqj
set ignorecase
set incsearch
set infercase
set mouse=
set noequalalways
set nofsync
set nojoinspaces
set regexpengine=2
set report=0
set ruler
set scrolloff=5
set shiftround
set shiftwidth=4
set showcmd
set smartcase
set smarttab
set tabpagemax=99
set textwidth=79
set title
set ttyfast
set updatetime=100
set viminfo=
set virtualedit=block
set wildmenu
set wildmode=list:longest,full
if exists('&swapsync')
set swapsync=
endif
set nomodeline
set secure
set encoding=utf8
set t_BE=
if g:dargor_full_moumoute
if !empty($JUPYTER_SERVER_ROOT)
set background=light
set mouse=a
endif
if $TERM_PROGRAM ==# 'vscode'
set background=dark
set mouse=a
endif
if &columns >= 86
set number
set signcolumn=yes
endif
endif
if g:dargor_full_moumoute
let g:light_color_column = 224
let g:dark_color_column = 52
else
let g:light_color_column = 1
let g:dark_color_column = 9
endif
let g:netrw_dirhistmax = 0
let g:gruvbox_contrast_dark = 'hard'
let g:gruvbox_contrast_light = 'hard'
let g:rainbow_active = 1
let g:rainbow_conf = {}
let g:python_highlight_all = 1
let g:python_highlight_file_headers_as_comments = 1
let g:gitgutter_diff_args = '-w'
let g:gitgutter_map_keys = 0
let g:gitgutter_max_signs = -1
let g:gitgutter_sign_allow_clobber = 1
if &t_Co > 2
syntax on
set hlsearch
if !&diff
set colorcolumn=80
endif
function! SetupHighlights()
" :h highlight-groups
" :so $VIMRUNTIME/syntax/hitest.vim
highlight clear Comment
highlight Comment ctermfg=243
highlight Directory ctermfg=Blue
highlight NonText ctermfg=DarkBlue
highlight SpecialKey ctermfg=DarkRed
highlight WhiteSpaces ctermbg=Red
if &t_Co >= 256
if &background ==# 'dark'
execute 'highlight ColorColumn ctermbg=' . g:dark_color_column
let g:rainbow_conf.ctermfgs = ['blue', 'yellow', 'cyan', 'magenta']
highlight GitGutterAdd ctermfg=Green
highlight GitGutterChange ctermfg=Yellow
highlight GitGutterDelete ctermfg=Red
highlight GitGutterChangeDelete ctermfg=Magenta
highlight Pmenu ctermfg=244 ctermbg=235
highlight lspInlayHintsType ctermfg=240
highlight lspInlayHintsParameter ctermfg=135
else
execute 'highlight ColorColumn ctermbg=' . g:light_color_column
let g:rainbow_conf.ctermfgs = ['darkblue', 'darkyellow', 'darkcyan', 'darkmagenta']
highlight GitGutterAdd ctermfg=40
highlight GitGutterChange ctermfg=214
highlight GitGutterDelete ctermfg=Red
highlight GitGutterChangeDelete ctermfg=Magenta
highlight Pmenu ctermfg=242 ctermbg=255
highlight lspInlayHintsType ctermfg=250
highlight lspInlayHintsParameter ctermfg=129
endif
highlight lspReference ctermfg=Magenta ctermbg=Yellow
highlight FoldColumn ctermfg=243
highlight Folded ctermfg=243
endif
highlight Todo ctermfg=Red
highlight MoreMsg ctermfg=DarkYellow
highlight ErrorMsg ctermfg=Red
highlight DiffFile ctermfg=DarkMagenta
highlight DiffAdded ctermfg=DarkGreen
highlight DiffRemoved ctermfg=DarkRed
highlight DiffText ctermfg=Black ctermbg=Magenta
if &filetype ==# 'man'
" vimmanpager
setlocal nonumber
setlocal colorcolumn=
setlocal signcolumn=no
highlight clear WhiteSpaces
endif
endfunction
autocmd ColorScheme,Syntax * call SetupHighlights()
function! InitBuffer()
if !exists('w:WhiteSpaces')
if !hlexists('WhiteSpaces')
call SetupHighlights()
endif
let w:WhiteSpaces=matchadd('WhiteSpaces', '\(\t\|\s\+$\)')
endif
endfunction
function! EnterBuffer()
call InitBuffer()
if g:dargor_full_moumoute
setlocal cursorline
if index(['yaml', 'json'], &syntax) >= 0
setlocal cursorcolumn
endif
endif
endfunction
function! LeaveBuffer()
if g:dargor_full_moumoute
setlocal nocursorline
setlocal nocursorcolumn
endif
endfunction
autocmd BufWinEnter * call InitBuffer()
autocmd BufEnter,WinEnter * call EnterBuffer()
autocmd BufLeave,WinLeave * call LeaveBuffer()
endif
function! ToggleBackground()
let oldsyn = &syntax
if &background ==# 'dark'
set background=light
else
set background=dark
endif
try
filetype detect
catch
" some plugins generate errors here, just ignore them
endtry
let &syntax = oldsyn
if &syntax ==# 'yaml'
if g:dargor_full_moumoute
call HelmSyntax()
endif
endif
endfunction
function! MaximizeToggle()
if exists('s:maximize_session')
silent! execute 'source ' . s:maximize_session
call delete(s:maximize_session)
unlet s:maximize_session
let &hidden=s:maximize_hidden_save
unlet s:maximize_hidden_save
else
let s:maximize_hidden_save = &hidden
let s:maximize_session = tempname()
setlocal hidden
execute 'mksession! ' . s:maximize_session
only
endif
endfunction
function! ToggleMouse()
if empty(&mouse)
set mouse=a
echo ' mouse'
else
set mouse=
echo 'nomouse'
endif
endfunction
function! WFlake()
execute 'term ++kill=term wflake8 ' . expand('%:p')
resize 11
wincmd p
endfunction
function! WShell()
execute 'term ++kill=term wshellcheck ' . expand('%:p')
resize 11
wincmd p
endfunction
function! WYaml()
execute 'term ++kill=term wyamllint ' . expand('%:p')
resize 11
wincmd p
endfunction
nnoremap <space> za
nnoremap zC :setlocal foldlevel=0<CR>
nnoremap zO :setlocal foldlevel=99<CR>
nnoremap SE :setlocal spell spelllang=en<CR>
nnoremap SF :setlocal spell spelllang=fr<CR>
nnoremap SB :setlocal spell spelllang=en,fr<CR>
nnoremap SN :setlocal nospell<CR>
nnoremap WF :call WFlake()<CR>
nnoremap WS :call WShell()<CR>
nnoremap WY :call WYaml()<CR>
nnoremap <F4> :Lexplore<CR>
nnoremap <F5> :syntax sync fromstart<CR>
nnoremap <F6> :set invpaste paste?<CR>
nnoremap <F7> :call ToggleMouse()<CR>
nnoremap <F8> :setlocal cursorcolumn!<CR>
nnoremap <F9> :!%:p<CR>
nnoremap <C-b> :call ToggleBackground()<CR>
nnoremap <C-W>o :call MaximizeToggle()<CR>
nnoremap <C-W>O :call MaximizeToggle()<CR>
nnoremap <C-W><C-O> :call MaximizeToggle()<CR>
filetype plugin indent on
autocmd FileType rust setlocal matchpairs+=<:> | syntax keyword Keyword async await
autocmd FileType ruby,eruby,xml,yaml,json,markdown setlocal shiftwidth=2 softtabstop=2
autocmd FileType make setlocal noexpandtab shiftwidth=8
autocmd FileType gitcommit setlocal nowrap
if g:dargor_full_moumoute
autocmd FileType cmake RainbowToggleOff
endif
cnoreabbrev t terminal
cnoreabbrev vt vertical terminal
autocmd TerminalOpen * setlocal nonumber signcolumn=no colorcolumn=
for f in split(expand('~/.vim*.vim'), '\n')
if filereadable(f)
execute 'source ' . f
endif
endfor