-
Notifications
You must be signed in to change notification settings - Fork 184
/
.vimrc
685 lines (550 loc) · 21.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
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
" -----------------------------------------------------------------------------
" This config is targeted for Vim 8.1+ and expects you to have Plug installed.
" -----------------------------------------------------------------------------
" -----------------------------------------------------------------------------
" Plugins
" -----------------------------------------------------------------------------
" Specify a directory for plugins.
call plug#begin('~/.vim/plugged')
" Atom One Dark / Light theme.
Plug 'rakr/vim-one'
" Gruvbox Community theme.
Plug 'gruvbox-community/gruvbox'
" Integrate fzf with Vim.
Plug '$XDG_DATA_HOME/fzf'
Plug 'junegunn/fzf.vim'
" Better manage Vim sessions.
Plug 'tpope/vim-obsession'
" Zoom in and out of a specific split pane (similar to tmux).
Plug 'dhruvasagar/vim-zoom'
" Pass focus events from tmux to Vim (useful for autoread and linting tools).
Plug 'tmux-plugins/vim-tmux-focus-events'
" Navigate and manipulate files in a tree view.
Plug 'lambdalisue/fern.vim'
Plug 'lambdalisue/fern-mapping-mark-children.vim'
" Helpers for moving and manipulating files / directories.
Plug 'tpope/vim-eunuch'
" Run a diff on 2 directories.
Plug 'will133/vim-dirdiff'
" Run a diff on 2 blocks of text.
Plug 'AndrewRadev/linediff.vim'
" Add spelling errors to the quickfix list (vim-ingo-library is a dependency).
Plug 'inkarkat/vim-ingo-library' | Plug 'inkarkat/vim-SpellCheck'
" Briefly highlight which text was yanked.
Plug 'machakann/vim-highlightedyank'
" Highlight which character to jump to when using horizontal movement keys.
Plug 'unblevable/quick-scope'
" Modify * to also work with visual selections.
Plug 'nelstrom/vim-visual-star-search'
" Automatically clear search highlights after you move your cursor.
Plug 'haya14busa/is.vim'
" Handle multi-file find and replace.
Plug 'mhinz/vim-grepper'
" Better display unwanted whitespace.
Plug 'ntpeters/vim-better-whitespace'
" Toggle comments in various ways.
Plug 'tpope/vim-commentary'
" Automatically set 'shiftwidth' + 'expandtab' (indention) based on file type.
Plug 'tpope/vim-sleuth'
" A number of useful motions for the quickfix list, pasting and more.
Plug 'tpope/vim-unimpaired'
" Drastically improve insert mode performance in files with folds.
Plug 'Konfekt/FastFold'
" Show git file changes in the gutter.
Plug 'mhinz/vim-signify'
" A git wrapper.
Plug 'tpope/vim-fugitive'
" Dim paragraphs above and below the active paragraph.
Plug 'junegunn/limelight.vim'
" Distraction free writing by removing UI elements and centering everything.
Plug 'junegunn/goyo.vim'
" A bunch of useful language related snippets (ultisnips is the engine).
Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
" Automatically show Vim's complete menu while typing.
Plug 'vim-scripts/AutoComplPop'
" Run test suites for various languages.
Plug 'janko/vim-test'
" Languages and file types.
Plug 'cakebaker/scss-syntax.vim'
Plug 'chr4/nginx.vim'
Plug 'chrisbra/csv.vim'
Plug 'ekalinin/dockerfile.vim'
Plug 'elixir-editors/vim-elixir'
Plug 'Glench/Vim-Jinja2-Syntax'
Plug 'fatih/vim-go'
Plug 'phelipetls/vim-hugo'
Plug 'cespare/vim-toml', { 'branch': 'main' }
Plug 'godlygeek/tabular' | Plug 'tpope/vim-markdown'
Plug 'iamcco/markdown-preview.nvim', { 'do': 'cd app & yarn install' }
Plug 'jvirtanen/vim-hcl'
Plug 'lifepillar/pgsql.vim'
Plug 'othree/html5.vim'
Plug 'pangloss/vim-javascript'
Plug 'MaxMEllon/vim-jsx-pretty'
Plug 'PotatoesMaster/i3-vim-syntax'
Plug 'stephpy/vim-yaml'
Plug 'tmux-plugins/vim-tmux'
Plug 'tpope/vim-git'
Plug 'tpope/vim-liquid'
Plug 'tpope/vim-rails'
Plug 'vim-python/python-syntax'
Plug 'vim-ruby/vim-ruby'
Plug 'wgwoods/vim-systemd-syntax'
Plug 'towolf/vim-helm'
Plug 'hashivim/vim-terraform'
call plug#end()
" -----------------------------------------------------------------------------
" Color settings
" -----------------------------------------------------------------------------
" Enable 24-bit true colors if your terminal supports it.
if (has("termguicolors"))
" https://github.com/vim/vim/issues/993#issuecomment-255651605
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
set termguicolors
endif
" Enable syntax highlighting.
syntax on
" Specific colorscheme settings (must come before setting your colorscheme).
if !exists('g:gruvbox_contrast_light')
let g:gruvbox_contrast_light='hard'
endif
" Set the color scheme.
colorscheme gruvbox
set background=dark
" Specific colorscheme settings (must come after setting your colorscheme).
if (g:colors_name == 'gruvbox')
if (&background == 'dark')
hi Visual cterm=NONE ctermfg=NONE ctermbg=237 guibg=#3a3a3a
else
hi Visual cterm=NONE ctermfg=NONE ctermbg=228 guibg=#f2e5bc
hi CursorLine cterm=NONE ctermfg=NONE ctermbg=228 guibg=#f2e5bc
hi ColorColumn cterm=NONE ctermfg=NONE ctermbg=228 guibg=#f2e5bc
endif
endif
" Spelling mistakes will be colored up red.
hi SpellBad cterm=underline ctermfg=203 guifg=#ff5f5f
hi SpellLocal cterm=underline ctermfg=203 guifg=#ff5f5f
hi SpellRare cterm=underline ctermfg=203 guifg=#ff5f5f
hi SpellCap cterm=underline ctermfg=203 guifg=#ff5f5f
" -----------------------------------------------------------------------------
" Status line
" -----------------------------------------------------------------------------
" Heavily inspired by: https://github.com/junegunn/dotfiles/blob/master/vimrc
function! s:statusline_expr()
let mod = "%{&modified ? '[+] ' : !&modifiable ? '[x] ' : ''}"
let ro = "%{&readonly ? '[RO] ' : ''}"
let ft = "%{len(&filetype) ? '['.&filetype.'] ' : ''}"
let fug = "%{exists('g:loaded_fugitive') ? fugitive#statusline() : ''}"
let sep = ' %= '
let pos = ' %-12(%l : %c%V%) '
let pct = ' %P'
return '[%n] %f %<'.mod.ro.ft.fug.sep.pos.'%*'.pct
endfunction
let &statusline = s:statusline_expr()
" -----------------------------------------------------------------------------
" Basic Settings
" Research any of these by running :help <setting>
" -----------------------------------------------------------------------------
let mapleader=" "
let maplocalleader=" "
" Use a line cursor within insert mode and a block cursor everywhere else.
"
" Using iTerm2? Go-to preferences / profile / colors and disable the smart bar
" cursor color. Then pick a cursor and highlight color that matches your theme.
" That will ensure your cursor is always visible within insert mode.
"
" Reference chart of values:
" Ps = 0 -> blinking block.
" Ps = 1 -> blinking block (default).
" Ps = 2 -> steady block.
" Ps = 3 -> blinking underline.
" Ps = 4 -> steady underline.
" Ps = 5 -> blinking bar (xterm).
" Ps = 6 -> steady bar (xterm).
let &t_SI = "\e[6 q"
let &t_EI = "\e[2 q"
set autoindent
set autoread
set backspace=indent,eol,start
set backupdir=/tmp//,.
set clipboard=unnamedplus,unnamed
set colorcolumn=80
set complete+=kspell
set completeopt=menuone,longest
set cursorline
set directory=/tmp//,.
set encoding=utf-8
set expandtab smarttab
set formatoptions=tcqrn1
set hidden
set hlsearch
set ignorecase
set incsearch
set laststatus=2
set matchpairs+=<:> " Use % to jump between pairs
set mmp=5000
set modelines=2
set mouse=a
set nocompatible
set noerrorbells visualbell t_vb=
set noshiftround
set nospell
set nostartofline
set number relativenumber
set regexpengine=1
set ruler
set scrolloff=0
set shiftwidth=2
set showcmd
set showmatch
set shortmess+=c
set shortmess-=S
set showmode
set smartcase
set softtabstop=2
set spelllang=en_us
set splitbelow
set splitright
set tabstop=2
set textwidth=0
set ttimeout
set timeoutlen=1000
set ttimeoutlen=0
set ttyfast
if !has('nvim')
set ttymouse=sgr
endif
set undodir=/tmp
set undofile
set virtualedit=block
set whichwrap=b,s,<,>
set wildmenu
set wildmode=full
set wrap
runtime! macros/matchit.vim
" -----------------------------------------------------------------------------
" Basic mappings
" -----------------------------------------------------------------------------
" Seamlessly treat visual lines as actual lines when moving around.
noremap j gj
noremap k gk
noremap <Down> gj
noremap <Up> gk
inoremap <Down> <C-o>gj
inoremap <Up> <C-o>gk
" Navigate around splits with a single key combo.
nnoremap <C-l> <C-w><C-l>
nnoremap <C-h> <C-w><C-h>
nnoremap <C-k> <C-w><C-k>
nnoremap <C-j> <C-w><C-j>
" Cycle through splits.
nnoremap <S-Tab> <C-w>w
" Press * to search for the term under the cursor or a visual selection and
" then press a key below to replace all instances of it in the current file.
nnoremap <Leader>r :%s///g<Left><Left>
nnoremap <Leader>rc :%s///gc<Left><Left><Left>
" The same as above but instead of acting on the whole file it will be
" restricted to the previously visually selected range. You can do that by
" pressing *, visually selecting the range you want it to apply to and then
" press a key below to replace all instances of it in the current selection.
xnoremap <Leader>r :s///g<Left><Left>
xnoremap <Leader>rc :s///gc<Left><Left><Left>
" Type a replacement term and press . to repeat the replacement again. Useful
" for replacing a few instances of the term (comparable to multiple cursors).
nnoremap <silent> s* :let @/='\<'.expand('<cword>').'\>'<CR>cgn
xnoremap <silent> s* "sy:let @/=@s<CR>cgn
" Clear search highlights.
map <Leader><Space> :let @/=''<CR>
" Format paragraph (selected or not) to 80 character lines.
nnoremap <Leader>g gqap
xnoremap <Leader>g gqa
" Prevent x and the delete key from overriding what's in the clipboard.
noremap x "_x
noremap X "_x
noremap <Del> "_x
" Prevent selecting and pasting from overwriting what you originally copied.
xnoremap p pgvy
" Keep cursor at the bottom of the visual selection after you yank it.
vmap y ygv<Esc>
" Edit Vim config file in a new tab.
map <Leader>ev :tabnew $MYVIMRC<CR>
" Source Vim config file.
map <Leader>sv :source $MYVIMRC<CR>
" Toggle spell check.
nnoremap <F5> :setlocal spell!<CR>
inoremap <F5> <C-o>:setlocal spell!<CR>
" Toggle relative line numbers and regular line numbers.
nnoremap <F6> :set relativenumber!<CR>
inoremap <F6> <C-o>:set relativenumber!<CR>
" Copy the current buffer's path to your clipboard.
nmap cp :let @+ = expand("%")<CR>
" Automatically fix the last misspelled word and jump back to where you were.
" Taken from this talk: https://www.youtube.com/watch?v=lwD8G1P52Sk
nnoremap <leader>sp :normal! mz[s1z=`z<CR>
" Toggle visually showing all whitespace characters.
nnoremap <F7> :set list!<CR>
inoremap <F7> <C-o>:set list!<CR>
" Move 1 more lines up or down in normal and visual selection modes.
nnoremap <C-k> :m .-2<CR>==
nnoremap <C-j> :m .+1<CR>==
vnoremap <C-k> :m '<-2<CR>gv=gv
vnoremap <C-j> :m '>+1<CR>gv=gv
nnoremap <C-Up> :m .-2<CR>==
nnoremap <C-Down> :m .+1<CR>==
vnoremap <C-Up> :m '<-2<CR>gv=gv
vnoremap <C-Down> :m '>+1<CR>gv=gv
" Toggle quickfix window.
function! QuickFix_toggle()
for i in range(1, winnr('$'))
let bnum = winbufnr(i)
if getbufvar(bnum, '&buftype') == 'quickfix'
cclose
return
endif
endfor
copen
endfunction
nnoremap <silent> <Leader>c :call QuickFix_toggle()<CR>
" Convert the selected text's title case using the external tcc script.
" Requires: https://github.com/nickjj/title-case-converter
vnoremap <Leader>tc c<C-r>=system('tcc', getreg('"'))[:-2]<CR>
" Navigate the complete menu items like CTRL+n / CTRL+p would.
inoremap <expr> <Down> pumvisible() ? "<C-n>" :"<Down>"
inoremap <expr> <Up> pumvisible() ? "<C-p>" : "<Up>"
" Select the complete menu item like CTRL+y would.
inoremap <expr> <Right> pumvisible() ? "<C-y>" : "<Right>"
inoremap <expr> <CR> pumvisible() ? "<C-y>" :"<CR>"
" Cancel the complete menu item like CTRL+e would.
inoremap <expr> <Left> pumvisible() ? "<C-e>" : "<Left>"
" -----------------------------------------------------------------------------
" Basic autocommands
" -----------------------------------------------------------------------------
" Auto-resize splits when Vim gets resized.
autocmd VimResized * wincmd =
" Update a buffer's contents on focus if it changed outside of Vim.
au FocusGained,BufEnter * :checktime
" Unset paste on InsertLeave.
autocmd InsertLeave * silent! set nopaste
" Make sure all types of requirements.txt files get syntax highlighting.
autocmd BufNewFile,BufRead requirements*.txt set ft=python
" Make sure .aliases, .bash_aliases and similar files get syntax highlighting.
autocmd BufNewFile,BufRead .*aliases* set ft=sh
" Make frontmatter enabled Markdown files use Liquid syntax highlighting.
autocmd BufNewFile,BufRead *.md if getline(1) =~ '---' | setlocal filetype=liquid.markdown | endif
" Ensure all Markdown files don't get whitespace stripped but let it be visible.
autocmd FileType markdown DisableStripWhitespaceOnSave
" Make sure Kubernetes yaml files end up being set as helm files.
au BufNewFile,BufRead *.{yaml,yml} if getline(1) =~ '^apiVersion:' || getline(2) =~ '^apiVersion:' | setlocal filetype=helm | endif
" Ensure tabs don't get converted to spaces in Makefiles.
autocmd FileType make setlocal noexpandtab
" Only show the cursor line in the active buffer.
augroup CursorLine
au!
au VimEnter,WinEnter,BufWinEnter * setlocal cursorline
au WinLeave * setlocal nocursorline
augroup END
" Mappings to make Vim more friendly towards presenting slides.
autocmd BufNewFile,BufRead *.vpm call SetVimPresentationMode()
function SetVimPresentationMode()
nnoremap <buffer> <Right> :n<CR>
nnoremap <buffer> <Left> :N<CR>
if !exists('#goyo')
Goyo
endif
endfunction
" ----------------------------------------------------------------------------
" Basic commands
" ----------------------------------------------------------------------------
" Allow files to be saved as root when forgetting to start Vim using sudo.
command Sw :execute ':silent w !sudo tee % > /dev/null' | :edit!
" Add all TODO items to the quickfix list relative to where you opened Vim.
function! s:todo() abort
let entries = []
for cmd in ['git grep -niIw -e TODO -e FIXME 2> /dev/null',
\ 'grep -rniIw -e TODO -e FIXME . 2> /dev/null']
let lines = split(system(cmd), '\n')
if v:shell_error != 0 | continue | endif
for line in lines
let [fname, lno, text] = matchlist(line, '^\([^:]*\):\([^:]*\):\(.*\)')[1:3]
call add(entries, { 'filename': fname, 'lnum': lno, 'text': text })
endfor
break
endfor
if !empty(entries)
call setqflist(entries)
copen
endif
endfunction
command! Todo call s:todo()
" Profile Vim by running this command once to start it and again to stop it.
function! s:profile(bang)
if a:bang
profile pause
noautocmd qall
else
profile start /tmp/profile.log
profile func *
profile file *
endif
endfunction
command! -bang Profile call s:profile(<bang>0)
" -----------------------------------------------------------------------------
" Plugin settings, mappings and autocommands
" -----------------------------------------------------------------------------
" .............................................................................
" junegunn/fzf.vim
" .............................................................................
let $FZF_DEFAULT_OPTS = '--bind ctrl-a:select-all'
" Customize fzf colors to match your color scheme.
let g:fzf_colors =
\ { 'fg': ['fg', 'Normal'],
\ 'bg': ['bg', 'Normal'],
\ 'hl': ['fg', 'Comment'],
\ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
\ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
\ 'hl+': ['fg', 'Statement'],
\ 'info': ['fg', 'PreProc'],
\ 'prompt': ['fg', 'Conditional'],
\ 'pointer': ['fg', 'Exception'],
\ 'marker': ['fg', 'Keyword'],
\ 'spinner': ['fg', 'Label'],
\ 'header': ['fg', 'Comment'] }
let g:fzf_action = {
\ 'ctrl-t': 'tab split',
\ 'ctrl-b': 'split',
\ 'ctrl-v': 'vsplit',
\ 'ctrl-y': {lines -> setreg('*', join(lines, "\n"))}}
" Launch fzf with CTRL+P.
nnoremap <silent> <C-p> :FZF -m<CR>
" Map a few common things to do with FZF.
nnoremap <silent> <Leader><Enter> :Buffers<CR>
nnoremap <silent> <Leader>l :Lines<CR>
" Allow passing optional flags into the Rg command.
" Example: :Rg myterm -g '*.md'
command! -bang -nargs=* Rg
\ call fzf#vim#grep(
\ "rg --column --line-number --no-heading --color=always --smart-case " .
\ <q-args>, 1, fzf#vim#with_preview(), <bang>0)
" .............................................................................
" lambdalisue/fern.vim
" .............................................................................
" Disable netrw.
let g:loaded_netrw = 1
let g:loaded_netrwPlugin = 1
let g:loaded_netrwSettings = 1
let g:loaded_netrwFileHandlers = 1
augroup my-fern-hijack
autocmd!
autocmd BufEnter * ++nested call s:hijack_directory()
augroup END
function! s:hijack_directory() abort
let path = expand('%:p')
if !isdirectory(path)
return
endif
bwipeout %
execute printf('Fern %s', fnameescape(path))
endfunction
" Custom settings and mappings.
let g:fern#disable_default_mappings = 1
let g:fern#default_hidden = 1
noremap <silent> <Leader>f :Fern . -drawer -reveal=% -toggle -width=35<CR>
function! FernInit() abort
nmap <buffer><expr>
\ <Plug>(fern-my-open-expand-collapse)
\ fern#smart#leaf(
\ "\<Plug>(fern-action-open:select)",
\ "\<Plug>(fern-action-expand)",
\ "\<Plug>(fern-action-collapse)",
\ )
nmap <buffer> <CR> <Plug>(fern-my-open-expand-collapse)
nmap <buffer> <2-LeftMouse> <Plug>(fern-my-open-expand-collapse)
nmap <buffer> n <Plug>(fern-action-new-path)
nmap <buffer> d <Plug>(fern-action-remove)
nmap <buffer> m <Plug>(fern-action-move)
nmap <buffer> M <Plug>(fern-action-rename)
nmap <buffer> h <Plug>(fern-action-hidden-toggle)
nmap <buffer> r <Plug>(fern-action-reload)
nmap <buffer> k <Plug>(fern-action-mark)
nmap <buffer> K <Plug>(fern-action-mark-children:leaf)
nmap <buffer> b <Plug>(fern-action-open:split)
nmap <buffer> v <Plug>(fern-action-open:vsplit)
nmap <buffer><nowait> < <Plug>(fern-action-leave)
nmap <buffer><nowait> > <Plug>(fern-action-enter)
endfunction
augroup FernGroup
autocmd!
autocmd FileType fern setlocal norelativenumber | setlocal nonumber | call FernInit()
augroup END
" .............................................................................
" unblevable/quick-scope
" .............................................................................
" Trigger a highlight in the appropriate direction when pressing these keys.
let g:qs_highlight_on_keys=['f', 'F', 't', 'T']
" Only underline the highlights instead of using custom colors.
highlight QuickScopePrimary gui=underline cterm=underline
highlight QuickScopeSecondary gui=underline cterm=underline
" .............................................................................
" mhinz/vim-grepper
" .............................................................................
let g:grepper={}
let g:grepper.tools=["rg"]
xmap gr <plug>(GrepperOperator)
" After searching for text, press this mapping to do a project wide find and
" replace. It's similar to <leader>r except this one applies to all matches
" across all files instead of just the current file.
nnoremap <Leader>R
\ :let @s='\<'.expand('<cword>').'\>'<CR>
\ :Grepper -cword -noprompt<CR>
\ :cfdo %s/<C-r>s//g \| update
\<Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left>
" The same as above except it works with a visual selection.
xmap <Leader>R
\ "sy
\ gvgr
\ :cfdo %s/<C-r>s//g \| update
\<Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left>
" .............................................................................
" ntpeters/vim-better-whitespace
" .............................................................................
let g:strip_whitespace_confirm=0
let g:strip_whitelines_at_eof=1
let g:strip_whitespace_on_save=1
let g:better_whitespace_filetypes_blacklist=[]
" .............................................................................
" Konfekt/FastFold
" .............................................................................
let g:fastfold_savehook=0
let g:fastfold_fold_command_suffixes=[]
" .............................................................................
" junegunn/limelight.vim
" .............................................................................
let g:limelight_conceal_ctermfg=244
" .............................................................................
" iamcco/markdown-preview.nvim
" .............................................................................
let g:mkdp_auto_close=0
let g:mkdp_refresh_slow=1
let g:mkdp_markdown_css=fnameescape($HOME).'/.local/lib/github-markdown-css/github-markdown.css'
" .............................................................................
" SirVer/ultisnips
" .............................................................................
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
" .............................................................................
" janko/vim-test
" .............................................................................
if has('nvim')
let test#strategy='neovim'
else
let test#strategy='vimterminal'
endif
let test#python#pytest#executable='docker compose exec web py.test'
let test#ruby#rails#executable='docker compose exec -e RAILS_ENV=test js rails test'
let test#elixir#exunit#executable='docker compose exec -e MIX_ENV=test web mix test'
nmap <silent> t<C-n> :TestNearest<CR>
nmap <silent> t<C-f> :TestFile<CR>
nmap <silent> t<C-a> :TestSuite<CR>
nmap <silent> t<C-l> :TestLast<CR>
nmap <silent> t<C-v> :TestVisit<CR>