-
Notifications
You must be signed in to change notification settings - Fork 1
/
.vimrc
303 lines (251 loc) · 10.4 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
" ----------- Reminder ---------
" Reminder :
" :tabe && gt to switch tab
" :vnew
" :vs && CTRL-W + arrows
" CTRL + P
" ci) ==> Change inside parentheses
" ----------- Plugins ---------
call plug#begin('~/.vim/plugged')
" ---------- Languages ----------
Plug 'wting/rust.vim'
Plug 'fatih/vim-go'
Plug 'alvan/vim-closetag' " Automatically close HTML/XML tags
Plug 'kchmck/vim-coffee-script'
Plug 'mustache/vim-mustache-handlebars'
Plug 'leafgarland/typescript-vim'
Plug 'peitalin/vim-jsx-typescript'
Plug 'pangloss/vim-javascript'
Plug 'mxw/vim-jsx'
Plug 'dense-analysis/ale'
Plug 'skywind3000/asyncrun.vim'
Plug 'posva/vim-vue'
Plug 'burner/vim-svelte'
Plug 'jparise/vim-graphql'
Plug 'amadeus/vim-mjml'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'prettier/vim-prettier', {
\ 'do': 'yarn install --frozen-lockfile --production',
\ 'for': ['javascript', 'typescript', 'css', 'less', 'scss', 'json', 'graphql', 'markdown', 'vue', 'svelte', 'yaml', 'html'] }
"Plug 'StanAngeloff/php.vim'
" Plug 'LeBarbu/vim-epitech' " Headers && indentation stuff
" Plug 'klen/python-mode'
" ----------- Themes ---------
Plug 'ayu-theme/ayu-vim'
" Plug 'altercation/vim-colors-solarized'
" Plug 'tomasr/molokai'
" Plug 'mhartington/oceanic-next'
" Plug 'junegunn/seoul256.vim'
" ----------- Others ---------
Plug 'mhinz/vim-signify' " Show git diff via vim sign column
"Plug 'Valloric/MatchTagAlways' " Highlight balise (HTML) in which your cursor is
Plug 'tpope/vim-surround' " Use cs"' to replace things around a line
Plug 'scrooloose/nerdcommenter' " <Leader> ci to comment/uncomment or L-cm L-cs L-cc L-cu
Plug 'itchyny/lightline.vim'
Plug 'kien/ctrlp.vim'
Plug 'scrooloose/nerdtree'
Plug 'rhysd/conflict-marker.vim'
"Plug 'scrooloose/syntastic'
Plug 'Shougo/neocomplete.vim'
Plug 'editorconfig/editorconfig-vim'
" Plug 'junegunn/vim-easy-align'
call plug#end()
" ---------- Global configuration ----------
filetype plugin indent on
let mapleader = ","
" ---------- Theme configuration ----------
syntax enable
highlight ColorColumn ctermbg=10 " Change color of 80 columns bar
set cursorline
if has('termguicolors') " Terminal with True colors enabled. See https://gist.github.com/XVilka/8346728
set termguicolors
let ayucolor="mirage" " for mirage version of theme
colorscheme ayu
endif
" neovide
set guifont=Dank\ Mono:h14
if has('gui_running') " Setup for the visual environment
set guioptions-=T
set guioptions-=m
set guioptions+=c
if !has("unix")
set guifont=Consolas:h10
winsize 120 30
endif
endif
" ---------- epitech-vim configuration ----------
" let g:header_update = 0 " Disable automatic header update when saving a file in vim-epitech plugin
" ---------- ale ----------
let g:ale_sign_error = '●' " Less aggressive than the default '>>'
let g:ale_sign_warning = '.'
let g:ale_lint_on_enter = 0 " Less distracting when opening a new file
" run black on save
" autocmd BufWritePre *.py execute ':Black'
" autocmd BufWritePre *.py execute ':Isort'
" run eslint on save
"autocmd BufWritePost *.{js,vue,svelte} AsyncRun -post=checktime ./node_modules/.bin/eslint --fix %
" Enables Python linters to use
" the project's pipenv
" !! In order to activate pipenv, a `Pipfile.lock` must exist.
" !! See https://github.com/w0rp/ale/blob/master/autoload/ale/python.vim#L155
let g:ale_python_auto_pipenv = 1
" The following requires that you install some tools on your system / user
" npm install -g eslint
" pip3 install flake8 pylint
" vue is empty because it's handled by coc-vetur
let g:ale_linters = {
\ 'javascript': ['eslint'],
\ 'vue': [],
\ 'svelte': ['eslint'],
\ 'python': ['flake8', 'pylint', 'mypy'],
\}
" pip3 install black
let g:ale_fixers = {
\ '*': ['remove_trailing_lines', 'trim_whitespace'],
\ 'javascript': ['eslint'],
\ 'typescript': ['eslint'],
\ 'typescript.tsx': ['eslint'],
\ 'vue': [],
\ 'svelte': ['eslint'],
\ 'python': ['black', 'isort'],
\}
let g:ale_linter_aliases = {'vue': 'typescript'}
" Set this variable to 1 to fix files when you save them.
let g:ale_fix_on_save = 0
" ---------- syntastic configuration ----------
"let g:syntastic_go_checkers = ['gofmt', 'goimports']
let g:syntastic_c_checkers=['make DEBUG=yes', 'gcc'] " set syntastic default checker
"let g:syntastic_asm_compiler=['nasm']
" ---------- ctrp configuration ----------
" Ignore *.o files and common build / dependencies directories
let g:ctrlp_custom_ignore = {
\ 'dir': '\v[\/](\.git|node_modules|dist|build|fixers|vendor)$',
\ 'file': '\v\.o$',
\ }
" ---------- vim-go configuration ----------
" let g:go_metalinter_command = "golangci-lint"
" let g:go_metalinter_autosave = 1 " call metalinter on save
" see list here
" https://github.com/golangci/golangci-lint#quick-start
" let g:go_metalinter_autosave_enabled = [
" \ 'deadcode', 'errcheck', 'gosimple', 'govet',
" \ 'ineffassign', 'staticcheck', 'structcheck',
" \ 'typecheck', 'unused', 'varcheck'
" \ ]
" Do not move the cursor the error
let g:go_jump_to_error = 0
" goimports is basically gofmt + auto-replace the imports
let g:go_fmt_command = "goimports"
let g:go_fmt_autosave = 1
" Hide quickfix/location list because it takes too much space
" (especially with split windows)
"
" https://github.com/fatih/vim-go/issues/1682
let g:go_fmt_fail_silently = 1
" ---------- nerdtree configuration ----------
"autocmd vimenter * NERDTree " Nerdtree automatically starts when vim starts
"
""Close NERDTree if it is the last open buffer
"" Close all open buffers on entering a window if the only
"" buffer that's left is the NERDTree buffer
"autocmd WinEnter * call s:CloseIfOnlyNerdTreeLeft()
"function! s:CloseIfOnlyNerdTreeLeft()
" if exists("t:NERDTreeBufName")
" if bufwinnr(t:NERDTreeBufName) != -1
" if winnr("$") == 1
" q
" endif
" endif
" endif
"endfunction
" ---------------------------------------------------------------------------
" operational settings
set nocompatible " vim defaults, not vi!
set hidden " allow editing multiple unsaved buffers
set more " the 'more' prompt
set autoread " watch for file changes by other programs
"set vb t_vb=
"set visualbell t_vb=
":set patchmode=~ " only produce *~ if not there
set noautowrite " don't automatically write on :next, etc
set wildmenu " : menu has tab completion, etc
set scrolloff=5 " keep at least 5 lines above/below cursor
set sidescrolloff=5 " keep at least 5 columns left/right of cursor
set history=300 " remember the last 300 commands
set showcmd
" ---------------------------------------------------------------------------
" window spacing
set cmdheight=2 " make command line two lines high
set ruler " show the line number on bar
set lazyredraw " don't redraw when running macros
set number " show line number on each line
"set winheight=999 " maximize split windows
"set winminheight=0 " completely hide other windws
map <LocalLeader>w+ 100<C-w>+ " grow by 100
map <LocalLeader>w- 100<C-w>- " shrink by 100
" ---------------------------------------------------------------------------
" mouse settings
set mouse=a " mouse support in all modes
set mousehide " hide the mouse when typing text
" ,p and shift-insert will paste the X buffer, even on the command line
imap <S-Insert> <S-MiddleMouse>
cmap <S-Insert> <S-MiddleMouse>
" this makes the mouse paste a block of text without formatting it
map <MouseMiddle> <esc>"*p
" ---------------------------------------------------------------------------
" global editing settings
set autoindent smartindent cindent " turn on auto/smart indenting
" set expandtab " use spaces, not tabs
set smarttab " make <tab> and <backspace> smarter
set shiftwidth=2 " indents of 2
set tabstop=2
set softtabstop=2
"set backspace=eol,start,indent " allow backspacing over indent, eol, & start
set undolevels=1000 " number of forgivable mistakes
set updatecount=100 " write swap file to disk every 100 chars
set complete=.,w,b,u,U,t,i,d " do lots of scanning on tab completion
set viminfo=%100,'100,/100,h,\"500,:100,n~/.viminfo
set formatoptions+=r
set comments=sl:/*,mb:**,elx:*/ " Comments for Epitech Norme
"set textwidth=80
set nofoldenable
"" C Indent parameter of multi-line declaration of function !
set cino=(0
"set cino =>4^-2e2{2n-2
"set cino=c0,C1
"" Indent like emacs !
"set cinoptions={1s,>2s,e-1s,^-1s,n-1s,:1s,p5,i4,(0,u0,W1s shiftwidth=2
" ---------------------------------------------------------------------------
" searching...
set hlsearch " enable search highlight globally
set incsearch " show matches as soon as possible
set showmatch " show matching brackets when typing
" disable last one highlight
nmap <LocalLeader>nh :nohlsearch<cr>
set diffopt=filler,iwhite " ignore all whitespace and sync
" find git's merge conflict markers
:map <LocalLeader>fc /\v^[<=>]{7}( .*\|$)<CR>
" neovim requirements
"let g:python_host_prog = '/usr/bin/python'
" When using pyenv, you want to force vim to use system's python
" https://sk1u.com/blog/2018/04/16/pyenv-neovim
" pyenv which python ✘ 130
let g:python_host_prog = '/usr/bin/python'
" pyenv which python3
let g:python3_host_prog = '/usr/local/bin/python3'
" Warning: The following configuration can be overriden
" by a .editorconfig file
" ---------- ASM-specific ----------
au BufRead,BufNewFile *.asm set filetype=nasm " Overide filetype nasm for .asm files
let g:syntastic_nasm_nasm_post_args = "-f elf64"
" ---------- Go Specific ----------
" Go uses:
" - coc.vim + coc-go: auto-completion, compile errors
" - ale for static analysis
" - vim-go for formatting
" Some people don't like how the tabs are shown.
" By default Vim shows 8 spaces for a single tab. However it's up to us how
" to represent in Vim. The following will change it to show a single tab as 4 spaces:
" https://github.com/fatih/vim-go/wiki/Tutorial
autocmd BufNewFile,BufRead *.go setlocal noexpandtab tabstop=4 shiftwidth=4
let g:prettier#autoformat_config_present = 1