This repository has been archived by the owner on May 4, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
444 lines (381 loc) · 15.3 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
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
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" A vimrc file. "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Maintainer: Gabriele Puliti <gabriele.puliti@gmail.com> "
" Alias: Wabri (https://github.com/Wabri) "
" Last change: 2019 5 24 "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" To use it, copy it to ~/.vimrc "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Map Leader, used for shortcut
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let mapleader =" "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Map Leader, used for shortcut
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set vb
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => HighLight search
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set hlsearch
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Auto indent for brackets
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
inoremap {<CR> {<CR>}<Esc>O
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Plugins will be downloaded under the specified directory.
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
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
call plug#begin('~/.vim/plugged')
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Declare the list of plugins.
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Global default settings
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Plug 'tpope/vim-sensible'
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => NerdTree
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Plug 'scrooloose/nerdtree'
Plug 'Xuyuanp/nerdtree-git-plugin'
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Git
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Plug 'airblade/vim-gitgutter'
Plug 'mhinz/vim-signify'
Plug 'tpope/vim-fugitive'
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Autocompletition
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Plug 'lifepillar/vim-mucomplete'
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Syntax language
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Plug 'sheerun/vim-polyglot'
" => Python
Plug 'Vimjas/vim-python-pep8-indent'
Plug 'davidhalter/jedi-vim'
Plug 'vim-python/python-syntax'
" => I3wm
Plug 'potatoesMaster/i3-vim-syntax'
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Vim theme
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Plug 'nanotech/jellybeans.vim' ", { 'tag': 'v1.6' }
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'luochen1990/rainbow'
Plug 'junegunn/goyo.vim'
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Utils
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Plug 'matze/vim-move'
Plug 'vim-ctrlspace/vim-ctrlspace'
Plug 'tpope/vim-surround'
Plug 'amix/open_file_under_cursor.vim'
Plug 'terryma/vim-expand-region'
Plug 'terryma/vim-multiple-cursors'
Plug 'ctrlpvim/ctrlp.vim'
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => List ends here.
" => Plugins become visible to Vim after this call.
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
call plug#end()
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Map Leader, used for shortcut
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let mapleader =" "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Disable visual bell sound (thanks for this features)
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set vb
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => HighLight search
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set hlsearch
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Disable arrow keys in Normal mode
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
no <Up> <Nop>
no <Down> <Nop>
no <Left> <Nop>
no <Right> <Nop>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Disable arrow keys in Insert mode
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
ino <Up> <Nop>
ino <Down> <Nop>
ino <Left> <Nop>
ino <Right> <Nop>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Mouse Scrolling
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set mouse=nicr
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Easy write and quit
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" easier write
nmap <leader>w :w!<cr>
nmap <leader>W :wq<cr>
" easier quit
nmap <leader>q :q<cr>
nmap <leader>Q :q!<cr>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Select all
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
nnoremap <leader>a ggVG
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Abilitate rainbow parentesis syntax
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:rainbow_active = 1
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Vim-move key - move selection with Control
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:move_key_modifier = 'C'
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Scrolling options
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" scrolling
inoremap <C-E> <C-X><C-E>
"scrolling on insert
inoremap <C-Y> <C-X><C-Y>
" keep 5 lines between the cursor and the edge of the screen
set scrolloff=6
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Cursor settings
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set cursorline
set colorcolumn=80
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Default save to the original file.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set nowritebackup
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Do not keep a backup file, use versions instead
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set nobackup
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Put the number of the line at the left of the text,
" => with the relative distance between the line focused.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set number relativenumber
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Always set autoindenting on
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set autoindent
inoremap {<CR> {<CR>}<Esc>O
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Theme
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set t_Co=256
syntax on
"syntax enable
set background=dark
colorscheme jellybeans
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Autocompletition settings
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set completeopt-=longest
set completeopt+=noselect,preview
set shortmess+=c
let g:jedi#popup_on_dot = 1 " It may be 1 as well
let g:mucomplete#enable_auto_at_startup = 1
let g:mucomplete#completion_delay = 0
let g:python_highlight_all = 1
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Python indent pep8
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:python_pep8_indent_hang_closing = 0
let g:python_pep8_indent_multiline_string = -2
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Default split to below and right.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set splitbelow splitright
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => 1 tab == 4 spaces
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set shiftwidth=4
set tabstop=4
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => This can allow to switch to bash terminal
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
noremap <C-d> :sh<CR>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Uncomment to prevent non-normal modes showing in powerline
" => and below powerline.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set nocompatible
set noshowmode
set showcmd
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Goyo settings
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
map <leader>f :Goyo \| set linebreak<CR>
function! s:goyo_enter()
let b:quitting = 0
let b:quitting_bang = 0
autocmd QuitPre <buffer> let b:quitting = 1
cabbrev <buffer> q! let b:quitting_bang = 1 <bar> q!
set scrolloff=999
endfunction
function! s:goyo_leave()
" Quit Vim if this is the only remaining buffer
if b:quitting && len(filter(range(1, bufnr('$')), 'buflisted(v:val)')) == 1
if b:quitting_bang
qa!
else
qa
endif
endif
set scrolloff=7
endfunction
autocmd! User GoyoEnter nested call <SID>goyo_enter()
autocmd! User GoyoLeave nested call <SID>goyo_leave()
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Compile document, be it groff/LaTeX/markdown/etc.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
map <leader>c :w! \| !compiler <c-r>%<CR>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Open corresponding .pdf/.html or preview
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
map <leader>o :!opout <c-r>%<CR><CR>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Powerline settings
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:rehash256 = 1
let g:Powerline_symbols='unicode'
let g:Powerline_theme='long'
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
let g:airline_symbols.space = "\ua0"
let g:airline_theme='dark'
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#formatter = 'default'
let g:airline#extensions#tabline#enabled = 1
if !exists('g:airline_powerline_fonts')
let g:airline#extensions#tabline#left_sep = ' '
let g:airline#extensions#tabline#left_alt_sep = '|'
let g:airline_left_sep = '▶'
let g:airline_left_alt_sep = '»'
let g:airline_right_sep = '◀'
let g:airline_right_alt_sep = '«'
let g:airline#extensions#branch#prefix = '➔' "➔, ➥, ⎇
let g:airline#extensions#readonly#symbol = '⊘'
let g:airline#extensions#linecolumn#prefix = '¶'
let g:airline#extensions#paste#symbol = 'ρ'
let g:airline_symbols.linenr = '␊'
let g:airline_symbols.branch = '⎇'
let g:airline_symbols.paste = 'ρ'
let g:airline_symbols.paste = 'Þ'
let g:airline_symbols.paste = '∥'
let g:airline_symbols.whitespace = 'Ξ'
else
let g:airline#extensions#tabline#left_sep = ''
let g:airline#extensions#tabline#left_alt_sep = ''
let g:airline_left_sep = ''
let g:airline_left_alt_sep = ''
let g:airline_right_sep = ''
let g:airline_right_alt_sep = ''
endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => This is the nerd tree indicator for git status
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:NERDTreeIndicatorMapCustom = {
\ "Modified" : "✹",
\ "Staged" : "✚",
\ "Untracked" : "✭",
\ "Renamed" : "➜",
\ "Unmerged" : "═",
\ "Deleted" : "✖",
\ "Dirty" : "✗",
\ "Clean" : "✔︎",
\ 'Ignored' : '☒',
\ "Unknown" : "?"
\ }
let g:NERDTreeShowIgnoredStatus = 1
let g:nerdtree_tabs_open_on_console_startup=1
map <C-\> :NERDTreeToggle<CR>
" This will close vim if only nerd tree tab is open
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
let NERDTreeShowLineNumbers=1
let NERDTreeShowHidden=1
let NERDTreeMinimalUI = 1
let g:NERDTreeDirArrowExpandable = '▸'
let g:NERDTreeDirArrowCollapsible = '▾'
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => This is the map to switch between splitted editor
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
map <Space>h <C-w>h
map <Space>j <C-w>j
map <Space>k <C-w>k
map <Space>l <C-w>l
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => This quit all tab and exit from vim
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
map qZ :qall<CR>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Latex settings
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:polyglot_disable = ['latex']
let g:vimtex_view_method='zathura'
let g:vimtex_quickfix_mode=0
set conceallevel=1
let g:tex_conceal='abdmg'
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Enable folding
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set foldmethod=indent
set foldnestmax=10
set nofoldenable
set foldlevel=2
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => This abilitate the copy and paste to clipboard (on debian
" => you need to install: apt install vim-gnome
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"paste from outside buffer
nnoremap <leader>p :set paste<CR>"+p:set nopaste<CR>
vnoremap <leader>p <Esc>:set paste<CR>gv"+p:set nopaste<CR>
"copy to outside buffer
vnoremap <leader>y "+y
" This method is deprecated "
"vnoremap <F2> "+y
"map <F3> "+P
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Switch to alternate file
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
map <Space>> :bnext<cr>
map <Space>< :bprevious<cr>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Vim-CtrlSpace
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" set nocompatible
set hidden
let g:CtrlSpaceDefaultMappingKey = "<TAB>"
let g:CtrlSpaceSymbols = { "CS": "∥","ALL": "✹" }
let g:CtrlSpaceUseTabline = 1
hi CtrlSpaceSelected term=reverse ctermfg=187 guifg=#d7d7af ctermbg=23 guibg=#005f5f cterm=bold gui=bold
hi CtrlSpaceNormal term=NONE ctermfg=244 guifg=#808080 ctermbg=232 guibg=#080808 cterm=NONE gui=NONE
hi CtrlSpaceFound ctermfg=220 guifg=#ffd700 ctermbg=NONE guibg=NONE cterm=bold gui=bold
hi CtrlSpaceStatus ctermfg=230 guifg=#ffffd7 ctermbg=234 guibg=#1c1c1c cterm=NONE gui=NONE
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Automatically deletes all end line trailing whitespaces
" => on save
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
autocmd BufWritePre * %s/\s\+$//e
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Add optional packages.
" => The matchit plugin makes the % command work better,
" => but it is not backwards compatible.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if has('syntax') && has('eval')
packadd matchit
endif