-
Notifications
You must be signed in to change notification settings - Fork 0
/
dot_vimrc
455 lines (382 loc) · 12.8 KB
/
dot_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
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
"this serves an emergency purpose to keep vim useful on systems that don't
"have neovim
"
if &compatible
set nocompatible " Be iMproved
endif
set ruler
set signcolumn=yes
set completeopt-=preview
set noshowmode
set diffopt+=vertical
filetype plugin indent on
set encoding=utf-8
if has("pythonx")
set pyxversion=3
endif
let mapleader=","
let maplocalleader="\\"
let g:tex_flavor='latex'
let g:vimtex_view_method='skim' "mupdf'
let g:vimtex_quickfix_mode=0
" let g:vimtex_latexmk_progname= 'nvr'
set conceallevel=1
let g:tex_conceal='abdmg'
set hidden
set laststatus=2
set undofile
set undodir=~/.cache/vim/undos
set directory=~/.cache/vim/tmp
set backupdir=~/.cache/vim/backup
set autochdir
set colorcolumn=80
set runtimepath+=~/.cache/dein/repos/github.com/Shougo/dein.vim
" Required:
if dein#load_state('~/.cache/dein')
call dein#begin('~/.cache/dein', ['~/.config/init.vim', '~/.vimrc'])
" Let dein manage dein
" Required:
call dein#add('~/.cache/dein/repos/github.com/Shougo/dein.vim')
call dein#add('haya14busa/dein-command.vim')
call dein#add('roxma/nvim-yarp')
call dein#add('roxma/vim-hug-neovim-rpc')
" Colors
call dein#add('iCyMind/NeoSolarized')
" file explorer
call dein#add('Shougo/defx.nvim')
call dein#add('kristijanhusak/defx-icons')
call dein#add('kristijanhusak/defx-git')
call dein#add('schickling/vim-bufonly')
call dein#add('ntpeters/vim-better-whitespace')
call dein#add('nathanaelkane/vim-indent-guides')
"call dein#add('Shougo/denite.nvim')
call dein#add('Shougo/neoyank.vim')
call dein#add('chemzqm/unite-location')
"call dein#add('raghur/fruzzy' , {'hook_post_source': "call fruzzy#install()"})
call dein#add('kyazdani42/nvim-web-devicons')
""ale et al
call dein#add('Shougo/deoplete.nvim')
" call dein#add('autozimu/LanguageClient-neovim', {'rev': 'next', 'build': 'bash install.sh'})
call dein#add('Shougo/echodoc.vim')
call dein#add('dense-analysis/ale')
call dein#add('SirVer/ultisnips')
call dein#add('honza/vim-snippets.git')
call dein#add('Konfekt/FastFold')
call dein#add('sjl/gundo.vim')
" git
call dein#add('airblade/vim-gitgutter')
call dein#add('gregsexton/gitv')
call dein#add('tpope/vim-fugitive')
call dein#add('idanarye/vim-merginal')
" lightline
call dein#add('itchyny/lightline.vim')
call dein#add('mgee/lightline-bufferline')
call dein#add('maximbaz/lightline-ale')
call dein#add('sheerun/vim-polyglot')
call dein#add('majutsushi/tagbar')
call dein#add('scrooloose/nerdcommenter')
call dein#add('jmcantrell/vim-virtualenv', {'on_ft': 'python'})
call dein#add('tmhedberg/SimpylFold')
call dein#add('kkoomen/vim-doge', {'hook_post_source': 'call doge#install({"headless": 1})'})
call dein#add('pangloss/vim-javascript', {'on_ft': 'javascript.jsx'})
"call dein#add('vimwiki/vimwiki')
call dein#add('ryanoasis/vim-devicons')
call dein#add('lervag/vimtex')
call dein#add('lervag/wiki.vim')
call dein#add('lervag/wiki-ft.vim')
" Required:
call dein#end()
call dein#save_state()
endif
" If you want to install not installed plugins on startup.
if dein#check_install()
call dein#install()
endif
"End dein Scripts-------------------------
syntax enable
"ale settings
" let g:ale_sign_error = "\uf05e"
" let g:ale_sign_warning = "\uf071"
" let g:ale_sign_info = "\uf129"
" let g:ale_floating_preview = 1
" let g:ale_linters = {
" \ 'python': ['black', 'flake8', 'isort', 'mypy', 'pyls', 'pyright'],
" \ }
" nmap K <Plug>(ale_hover)
" nmap gd <Plug>(ale_go_to_definition)
" nmap gt <Plug>(ale_go_to_type_definition)
" nmap <leader>ai <Plug>(ale_import)
" nnoremap <silent> <leader>an :ALERename<CR>
" nmap <leader>ar <Plug>(ale_find_references)
"doge settings
let g:doge_mapping = '<Leader>dd'
let g:doge_doc_standard_python = 'sphinx'
" LanguageClient configuration
" let g:LanguageClient_diagnosticsEnable = 0
let g:LanguageClient_serverCommands = {
\ 'python': ['pyls']
\ }
let g:LanguageClient_useVirtualText = "CodeLens"
function LC_maps()
if has_key(g:LanguageClient_serverCommands, &filetype)
nnoremap <buffer> <silent> <leader>lcd :call LanguageClient#textDocument_hover()<cr>
nnoremap <buffer> <silent> <leader>lcg :call LanguageClient#textDocument_definition()<CR>
nnoremap <buffer> <silent> <leader>lcr :call LanguageClient#textDocument_rename()<CR>
endif
endfunction
autocmd FileType * call LC_maps()
" deoplete configuration
let g:deoplete#enable_at_startup = 1
call deoplete#custom#source('_', 'converters',
\['converter_remove_overlap',
\ 'converter_truncate_abbr',
\ 'converter_truncate_menu',
\ 'converter_remove_paren',
\ 'converter_auto_delimiter'])
autocmd FileType denite-filter
\ call deoplete#custom#buffer_option('auto_complete', v:false)
inoremap <expr> <C-G> deoplete#undo_completion()
" tab-completion
inoremap <silent><expr> <Tab>
\ pumvisible() ? "\<C-N>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-P>" : "\<C-H>"
inoremap <F3> <nop>
inoremap <F4> <nop>
inoremap <F8> <nop>
inoremap <F9> <nop>
inoremap <F10> <nop>
inoremap <F11> <nop>
inoremap <F12> <nop>
nmap Q <nop>
let g:tagbar_left = 1
let g:tagbar_autofocus = 1
let g:tagbar_autoclose = 1
nmap <F2> :TagbarToggle<CR>
" let g:echodoc#type = 'signature'
" let g:echodoc_enable_at_startup = 1
let g:echodoc#enable_at_startup = 1
let g:echodoc#type = 'floating'
" nerdcommenter
let g:NERDSpaceDelims = 0
let g:NERDCompactSexyComs = 1
let g:NERDCommentEmptyLines = 1
let g:NERDTrimTrailingWhitespace = 1
let g:bufferline_echo = 0
" ultisnips
let g:ultisnips_python_style = "sphinx"
let g:UltiSnipsExpandTrigger="<c-S>"
"
"
" Templates config
if has("autocmd")
augroup templates
autocmd BufNewFile *.* silent! execute '0r ~/.vim/templates/template.'.expand("<afile>:e")
augroup END
endif
nnoremap <silent> <leader>mx :w<CR>:!chmod +x %<CR>l<CR>
" vim-better-whitespace configuration
nnoremap <silent> <leader>rws :ToggleStripWhitespaceOnSave<CR>
nnoremap <silent> <leader>hws :ToggleWhitespace<CR>
if has("autocmd")
autocmd BufEnter * EnableStripWhitespaceOnSave
endif
" autocmd InsertLeave,CompleteDone * if pumvisible() == 0 | pclose | endi
" Help Neovim check if file has changed on disc
" https://github.com/neovim/neovim/issues/2127
augroup checktime
autocmd!
if !has("gui_running")
"silent! necessary otherwise throws errors when using command
"line window.
autocmd BufEnter,FocusGained,BufEnter,FocusLost,WinLeave * checktime
endif
augroup END
" let g:NERDTreeQuitOnOpen=1
"
"
" set showcmd
" set showmatch
" "set sessionoptions+=resize
"
set backspace=indent,eol,start
"
" " Enable modelines for users but not root
set modelines=5
if $USER != 'root'
set modeline
else
set nomodeline
endif
"
" " Enable or disable spell checker
"
set spelllang=en_us
map <F6> :setlocal invspell spell?<CR>
map <F7> :setlocal invpaste paste?<CR>
" Color Stuff
" set t_Co=256
set termguicolors
set t_8f=[38;2;%lu;%lu;%lum
set t_8b=[48;2;%lu;%lu;%lum
set background=dark
let g:solarized_italics = 0
let g:solarized_termtrans = 1
let g:solarized_visibility = "high"
let g:neosolarized_visibility = "high"
let g:neosolarized_termcolors = 256
let g:neosolarized_termtrans = 1
let g:neosolarized_italic = 0
colorscheme NeoSolarized
"highlight ALEErrorSign ctermfg=15 ctermbg=9 gui=bold guifg=#dc322f guibg=none
"highlight ALEWarningSign ctermfg=15 ctermbg=9 gui=bold guifg=#b58900 guibg=none
autocmd BufWritePost * call defx#redraw()
nnoremap <silent><leader>fl :Defx -split=vertical -winwidth=50 -direction=topleft<CR>
nnoremap <silent><leader>ft :Defx -toggle -resume -split=vertical -winwidth=50 -direction=topleft<CR>
nnoremap <silent><leader>fc :Defx -resume -split=vertical -winwidth=50 -direction=topleft -search=`expand('%:p')` `getcwd()`<CR>
call defx#custom#option('_', {
\ 'columns': 'indent:icons:filename:type:git',
\ })
autocmd FileType defx call s:defx_my_settings()
function! s:defx_my_settings() abort
" Define mappings
nnoremap <silent><buffer><expr> <CR>
\ defx#is_directory() ?
\ defx#do_action('open_tree', 'toggle') :
\ defx#do_action('drop')
nnoremap <silent><buffer><expr> c
\ defx#do_action('copy')
nnoremap <silent><buffer><expr> m
\ defx#do_action('move')
nnoremap <silent><buffer><expr> p
\ defx#do_action('paste')
nnoremap <silent><buffer><expr> l
\ defx#do_action('open')
nnoremap <silent><buffer><expr> E
\ defx#do_action('open', 'vsplit')
nnoremap <silent><buffer><expr> P
\ defx#do_action('preview')
nnoremap <silent><buffer><expr> o
\ defx#do_action('open_tree', 'toggle')
nnoremap <silent><buffer><expr> K
\ defx#do_action('new_directory')
nnoremap <silent><buffer><expr> N
\ defx#do_action('new_file')
nnoremap <silent><buffer><expr> S
\ defx#do_action('toggle_sort', 'time')
nnoremap <silent><buffer><expr> d
\ defx#do_action('remove')
nnoremap <silent><buffer><expr> r
\ defx#do_action('rename')
nnoremap <silent><buffer><expr> !
\ defx#do_action('execute_command')
nnoremap <silent><buffer><expr> x
\ defx#do_action('execute_system')
nnoremap <silent><buffer><expr> yy
\ defx#do_action('yank_path')
nnoremap <silent><buffer><expr> .
\ defx#do_action('toggle_ignored_files')
nnoremap <silent><buffer><expr> ;
\ defx#do_action('repeat')
nnoremap <silent><buffer><expr> h
\ defx#do_action('cd', ['..'])
nnoremap <silent><buffer><expr> ~
\ defx#do_action('cd')
nnoremap <silent><buffer><expr> q
\ defx#do_action('quit')
nnoremap <silent><buffer><expr> <Space>
\ defx#do_action('toggle_select') . 'j'
nnoremap <silent><buffer><expr> *
\ defx#do_action('toggle_select_all')
nnoremap <silent><buffer><expr> j
\ line('.') == line('$') ? 'gg' : 'j'
nnoremap <silent><buffer><expr> k
\ line('.') == 1 ? 'G' : 'k'
nnoremap <silent><buffer><expr> <C-l>
\ defx#do_action('redraw')
nnoremap <silent><buffer><expr> <C-g>
\ defx#do_action('print')
nnoremap <silent><buffer><expr> cd
\ defx#do_action('change_vim_cwd')
endfunction
" lightline-ale configuration
function! LightlineFugitive()
try
if expand('%:t') !~? 'denite\|Tagbar\|NERD' && exists('*FugitiveHead')
let mark = ' ' " edit here for cool mark
let branch = FugitiveHead()
return branch !=# '' ? mark.branch : ''
endif
catch
endtry
return ''
endfunction
function! MyVirtualenv()
if &filetype == "python"
let _ = virtualenv#statusline()
return strlen(_) ? _ : ''
endif
return ''
endfunction
let g:lightline#lsp#indicator_checking = "\uf110"
let g:lightline#lsp#indicator_infos = "\uf129"
let g:lightline#lsp#indicator_warnings = "\uf071"
let g:lightline#lsp#indicator_errors = "\uf05e"
let g:lightline#lsp#indicator_hints = "\uf124"
let g:lightline#lsp#indicator_ok = "\uf00c"
let g:lightline#bufferline#show_number = 1
let g:lightline#bufferline#modified = "+"
let g:lightline#bufferline#unnamed = '[No Name]'
", 'linter_ok' ]
let g:lightline = {
\ 'separator' : { 'left': '', 'right': '' },
\ 'subseparator': { 'left': '', 'right': '' },
\ 'colorscheme': 'solarized',
\ 'active': {
\ 'left': [
\ [ 'mode', 'paste' ],
\ [ 'fugitive'],
\ [ 'virtualenv' ],
\ [ 'buffers' ]
\ ],
\ 'right': [
\ [ 'percent' ],
\ [ 'lineinfo' ],
\ [ 'linter_hints', 'linter_infos', 'linter_errors', 'linter_warnings', 'linter_checking']
\ ]
\ },
\ 'component_expand':{
\ 'linter_infos': 'lightline#ale#info',
\ 'linter_warnings': 'lightline#ale#warnings',
\ 'linter_hints': 'lightline#ale#hints',
\ 'linter_errors': 'lightline#ale#errors',
\ 'linter_ok': 'lightline#ale#ok',
\ 'linter_checking': 'lightline#ale#checking',
\ 'buffers': 'lightline#bufferline#buffers'
\ },
\ 'component_function': {
\ 'virtualenv': 'MyVirtualenv',
\ 'fugitive': 'LightlineFugitive',
\ },
\ 'component_type': {
\ 'buffers': 'tabsel',
\ 'linter_checking': 'left',
\ 'linter_warnings': 'warning',
\ 'linter_errors': 'error',
\ 'linter_infos': 'right',
\ 'linter_hints': 'right',
\ 'linter_ok': 'left',
\ 'virtualenv': 'left',
\ 'fugitive': 'left'
\ }
\}
nnoremap <leader>fg :Telescope live_grep prompt_prefix=🔍<cr>
"wiki.vim
let g:wiki_root = '~/vimwiki'
"nnoremap <leader>wj :WikiJournalIndex<CR>
nmap <leader>wj <plug>(wiki-journal-index)
" Terraform settings
let g:terraform_align=1
let g:terraform_fold_sections=0
let g:indent_guides_enable_on_vim_startup = 1
let g:indent_guides_guide_size = 1
let g:indent_guides_start_level = 2