-
Notifications
You must be signed in to change notification settings - Fork 2
/
.vimrc
431 lines (359 loc) · 11.7 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
filetype plugin on
set runtimepath+=/home/emeric/.vim/vam
set runtimepath+=/home/emeric/.vim/mySnippet
let mapleader = "à"
let maplocalleader = ","
"Specific to vim (vam - syntastic)
if !has('nvim')
let g:racer_cmd = 'racer'
let g:syntastic_mode_map = { 'mode': 'active',
\ 'active_filetypes': [],
\ 'passive_filetypes': ['scala'] }
let g:syntastic_always_populate_loc_list=1
let g:syntastic_auto_loc_list=2
let g:syntastic_quiet_warning=1
fun SetupVAM()
let g:vim_addon_manager = {}
let g:vim_addon_manager.plugin_sources = {}
"TODO test YouCompleteMe
let plugins = [
\ 'molokai'
\ ,'badwolf'
\ ,'rust'
\ ,'rust-racer'
\ ,'vim-airline'
\ ,'The_NERD_tree'
\ ,'ctrlp'
\ ,'snipmate'
\ ,'vim-snippets'
\ ,'fugitive'
\ ,'DrawIt'
\ ,'surround'
\ ,'Syntastic'
\ ,'vimproc'
\ ,'ghcmod-vim'
\ ,'neco-ghc'
\ ,'Solarized'
\ ,'Colour_Sampler_Pack'
\ ,'Align%294'
\ ,'agda-vim'
\ ,'Tagbar'
\ ,'VOoM'
\ ,'fountainwiki'
\ ,'fountain'
\ ]
" \ ,'vimbed'
" \ ,'HaskellMode'
let unusedplugins = [
\ 'self'
\ ,'forms'
\ ,'vimshell'
\ ,'ensime'
\ ,'vimside'
\ ,'LustyExplorer'
\ ,'Markdown_syntax'
\ ,'easytags'
\ ]
call vam#ActivateAddons(plugins,{'auto_install' : 1})
endf
call SetupVAM()
endif
"Specific to neovim (vim plugin - neomake)
if has('nvim')
call plug#begin()
Plug 'benekastah/neomake'
Plug 'scrooloose/syntastic'
Plug 'tomasr/molokai'
Plug 'sjl/badwolf'
Plug 'wting/rust.vim', { 'for': 'rust' }
Plug 'racer-rust/vim-racer', { 'for': 'rust', 'commit' : '15078bc52f86e1db' }
"january first commit failure
"Plug 'racer-rust/vim-racer', { 'for': 'rust' }
Plug 'vim-airline'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'kien/ctrlp.vim', { 'on' : 'CtrlP' }
Plug 'tomtom/tlib_vim'
Plug 'honza/vim-snippets' | Plug 'garbas/vim-snipmate' | Plug 'MarcWeber/vim-addon-mw-utils'
Plug 'tpope/vim-fugitive'
Plug 'vim-scripts/DrawIt', { 'on': 'DrawIt' }
Plug 'tpope/vim-surround'
" \ ,'vimproc'
" \ ,'ghcmod-vim'
"t \ ,'neco-ghc'
" \ ,'vimbed'
" \ ,'HaskellMode'
Plug 'altercation/vim-colors-solarized'
Plug 'vim-scripts/Colour-Sampler-Pack'
Plug 'vim-scripts/Align', { 'on': 'Align' }
Plug 'vim-scripts/Align', { 'on': 'AlignCtrl' }
Plug 'majutsushi/tagbar'
Plug 'vim-voom/VOoM', { 'on': 'Voom' }
Plug 'vim-voom/VOoM', { 'on': 'Voomhelp' }
Plug 'vim-scripts/fountain.vim', { 'for': 'fountain' }
Plug 'vim-scripts/fountainwiki.vim', { 'for': 'fountain' }
Plug 'Chiel92/vim-autoformat' "not yet with vam for vim : TODO add it
" \ ,'agda-vim'
" \ 'self'
" \ ,'forms'
" \ ,'ensime'
" \ ,'vimside'
" \ ,'LustyExplorer'
" \ ,'Markdown_syntax'
" \ ,'easytags'
" TODO test YouCompleteMe
call plug#end()
nmap <silent> <LocalLeader>f :Autoformat <CR>
let g:formatdef_rustfmt = '"rustfmt"'
let g:formatters_rust = ['rustfmt']
"autocmd BufWritePost *.rs Neomake
autocmd Filetype rust nn <C-s> :w <CR> :Neomake! cargo <CR>
autocmd Filetype rust nn <C-l> :w <CR> :NeomakeSh cargo test <CR>
autocmd Filetype rust nn <C-c> :w <CR> :!export RUST_BACKTRACE=1; cargo test <CR>
" neomake
let g:neomake_rust_rustc_makers = {
\ 'args': [],
\ }
" \ 'errorformat': '%A%f: line %l\, col %v\, %m \(%t%*\d\)',
let g:neomake_rust_enabled_makers = ['rustc']
endif
"terminal
if has('nvim')
tnoremap <silent> <LocalLeader>is <C-\><C-n><C-w>k
tnoremap <silent> <LocalLeader>it <C-\><C-n><C-w>j
tnoremap <silent> <LocalLeader>ic <C-\><C-n><C-w>h
tnoremap <silent> <LocalLeader>ir <C-\><C-n><C-w>l
tnoremap <silent> <LocalLeader>d <C-\><C-n>
tnoremap <silent> <LocalLeader>q <C-\><C-n>:bd!<CR>
tnoremap <silent> <LocalLeader>r <C-\><C-n>
tnoremap <silent> <LocalLeader>c <C-\><C-n>
endif
let g:molokai_original=1
let g:necoghc_enable_detailed_browse=1
set hidden
"autocmd needed due to vam usage
autocmd VimEnter *.hs,*,*.lhs,*.chs,*.hsc colorscheme molokai
autocmd VimEnter *.scala colorscheme molokai
"text tag custo
au Bufenter *.fountain setf fountain
au Bufenter Cargo.toml setf cargo
au Bufenter *.txt set concealcursor=n
au Bufenter *.txt set conceallevel=1
au Bufenter *.txt syntax match SpanEnd "</span>" conceal
au Bufenter *.txt syntax match SpanSta "<span.\{-}>" conceal cchar=T
"au Bufenter *.txt let b:surround_106 = "<span itemtype='tag' itemprop=''>\r</span>}"
"encodings
set fileencodings=ucs-bom,utf-8,sjis,default,latin-1
set t_Co=256
"for airline display always
set laststatus=2
set noshowmode
set guifont=Deja\ Vu\ Sans\ Mono\ for\ Powerline
let g:airline_powerline_fonts=1
let g:airline#extensions#tabline#enabled=1
let g:airline_detect_modified=1
let g:airline_detect_paste=1
let g:airline_exclude_preview=0
let g:airline#extensions#syntastic#enabled=1
"tagbar
let g:tagbar_type_rust = {
\ 'ctagstype' : 'Rust',
\ 'kinds' : [
\ 'd:macros:1:0',
\ 'g:enums',
\ 'T:types:0:0',
\ 'm:modules',
\ 'c:consts',
\ 't:traits',
\ 'i:impls',
\ 's:struct',
\ 'f:functions',
\ ],
\ 'sro' : '::',
\ }
"align mapping temporary (cnext fastened by tt) TODO switch to another align
"plugin eg vim-easy-align
map <Leader>a <Plug>AM_t
map <Leader>aa <Plug>AM_tt
"haskell tabs
au Bufenter *.hs,*,*.lhs,*.chs,*.hsc set expandtab
au Bufenter *.hs,*,*.lhs,*.chs,*.hsc set tabstop=2
"haskell align
" p0P1Wlg ^.*,.* , p1P0Wlg ^.*[.* [
au Bufenter *.hs,*,*,*.lhs,*.chs,*.hsc AlignCtrl p1P1Wl:g ^.*=.* =
au Bufenter *.hs,*,*,*.lhs,*.chs,*.hsc :vnoremap aa :Align = <CR>
au Bufenter *.hs,*,*,*.lhs,*.chs,*.hsc :vnoremap a( :Align! p1P0Wl:g ^.*(.* ( <CR>
au Bufenter *.hs,*,*,*.lhs,*.chs,*.hsc :vnoremap at :Align! p0P1Wl:g * , [ <CR>
au Bufenter *.hs,*,*,*.lhs,*.chs,*.hsc :vnoremap A( :Align! p1P0Wlg ^.*(.* ( <CR>
au Bufenter *.hs,*,*,*.lhs,*.chs,*.hsc :vnoremap At :Align! p0P1Wlg * , [ <CR>
au Bufenter *.hs,*,*,*.lhs,*.chs,*.hsc :setlocal autoindent
au Bufenter *.hs,*,*,*.lhs,*.chs,*.hsc let b:ghc_staticoptions = '-package-db=.cabal-sandbox/x86_64-linux-ghc-7.8.3-packages.conf.d/'
let g:syntastic_haskell_ghc_mod_args = '-g -package-db=.cabal-sandbox/x86_64-linux-ghc-7.8.3-packages.conf.d/'
"au Bufenter *.hs,*,*,*.lhs,*.chs,*.hsc let g:ghcmod_ghc_options = ['-package-db=cabal-dev/packages-7.6.3.conf']
au Bufenter *.hs,*.lhs,*.chs,*.hsc compiler ghc "this line creat big space at bottom : see if we can remove it
au Bufenter *.hs,*.lhs,*.chs,*.hsc,*txt iabbrev » ->
au Bufenter *.hs,*.lhs,*.chs,*.hsc,*txt iabbrev « <-
"Haskell surround comment 99 is char2nr("c") h ascii 104
au Bufenter *.hs,*.lhs,*.chs,*.hsc let b:surround_99 = "{- \r -}"
au Bufenter *.hs,*.lhs,*.chs,*.hsc let b:surround_104 = "{- | \r -}"
au Bufenter *.hs,*.lhs,*.chs,*.hsc let b:surround_40 = "(\r)"
"au Bufenter *.hs setlocal path += 'cabal-dev/bin'
au Bufenter *.hs,*,*,*.lhs,*.chs,*.hsc setlocal foldmethod=marker
au Bufenter *.hs,*,*,*.lhs,*.chs,*.hsc :nn <LocalLeader>g <C-]>
au Bufenter *.scala :nn <LocalLeader>g <C-]>
au Bufenter *.hs,*,*,*.lhs,*.chs,*.hsc :nn <F2> :w<cr>:call GHC_CreateTagfile()<cr>
au Bufenter *.hs,*,*,*.lhs,*.chs,*.hsc :nn <F3> :w<cr>:!make<RETURN>
au Bufenter *.hs,*,*,*.lhs,*.chs,*.hsc :nn <F4> :w<cr>:make<RETURN>:cwindow<RETURN>
au Bufenter *.hs,*,*,*.lhs,*.chs,*.hsc :inoremap <C-e> <C-X><C-U>
let g:haddock_browser="firefox"
let g:haddock_indexfiledir="/home/emeric/.vim/indexhaddock/"
if !has("gui_running")
let g:haddock_browser_callformat = '%s %s &'
endif
"launch manually haddock_doc -- disabled : segfault!!!!
"au Bufenter *.hs,*,*,*.lhs,*.chs,*.hsc :source /home/emeric/.vim/HaskellMode/ftplugin/haskell_doc.vim
"au Bufenter *.hs,*.lhs,*.chs,*.hsc let g:haddock_launched="ok"
"-----------
set wildmenu
set wildmode=list:longest,full
set mouse=a
colorscheme desert
set encoding=utf-8
set fileencoding=utf-8
set guioptions-=m "remove menu bar
set guioptions-=T "remove toolbar
set guioptions-=r "remove right-hand scroll bar
syntax enable
nn <F9> :bp<cr>
nn <F10> :bn<cr>
"Nul is for terminal ctr space
inoremap <Nul> <C-X><C-O>
inoremap <C-Space> <C-X><C-O>
" {W} -> [É]
"
" On remappe W sur É :
noremap é w
noremap É W
" Corollaire, pour effacer/remplacer un mot quand on nest pas au début (daé / laé).
" (attention, cela diminue la réactivité du {A}
)
"noremap aé aw
"noremap aÉ aW
" Pour faciliter les manipulations de fenêtres, on utilise {W} comme un Ctrl+W :
noremap w <C-w>
noremap W <C-w><C-w>
" [HJKL] -> {CTSR}
"
" {cr} = « gauche / droite »
noremap c h
noremap r l
" {ts} = « haut / bas »
noremap t j
noremap s k
" {CR} = « haut / bas de l'écran »
noremap C H
noremap R L
" {TS} = « joindre / aide »
noremap T J
noremap S K
" Corollaire : repli suivant / précédent
noremap zs zj
noremap zt zk
" {HJKL} <- [CTSR]
"
" {J} = « Jusqu'à » (j = suivant, J = précédant)
noremap j t
noremap J T
" {L} = « Change » (h = bloc, H = jusqu'à la fin de ligne)
noremap l c
noremap L C
" {H} = « Remplace » (l = caractère, L = texte)
noremap h r
noremap H R
" {K} = « Substitue » (k = caractère, K = ligne)
noremap k s
noremap K S
" Corollaire : correction orthographique
noremap ]k ]s
noremap [k [s
" Désambiguation de {g}
"
" ligne écran précédente / suivante (à l'intérieur d'une phrase)
noremap gs gk
noremap gt gj
" onglet précédant / suivant
noremap gb gT
noremap gé gt
" optionnel : {gB} / {gÉ} pour aller au premier / dernier onglet
noremap gB :exe "silent! tabfirst"<CR>
noremap gÉ :exe "silent! tablast"<CR>
" optionnel : {g"} pour aller au début de la ligne écran
noremap g" g0
" map x buffer
noremap P "+p
noremap Y "+y
" <> en direct
"
noremap « <
noremap » >
vmap <Tab> >gv
vmap <S-Tab> <gv
snoremap c c
snoremap r r
snoremap s s
snoremap t t
snoremap C C
snoremap R R
snoremap S S
snoremap T T
snoremap h h
snoremap H H
" remap for help navigation
autocmd FileType help :nnoremap <buffer> <CR> <C-]>
autocmd FileType help :nnoremap <buffer> <BS> <C-T>
" remap for quickfix navigation
autocmd FileType qf :nnoremap <buffer> r <CR>
autocmd FileType qf :nnoremap <buffer> R l
" surround plugin 'autocmd' for unmap after plugin launch
autocmd VimEnter * nunmap cs
autocmd VimEnter * nunmap cS
autocmd VimEnter * nmap gs <Plug>Csurround
autocmd Filetype rust setlocal sts=2 ts=2 sw=2 expandtab
autocmd VimEnter * AirlineRefresh
"Nerdtree custo
nn <silent> <C-t> :NERDTreeToggle<CR>
"nn <F11> :NERDTreeFind
"nn <F10> :NERDTreeCWD
let NERDTreeMapOpenInTab="j"
let NERDTreeMapOpenInTabSilent="J"
let NERDTreeMapOpenVSplit="l"
let NERDTreeMapJumpParent="c"
let NERDTreeMapActivateNode="r"
let NERDTreeMapJumpNextSibling="T"
let NERDTreeMapJumpPrevSibling="S"
let NERDTreeMapRefresh="h"
let NERDTreeMapRefreshRoot="H"
let NERDTreeMapChdir="gD"
let NERDTreeMapCWD="gd"
let NERDTreeMapOpenVSplit="gs"
"silversearche custo
if executable('rg')
set grepprg=rg\ --no-heading\ --color\ never\ --column
" set grepprg=ag\ --nogroup\ --nocolor\ --column
let g:ctrlp_use_caching = 0
nnoremap K :grep! "\b<C-R><C-W>\b"<CR>:cw<CR>
" command -nargs=+ -complete=file -bar Ag silent! grep! <args>|cwindow|redraw!
endif
"Command navigation
nmap <silent> <RIGHT> :cnext<CR>
nmap <silent> <LEFT> :cprev<CR>
nmap <silent> <LocalLeader>s :cnext<CR>
nmap <silent> <LocalLeader>t :cprev<CR>
nmap <silent> <LocalLeader>d :bd<CR>
nmap <silent> <LocalLeader>r :bn<CR>
nmap <silent> <LocalLeader>c :bp<CR>
nmap <silent> <LocalLeader>is <C-w>k
nmap <silent> <LocalLeader>it <C-w>j
nmap <silent> <LocalLeader>ic <C-w>h
nmap <silent> <LocalLeader>ir <C-w>l
nmap <silent> <LocalLeader>w :w<CR>
autocmd FileType nerdtree noremap <buffer> t <down>
autocmd FileType nerdtree noremap <buffer> s <up>