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