3 " autocmd! BufWritePost,BufEnter * Neomake
6 function! SourceIfExists(file)
7 if filereadable(expand(a:file))
13 call SourceIfExists("~/.vim/vim.nvim")
16 call SourceIfExists("~/.vim/vim.vim")
19 hi Comment ctermfg=black ctermbg=NONE cterm=bold
20 "hi Comment ctermfg=darkgray cterm=bold
21 hi Conceal ctermfg=black ctermbg=NONE cterm=bold
22 hi CursorLine cterm=none guibg=NONE
23 hi CursorLineNr ctermfg=white cterm=NONE
24 hi FoldColumn ctermfg=black ctermbg=none cterm=bold
25 hi Folded ctermfg=black ctermbg=NONE cterm=bold
26 hi LineNr ctermfg=black ctermbg=none cterm=bold
27 hi Pmenu ctermbg=magenta ctermfg=black
28 hi PmenuSbar ctermfg=gray ctermbg=black
29 hi PmenuSel ctermbg=darkmagenta ctermfg=black
30 hi PmenuThumb ctermfg=white
31 hi Search ctermfg=black ctermbg=yellow
32 hi SignColumn ctermbg=black
33 hi SpecialKey ctermfg=black cterm=bold
34 hi SpellBad ctermfg=white
35 hi StatusLine term=bold,reverse ctermfg=white ctermbg=blue cterm=none
36 hi StatusLineNC term=reverse ctermfg=blue ctermbg=none cterm=underline
37 hi Visual ctermfg=black ctermbg=yellow cterm=none
38 hi WarningMsg ctermbg=darkyellow ctermfg=white
39 au FileType xml hi xmlAttrib ctermfg=green
40 au FileType xslt hi xmlNamespace ctermfg=red
41 au FileType xslt hi xmlAttrib ctermfg=green
42 au FileType * hi Special ctermfg=red
43 "au FileType haskell hi Comment ctermfg=DarkGreen
44 au FileType haskell hi Identifier ctermfg=LightGray
46 " Search term under cursor
47 nmap <silent> * :set hls<CR>:let @/="\\<<C-r><C-w>\\>"<CR>/<BS>
48 nmap <silent> <C-n> :set hls<CR>:call Vimgrepbuffers('\<' . expand('<cword>') . '\>')<CR>
49 " Search subterm under cursor
50 nmap <silent> µ :set hls<CR>:let @/="<C-r><C-w>"<CR>/<BS>
51 nmap <silent> <C-m> :set hls<CR>:call Vimgrepbuffers(expand('<cword>'))<CR>
53 fun! Vimgrepbuffers(pattern)
54 exe 'vimgrep /' . a:pattern . '/g ' . getbufinfo({'buflisted': 1})->map({_,b -> fnameescape(b.name)})->join(' ')
58 " If focus changed, restore it (jump to the last window).
59 if l:winnr isnot# winnr()
63 command! -nargs=1 G set hls | call Vimgrepbuffers(<f-args>)
80 " Maintain Visual Mode after shifting > and <
85 vmap I :m '<-2<CR>gv=gv
86 vmap K :m '>+1<CR>gv=gv
89 " Fix <Home>, <End>, <C-Left>, etc. when vim is in tmux;
90 " tmux will send xterm-style keys when xterm-keys is on
91 execute "set <xHome>=\e[7~"
92 execute "set <xEnd>=\e[8~"
93 execute "set <xRight>=\e[1;*C"
94 execute "set <xLeft>=\e[1;*D"
95 execute "set <xUp>=\e[1;*A"
96 execute "set <xDown>=\e[1;*B"
104 set completeopt=menu,menuone,popup,longest
107 set cpoptions+=M " ignore backslashes in % matching
109 execute "silent !mkdir -p ~/.cache/" . EDITOR . "/swap"
110 execute "set directory=$HOME/.cache/" . EDITOR . "/swap"
112 set diffopt=internal,filler,closeoff,algorithm:histogram,indent-heuristic
118 function! GetFoldExprFromIndent()
119 " Calcule l'indentation en fonction des tabulations
120 " et espaces au début des lignes
121 let line = getline(v:lnum)
122 let tabs = matchend(line,"^\t*")
123 let spaces = matchend(line,"^[ \t]*") - tabs
124 return tabs + ((spaces + 3) / 4)
126 set foldexpr=GetFoldExprFromIndent()
128 set foldlevelstart=99
129 set foldmethod=indent
139 set path=.,/usr/include,/usr/local/include,,
149 set maxmempattern=2000
159 "set runtimepath=$HOME/.$EDITOR,$VIMRUNTIME,$VIM
160 set sessionoptions=curdir,folds
164 "set statusline+=\ %l:%c
165 "set statusline=\ %{get(b:,'coc_current_function','')}
167 "set statusline+=%#ErrorMsg#%{CocStatusDiagnosticError()}%*
168 "set statusline+=\ %{CocStatus()}
169 set statusline+=%{LinterStatus()}
170 set statusline+=\ %m%R\ %Y
176 execute "silent !mkdir -p ~/.cache/" . EDITOR . "/view"
177 execute "set viewdir=$HOME/.cache/" . EDITOR . "/view"
178 execute "set viminfo+=n$HOME/.cache/" . EDITOR . "/info"
181 set whichwrap+=<,>,[,]
182 set wildignore=*.a,*.d,*.o,*.so,*~,*.cmo,*.cmi,*.cmx,*.cmxs,*.cma,*.cmxa,*.byte,*.native,*.hi
184 set wildmode=list:longest,full
187 " When editing a file, always jump to the last known cursor position.
188 " Don't do it when the position is invalid or when inside an event handler
189 " (happens when dropping a file on gvim).
190 autocmd BufReadPost *
191 \ if line("'\"") > 0 && line("'\"") <= line("$") |
192 \ exe "normal g`\"" |
195 if (&term == "screen" || &term =~ "^screen")
199 if has("gui_running")
202 set titlestring=VIM:\ %F\ %a%r%m
213 "set titlestring=%t%(\ %M%)%(\ (%{expand(\"%:p:h\")})%)%(\ %a%)\ -\ %{v:servername}
214 auto BufEnter * :set title | let &titlestring = 'VIM: ' . expand('%:p')
215 "auto VimLeave * :set t_ts=
\ek
\e\
217 let space = &shiftwidth == 0 ? &tabstop : &shiftwidth
218 if (&term == "linux" || &term =~ "^screen")
219 "set foldtext=substitute(getline(v\:foldstart),'^\\(\\s*\\)',{m->substitute(m[1],'\\('.repeat('\ ',&shiftwidth).'\\\|\\t\\)','\|'.repeat('.',&shiftwidth-1),'g')},'').'\ \ ('.(v\:foldend-v\:foldstart+1).')\ '
220 "set fillchars=fold:_
221 set list listchars=nbsp:+,tab:\|.,trail:_,extends:>,precedes:<
222 set foldtext=getline(v\:foldstart).'\ \ ('.(v\:foldend-v\:foldstart+1).')\ '
224 "set foldtext=substitute(getline(v\:foldstart),'^\\(\\s*\\)',{m->substitute(m[1],'\\('.repeat('\ ',&shiftwidth).'\\\|\\t\\)','⎢'.repeat('·',&shiftwidth-1),'g')},'').'\ \ ('.(v\:foldend-v\:foldstart+1).')\ '
225 "set fillchars=fold:·
226 set foldtext=getline(v\:foldstart).'\ \ ('.(v\:foldend-v\:foldstart+1).')\ '
227 set list listchars=nbsp:¬,tab:⎢·,trail:·,extends:>,precedes:<
230 "let g:indentLine_char_list = ['⎢']
231 "" Concealed text is not highlighted by the visual mode, this is annoying.
232 ""let g:indentLine_concealcursor = 'incv'
233 "let g:indentLine_faster = 1
234 "let g:indentLine_first_char = '⎢'
235 "let g:indentLine_leadingSpaceChar = '·'
236 "let g:indentLine_leadingSpaceEnabled = 1
237 "let g:indentLine_showFirstIndentLevel = 1
238 "let g:indentLine_bgcolor_term = 'NONE'
239 "let g:indentLine_defaultGroup = 'Folded'
241 if (v:version >= 700)
242 hi TabLine term=bold,reverse ctermfg=white ctermbg=blue cterm=none
243 hi TabLineFill term=bold,reverse ctermfg=none ctermbg=blue cterm=none
244 hi TabLineSel term=reverse ctermfg=white ctermbg=none cterm=bold
245 imap <C-S-tab> <Esc>:tabprevious<CR>i
246 imap <C-t> <Esc>:tabnew<CR>
247 imap <C-tab> <Esc>:tabnext<CR>i
248 nmap <C-S-tab> :tabprevious<CR>
249 nmap <Esc><tab> :bnext<CR>
250 nmap <C-t> :tabnew<CR>
251 "nmap <C-tab> :tabprevious<CR>
252 "nmap <tab> :tabnext<CR>
253 nmap <C-tab> :bprevious!<CR>
254 nmap <tab> :bnext!<CR>
255 nmap td :tabclose<CR>
256 nmap ti :tabfirst<CR>
261 nmap tn :tabnew<Space>
262 nmap tt :tabedit<Space>
263 nmap <C-i> :bprevious!<CR>
264 nmap <C-k> :bnext!<CR>
265 nmap <C-j> :lprevious<CR>
266 nmap <C-l> :lnext<CR>
267 nmap <C-u> :cprevious<CR>
268 nmap <C-o> :cnext<CR>
269 nmap <C-w>k :wincmd j<CR>
270 nmap <C-w>i :wincmd k<CR>
271 nmap <C-w>j :wincmd h<CR>
272 nmap <C-w>l :wincmd l<CR>
274 set sessionoptions+=tabpages
276 if (v:version >= 704)
277 execute "silent !mkdir -p ~/.cache/" . EDITOR . "/undo"
278 execute "set undodir=$HOME/.cache/" . EDITOR . "/undo"
280 autocmd BufWritePre /tmp/* setlocal noundofile
281 autocmd BufWritePre */sec/* setlocal noundofile
283 fun! TrimWhitespace()
284 let l:save = winsaveview()
285 keeppatterns %s/\s\+$//e
286 call winrestview(l:save)
288 autocmd BufRead .envrc setfiletype sh
289 "autocmd BufRead *.hamlet setfiletype html
290 "autocmd BufRead *.julius setfiletype javascript
291 "autocmd BufRead *.lucius setfiletype css
292 autocmd BufRead *.ledger setfiletype ledger
293 autocmd BufRead *.lhs setfiletype haskell
294 autocmd BufRead HLint.hs setfiletype txt
295 autocmd BufRead *.purs
296 \ setfiletype purescript |
298 "autocmd BufRead *.nix set syntax=zsh | set expandtab
299 autocmd BufNewFile,BufRead *.nix
300 \ hi nixAntiquotation ctermfg=cyan |
303 \ set foldmethod=indent
304 autocmd BufWritePre *.nix :call TrimWhitespace()
305 autocmd BufNewFile,BufRead *.py
309 autocmd BufNewFile,BufRead *.hs set expandtab
310 autocmd BufNewFile,BufRead *.tct set filetype=tct | set expandtab
311 autocmd BufWritePost * if &diff == 1 | diffupdate | endif
314 autocmd FileType qf setlocal wrap
317 " If doing a diff. Upon writing changes to file, automatically update the differences
322 let b:match_words = '«:»,“:”'
324 nmap <Leader>a <Plug>(EasyAlign)
325 vmap <Enter> <Plug>(EasyAlign)
326 let g:easy_align_ignore_groups = ['Comment', 'String', 'ledgerTransaction', 'ledgerTag', 'jccComment', 'jccTransaction']
328 let g:netrw_liststyle = 3
329 "let g:netrw_cursorline = 0
330 let s:netrw_usercul = 0
333 let g:buffergator_display_regime = "bufname"
334 let g:buffergator_show_full_directory_path = 0
335 let g:buffergator_viewport_split_policy = 'R'
336 let g:buffergator_autoupdate = 1
337 let g:buffergator_autodismiss_on_select = 0
338 let g:buffergator_suppress_keymaps = 1
339 nmap <leader>bq :bp <BAR> bd #<CR>
340 "let g:buffergator_mru_cycle_loop = 1
341 nmap <leader>i :BuffergatorMruCyclePrev<cr>
342 nmap <leader>k :BuffergatorMruCycleNext<cr>
343 nmap <leader>bl :BuffergatorOpen<cr>
344 nmap <leader>T :enew<cr>
345 set cpoptions+=M " ignore backslashes in % matching
347 let g:html_expand_tabs = 0
348 let g:html_ignore_conceal = 0
349 let g:html_ignore_folding = 1
350 let g:html_number_lines = 0
351 let g:html_use_xhtml = 0
353 "map <C-p> :CtrlPBuffer<CR>
354 "let g:ctrlp_working_path_mode = 'c'
355 "let g:ctrlp_map = '<Leader>t'
356 "let g:ctrlp_match_window_bottom = 0
357 "let g:ctrlp_match_window_reversed = 0
358 "let g:ctrlp_custom_ignore = '\v\~$|\.(o|swp|pyc|wav|mp3|ogg|blend)$|(^|[/\\])\.(hg|git|bzr)($|[/\\])|__init__\.py'
359 "let g:ctrlp_working_path_mode = 0
360 "let g:ctrlp_dotfiles = 0
361 "let g:ctrlp_switch_buffer = 0
364 "map <silent> tu :call GHC_BrowseAll()<CR>
365 "map <silent> tw :call GhcModType<CR>
366 map <silent> hc :GhcModTypeClear<CR>
367 map <silent> he :GhcModExpand<CR>
368 map <silent> hi :GhcModTypeInsert<CR>
369 map <silent> hs :GhcModSigCodegen<CR>
370 map <silent> hs :GhcModSplitFunCase<CR>
371 map <silent> ht :GhcModType<CR>
375 nmap <F5> :Hoogle <C-R><C-W><CR>
377 "let g:TimeKeeperUpdateFileTimeSec = 5
378 ""let g:TimeKeeperStartOnLoad = 1
379 "let g:TimeKeeperUseFlatFile = 0
380 "nmap <silent> <F8> :call TimeKeeper_ToggleTaskWindow()<cr>
381 "call TimeKeeper_StartTracking()
383 let g:RecoverPlugin_Delete_Unmodified_Swapfile = 1
385 let g:calendar_number_of_months = 1
386 let g:calendar_wruler = 'di lu ma me je ve sa'
387 let g:calendar_monday = 1
388 function MyCalAction(day,month,year,week,dir)
389 " day : day you actioned
390 " month : month you actioned
391 " year : year you actioned
392 " week : day of week (Mo=1 ... Su=7)
393 " dir : direction of calendar
395 "let calendar_action = 'MyCalAction'
396 "hi link ALEError Error
397 "hi Warning term=underline cterm=underline ctermfg=Yellow gui=undercurl guisp=Gold
398 "hi link ALEWarning Warning
399 "hi link ALEInfo SpellCap
401 "let g:echodoc#enable_at_startup = 1
402 "let g:echodoc#type = 'signature'
404 "let g:gitgutter_grep = 'rg'
405 let g:gitgutter_grep = 'grep'
406 let g:gitgutter_diff_args = '--diff-algorithm=histogram'
407 let g:gitgutter_map_keys = 0
408 let g:gitgutter_sign_added = '+'
409 let g:gitgutter_sign_modified = '±'
410 let g:gitgutter_sign_modified_removed = '-'
411 let g:gitgutter_sign_removed = '_'
412 let g:gitgutter_sign_removed_first_line = '▔'
413 let g:gitgutter_sign_priority = 9
414 hi GitGutterAdd ctermfg=green
415 hi GitGutterDelete ctermfg=red
416 hi GitGutterChange ctermfg=yellow
417 hi GitGutterChangeDelete ctermfg=red
418 nmap [c <Plug>(GitGutterPrevHunk)
419 nmap ]c <Plug>(GitGutterNextHunk)
420 nmap <Leader>p <Plug>(GitGutterPreviewHunk)
421 nmap <Leader>+ <Plug>(GitGutterStageHunk)
422 nmap <Leader>- <Plug>(GitGutterUndoHunk)
424 "let g:deoplete#enable_at_startup = 1
425 "call deoplete#custom#option('sources', {
426 "\ '_': ['ale', 'buffer', 'around'],