-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.vim
More file actions
833 lines (704 loc) · 26 KB
/
init.vim
File metadata and controls
833 lines (704 loc) · 26 KB
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
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
" KEYMAPPINGS ARE THE SAME OR VERY SIMILAR TO EMACS 'SPACEMACS' DISTRO
" Vim Plug====================================================
call plug#begin()
Plug 'airblade/vim-gitgutter'
Plug 'alvan/vim-closetag'
Plug 'ap/vim-css-color'
Plug 'bentayloruk/vim-react-es6-snippets'
Plug 'chrisbra/csv.vim'
Plug 'github/copilot.vim'
Plug 'henrik/vim-indexed-search'
Plug 'honza/vim-snippets'
Plug 'itchyny/vim-cursorword'
Plug 'janko-m/vim-test'
Plug 'jiangmiao/auto-pairs'
Plug 'jistr/vim-nerdtree-tabs'
Plug 'jodosha/vim-godebug'
Plug 'joshdick/onedark.vim'
Plug 'dyng/ctrlsf.vim'
Plug 'edkolev/tmuxline.vim'
Plug 'ellisonleao/glow.nvim'
Plug 'fatih/vim-go', {'do': ':GoInstallBinaries'}
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
Plug 'liuchengxu/vim-which-key'
Plug 'liuchengxu/vista.vim'
Plug 'MarcWeber/vim-addon-mw-utils'
Plug 'mhinz/vim-hugefile'
Plug 'mileszs/ack.vim'
Plug 'mitsuhiko/vim-jinja'
Plug 'moll/vim-bbye'
Plug 'myusuf3/numbers.vim'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
Plug 'phaazon/hop.nvim'
Plug 'nvim-lua/plenary.nvim'
Plug 'qpkorr/vim-bufkill'
Plug 'ryanoasis/vim-webdevicons'
Plug 'scrooloose/nerdcommenter'
Plug 'scrooloose/nerdtree'
Plug 'mbbill/undotree'
Plug 'SirVer/ultisnips'
Plug 'terryma/vim-multiple-cursors'
Plug 'tomtom/tlib_vim'
Plug 'tpope/vim-dispatch'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-sleuth'
Plug 'tpope/vim-surround'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'vim-scripts/Align'
Plug 'vim-scripts/BufOnly.vim'
Plug 'vim-scripts/ScrollColors'
Plug 'vim-scripts/loremipsum'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'Yggdroot/indentLine'
Plug 'stevearc/dressing.nvim'
Plug 'MunifTanjim/nui.nvim'
Plug 'MeanderingProgrammer/render-markdown.nvim'
Plug 'yetone/avante.nvim', { 'branch': 'main', 'do': 'make' }
call plug#end()
" WHICHKEY PLUGIN====================================================
" Not a fan of floating windows for this
let g:mapleader = ' '
" By default timeoutlen is 1000 ms
set timeoutlen=450
call which_key#register('<Space>', "g:which_key_map")
nnoremap <silent><leader> :WhichKey '<Space>'<CR>
vnoremap <silent><leader> :<c-u>WhichKeyVisual '<Space>'<CR>
let g:which_key_floating_opts = { 'width': '-2' }
autocmd! FileType which_key
autocmd FileType which_key set laststatus=0 noshowmode noruler
\| autocmd BufLeave <buffer> set laststatus=2 showmode ruler
let g:which_key_map = {}
let g:which_key_ignore_outside_mappings = 1
let g:which_key_map["'"] = 'open-terminal'
let g:which_key_map[';'] = 'toggle-comment'
let g:which_key_map['q'] = 'quit'
let g:which_key_map['S'] = 'save'
let g:which_key_map['/'] = 'rgrep-project'
let g:which_key_map.A = {
\ 'name': '+avante',
\ 'a': 'show-sidebar',
\ 'e': 'edit-selected-block',
\ 'r': 'refresh-sidebar',
\ 'f': 'switch-sidebar-focus',
\ }
let g:which_key_map.m = {
\ 'name' : '+major-mode',
\ 'd' : 'show-definition',
\ 'T' : 'show-type-definition',
\ 'i' : 'show-implementation',
\ 'I' : 'organize-imports',
\ 'f' : 'format-buffer',
\ 'u' : 'show-references',
\ 'r' : 'rename-symbol',
\ 'a' : 'suggest-code-action',
\ 'K' : 'show-documentation',
\ 'c' : 'project-LOC-count',
\}
let g:which_key_map.m.t = {
\ 'name' : '+test',
\ 't' : 'nearest-function',
\ 'm' : 'whole-file',
\ 'a' : 'whole-suite',
\ 'l' : 'last',
\ 'v' : 'visit',
\ }
let g:which_key_map.m.p = {
\ 'name' : '+markdown-preview',
\ 'p' : 'preview-in-terminal',
\ 'P' : 'preview-in-browser',
\ }
let g:which_key_map.m.l = {
\ 'name' : '+coc-list',
\ 'l' : 'all',
\ 'c' : 'commands',
\ 's' : 'outline',
\ 'S' : 'symbols',
\ 'e' : 'extensions',
\ 'a' : 'actions',
\ }
let g:which_key_map.m.x = {
\ 'name' : '+execute',
\ 'x' : 'run',
\ 'X' : 'run-project(golang/rust)',
\ 'b' : 'build',
\ 'w' : 'watch(typescript-only)',
\ 'c' : 'coverage(golang)/check-types',
\ }
let g:which_key_map.w = {
\ 'name' : '+window',
\ 'j' : 'down' ,
\ 'k' : 'up',
\ 'l' : 'right',
\ 'h' : 'left',
\ 'J' : 'decrease-split-vertical' ,
\ 'K' : 'increase-split-vertical',
\ 'L' : 'increase-split-horizontal',
\ 'H' : 'decrease-split-horizontal',
\ 'd' : 'delete',
\ 's' : 'horizontal-split',
\ 'v' : 'vertical-split',
\ }
let g:which_key_map.f = {
\ 'name' : '+file',
\ }
let g:which_key_map.f.e = {
\ 'name' : '+config-file',
\ 'd' : 'edit-config-file',
\ 'R' : 'reload-config-file',
\ }
let g:which_key_map.t = {
\ 'name' : '+toggle',
\ '/' : 'search-highlights',
\ 'm' : 'file-undo-history',
\ 's' : 'symbols',
\ 'f' : 'file-tree',
\ 'r' : 'project-search-results',
\ }
let g:which_key_map.T = {
\ 'name' : '+tab',
\ 'n' : 'next-tab',
\ 'p' : 'previous-tab',
\ 'N' : 'new-tab',
\ 's' : 'split-tab',
\ 'd' : 'delete-tab',
\ }
let g:which_key_map.b = {
\ 'name' : '+buffer',
\ 'n' : 'next-buffer',
\ 'p' : 'previous-buffer',
\ 'd' : 'delete-buffer',
\ 'o' : 'delete-all-buffers',
\ }
let g:which_key_map.r = {
\ 'name' : '+registers',
\ 'e' : 'show-register',
\ }
let g:which_key_map.g = {
\ 'name' : '+git/version-control',
\ 's' : 'status' ,
\ 'S' : 'write',
\ 'b' : 'blame',
\ 'l' : 'log',
\ 'd' : 'horizontal-diff',
\ 'v' : 'vertical-diff',
\ }
let g:which_key_map.p = {
\ 'name' : '+vim-plug',
\ 'i' : 'install' ,
\ 'c' : 'clean',
\ 'd' : 'diff',
\ 'u' : 'update',
\ 'U' : 'upgrade',
\ 's' : 'status',
\ 'S' : 'snapshot',
\ }
let g:which_key_map.j = {
\ 'name' : '+jump',
\ 'w' : 'to-beginning-of-word',
\ 'j' : 'to-first-character',
\ 'e' : 'to-first-two-characters',
\ 'l' : 'to-line',
\ }
let g:which_key_map.c = {
\ 'name' : '+comment',
\ '$' : 'to-EOL',
\ 'A' : 'append',
\ 'b' : 'align-both',
\ 'c' : 'comment',
\ 'i' : 'invert',
\ 'l' : 'align-left',
\ 'm' : 'minimal',
\ 'n' : 'nested',
\ 's' : 'sexy',
\ 'u' : 'uncomment',
\ 'y' : 'yank',
\}
let g:which_key_map.s = {
\ 'name' : '+search/fuzzy-match',
\ 'f' : 'git-files',
\ 'F' : 'files',
\ 'b' : 'buffers',
\ 's' : 'snippets',
\ 'h' : 'file-history',
\ 'H' : 'help-topics',
\ 't' : 'buffer-symbols',
\ 'T' : 'project-symbols',
\ 'c' : 'commands',
\ 'C' : 'buffer-commits',
\ 'l' : 'buffer-lines',
\ 'g' : 'project-search-prompt',
\ 'G' : 'project-search-noprompt',
\}
let g:which_key_map.e = {
\ 'name' : '+errors/warnings',
\ 'l' : 'list',
\ 'n' : 'next',
\ 'p' : 'previous',
\}
" NON-PLUGIN RELATED CONFIG SETTINGS================================
filetype indent on
set number
set numberwidth=4
" default SQL language to be used
let g:sql_type_default = 'pgsql'
" keymap to write buffer and quit
nnoremap <silent><leader>q :q<cr>
nnoremap <silent><leader>S :w<cr>
" mapping for better splits
nnoremap <silent><leader>wJ 5<C-W>-
nnoremap <silent><leader>wK 5<C-W>+
nnoremap <silent><leader>wL 5<C-W>>
nnoremap <silent><leader>wH 5<C-W><
" Easier movement between windows / splits
nnoremap <silent><leader>wj <c-w>j
nnoremap <silent><leader>wk <c-w>k
nnoremap <silent><leader>wl <c-w>l
nnoremap <silent><leader>wh <c-w>h
nnoremap <silent><leader>wd :q<CR>
nnoremap <silent><leader>ws :sp<CR>
nnoremap <silent><leader>wv :vs<CR>
" Keymap to open default shell
nnoremap <silent><leader>' :10sp term://zsh<CR>i
" Keymap to edit init.vim / .vimrc
nnoremap <silent><leader>fed :e $MYVIMRC<CR>
nnoremap <silent><leader>feR :source $MYVIMRC<CR>
" Press i to enter insert mode, and ii to exit.
inoremap ii <Esc>
" Change to j,k to move exactly up, down vs linewise wrap
nnoremap k gk
nnoremap j gj
" Mouse scrolling
set mouse=a
" Remap terminal escape keys
tnoremap <Esc> <C-\><C-n>
" Force Saving Files that Require Root Permission ('w!!')
cmap w!! %!sudo tee > /dev/null %
" tab navigation mappings
nnoremap <silent><leader>Tn :tabn<CR>
nnoremap <silent><leader>Tp :tabp<CR>
nnoremap <silent><leader>TN :tabnew<CR>
nnoremap <silent><leader>Ts :tab s plit<CR>
nnoremap <silent><leader>Td :q<CR>
" buffer navigation mappings
"vim-bbye fix for :bdelete; provides :Bdelete and :Bwipeout commands
nnoremap <silent><leader>bn :bn<CR>
nnoremap <silent><leader>bp :bp<CR>
nnoremap <silent><leader>bd :Bdelete!<CR>
nnoremap <silent><leader>bo :Bo<CR>
nnoremap <silent><S-h> :bp<CR>
nnoremap <silent><S-l> :bn<CR>
" show registers
nnoremap <silent><leader>re :register<CR>
" Autocompletion of files and commands
set wildmode=full
set wildoptions+=pum
"Make it obvious where 80 characters is
set textwidth=80
" Clear search highlights
noremap <silent><leader>t/ :nohls<CR>
" Open new split panes to right and bottom, which feels more natural
set splitbelow
set splitright
set noshowmode " Hide the default mode text (e.g. -- INSERT -- be
set relativenumber
set updatetime=2000
set foldmethod=indent
set foldlevel=99
set ttyfast " Faster redrawing.
set lazyredraw " Only redraw when necessary.
set backspace=2 " Backspace deletes like most programs in insert mode
set noswapfile " http://robots.thoughtbot.com/post/18739402579/global-gitignore#comment-458413287
set ruler " show the cursor position all the time
set hidden
set showcmd " display incomplete commands
set autowrite " Automatically :write before running commands
set ignorecase " searches are case insensitive...
set smartcase " ... unless they contain at least one capital letter
set undofile
set undolevels=1000 " how many undos
set undoreload=10000 " number of lines to save for undo
"set undodir=~/.config/nvim/undo " where to save undo history
"set backupdir=~/.config/nvim/backup/
"set directory=~/.config/nvim/backup/
" Enable spellchecking for Markdown
au FileType markdown setlocal spell
augroup FileMappings
au!
" Markdown syntax change
au BufNewFile,BufFilePre,BufRead *.md set filetype=text
" .eslintrc syntax change
au BufNewFile,BufFilePre,BufRead *.eslintrc set filetype=json
" .babelrc syntax change
au BufNewFile,BufFilePre,BufRead *.babelrc set filetype=json
" .esformatter syntax change
au BufNewFile,BufFilePre,BufRead *.esformatter set filetype=json
" .lock syntax change
au BufNewFile,BufFilePre,BufRead *.lock set filetype=json
" Pipfile syntax change
au BufNewFile,BufFilePre,BufRead Pipfile set filetype=toml
" specfile syntax change
au BufNewFile,BufFilePre,BufRead *.spec set filetype=python
augroup END
" Enable toggling of paste-mode
set pastetoggle=<F5>
set clipboard=unnamed
" Have Vim jump to the last position when reopening a file
if has('autocmd')
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
\| exe "normal! g'\"" | endif
endif
"24 Bit True Color-----------------------------------------------
if (has('nvim'))
let $NVIM_TUI_ENABLE_TRUE_COLOR=1
endif
if (has('termguicolors'))
set termguicolors
endif
" external shell command mappings -------------------
:command! Glogg Start tig
:command! MPreview Start! open -a Google\ Chrome.app http://localhost:6419 & grip %
:command! PyClean !find . -name '*.pyc' | xargs rm -f
:command! PyLineCount !find . -name '*.py' | xargs wc -l
:command! JSLineCount !find . -name '*.js' -not -path "./node_modules/*" | xargs wc -l
:command! TSLineCount !find . -name '*.ts*' -not -path "./node_modules/*" | xargs wc -l
:command! RustLineCount !find . -name '*.rs' | xargs wc -l
:command! GoLineCount !find . -name '*.go' | xargs wc -l
" PLUGIN SETTINGS AND MAPPINGS================================================
" Avante Plugin settings--------------------------------
autocmd! User avante.nvim
lua << EOF
require('avante_lib').load()
require('avante').setup({
provider = 'openai',
})
EOF
" Avante Mappings----------------------------
nnoremap <leader>Aa :AvanteAsk<CR>
nnoremap <leader>Ae :AvanteEdit<CR>
nnoremap <leader>Ar :AvanteRefresh<CR>
nnoremap <leader>Af :AvanteFocus<CR>
" Closetag plugin settings----------------------------------
let g:closetag_filenames = '*.html,*.xhtml,*.xml,*.phtml,*.jsx,*.tsx,*.jinja'
" treat <li> and <p> tags like the block tags they are
let g:html_indent_tags = 'li\|p'
" Fugitive Plugin (git) Mappings----------------------------
nnoremap <silent><leader>gs :Git<CR>
nnoremap <silent><leader>gS :Gwrite<CR>
nnoremap <silent><leader>gb :Git blame<CR>
nnoremap <silent><leader>gl :Glogg<CR>
nnoremap <silent><leader>gd :Gdiffsplit<CR>
nnoremap <silent><leader>gv :Gvdiffsplit<CR>
" Hop Plugin Mappings---------------------------------------
nnoremap <silent><leader>jj :HopChar1<CR>
nnoremap <silent><leader>jw :HopWord<CR>
nnoremap <silent><leader>je :HopChar2<CR>
nnoremap <silent><leader>jl :HopLine<CR>
lua << EOF
require'hop'.setup()
EOF
" Vim-test Plugin configurations---------------------------
nmap <silent><leader>mtt :TestNearest<CR>
nmap <silent><leader>mtm :TestFile<CR>
nmap <silent><leader>mta :TestSuite<CR>
nmap <silent><leader>mtl :TestLast<CR>
nmap <silent><leader>mtv :TestVisit<CR>
" make test commands execute using dispatch.vim
let g:test#strategy = 'neovim'
let g:test#runner_commands = ['PyTest', 'Mocha']
let g:test#python#runner = 'pytest'
let g:test#python#pytest#options = '--verbose'
let g:virtualenv_stl_format = '[%n]'
" Markdown browser preview mapping---------------------------
nnoremap <silent><leader>mpP :MPreview<CR>
" Markdown Glow plugin settings--------------------------------------
noremap <silent><leader>mpp :Glow<CR>
" NerdCommenter Plugin config----------------------------
nmap <silent><leader>; <Plug>NERDCommenterToggle
vmap <silent><leader>; <Plug>NERDCommenterToggle
nmap <silent><leader>cA <Plug>NERDCommenterAppend
let g:NERDSpaceDelims = 1
" Indentline Plugin settings------------------------------
let g:indentLine_color_term = 237
let g:indentLine_char = '|'
" Nerdtree git plugin settings---------------------
let g:NERDTreeGitStatusIndicatorMapCustom = {
\ 'Modified' : '✹',
\ 'Staged' : '✚',
\ 'Untracked' : '✭',
\ 'Renamed' : '➜',
\ 'Unmerged' : '═',
\ 'Deleted' : '✖',
\ 'Dirty' : '✗',
\ 'Clean' : '✔︎',
\ 'Unknown' : '?'
\ }
" FZF Plugin settings--------------------------------------
let g:fzf_command_prefix = 'Fzf'
" let g:fzf_tags_command = 'ctags'
" fzf statusline mapping
function! s:fzf_statusline()
" Override statusline as you like
highlight fzf1 ctermfg=161 ctermbg=251
highlight fzf2 ctermfg=23 ctermbg=251
highlight fzf3 ctermfg=237 ctermbg=251
setlocal statusline=%#fzf1#\ >\ %#fzf2#fz%#fzf3#f
endfunction
au! User FzfStatusLine call <SID>fzf_statusline()
" Coc-snippets, Ultisnips, and Snipmate--------------------
" turn off ultisnips and let COC-snippets handle
" use ultisnips for only fzfsnippets buffer
let g:UltiSnipsExpandTrigger = "<nop>"
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
let g:coc_snippet_next = '<tab>'
" Vim-Plug mappings----------------------------------------
nnoremap <silent><leader>pi :PlugInstall<CR>
nnoremap <silent><leader>pc :PlugClean<CR>
nnoremap <silent><leader>ps :PlugStatus<CR>
nnoremap <silent><leader>pS :PlugSnapshot<CR>
nnoremap <silent><leader>pu :PlugUpdate<CR>
nnoremap <silent><leader>pU :PlugUpgrade<CR>
nnoremap <silent><leader>pd :PlugDiff<CR>
" FZF mappings---------------------------------------------
nnoremap <silent><leader>sF :FzfFiles<CR>
nnoremap <silent><leader>sf :FzfGFiles<CR>
nnoremap <silent><leader>/ :FzfRg<CR>
nnoremap <silent><leader>sb :FzfBuffers<CR>
nnoremap <silent><leader>ss :FzfSnippets<CR>
nnoremap <silent><leader>sh :FzfHistory<CR>
nnoremap <silent><leader>st :Vista finder<CR>
nnoremap <silent><leader>sT :FzfTags<CR>
nnoremap <silent><leader>sc :FzfCommands<CR>
nnoremap <silent><leader>sC :FzfCommits<CR>
nnoremap <silent><leader>sl :FzfLines<CR>
nnoremap <silent><leader>sH :FzfHelptags<CR>
" CtrlsF Plugin mappings-----------------------------------
nmap <silent><leader>sg <Plug>CtrlSFPrompt
vmap <silent><leader>sg <Plug>CtrlSFVwordPath
vmap <silent><leader>sG <Plug>CtrlSFVwordExec
nnoremap <silent><leader>tr :CtrlSFOpen<CR>
let g:ctrlsf_ackprg = 'rg'
" Ack Plugin---------------------------------------
" Use ripgrep over ack
if executable('rg')
let g:ackprg = 'rg --vimgrep'
set grepprg=rg\ --no-heading\ --color\ never
endif
" Vista.vim Plugin---------------------------------------------
map <silent><leader>ts :Vista<CR>
let g:vista_default_executive = 'coc'
let g:vista_sidebar_width = 40
let g:vista_finder_alternative_executives = ['ctags']
let g:vista_icon_indent = ['╰─▸ ', '├─▸ ']
" Undotree Plugin-----------------------------------------------
nnoremap <silent><leader>tm :UndotreeToggle<CR>
let g:undotree_SplitWidth = 37
let g:undotree_SetFocusWhenToggle = 1
" Treesitter Plugin--------------------------------------------------
lua <<EOF
require'nvim-treesitter.configs'.setup {
ensure_installed = "all", -- one of "all", "maintained" (parsers with maintainers), or a list of languages
-- ignore_install = { "javascript" }, -- List of parsers to ignore installing
highlight = {
enable = true, -- false will disable the whole extension
-- disable = { "c", "rust" }, -- list of language that will be disabled
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = true,
},
}
EOF
" NerdTree Plugin-------------------------------------------------------
let g:NERDTreeShowHidden=1
let g:NERDTreeWinSize=40
" Open NerdTree upon startup if no input provided
" autocmd StdinReadPre * let s:std_in=1
" autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
map <silent><leader>tf <Plug>NERDTreeTabsToggle<CR>
" COC.vim Plugin-------------------------------------------------------
set nobackup
set nowritebackup
set updatetime=300
set shortmess+=c
set signcolumn=yes
" Use tab for trigger completion with characters ahead and navigate.
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
" other plugin before putting this into your config.
inoremap <silent><expr> <TAB>
\ coc#pum#visible() ? coc#pum#next(1) :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
inoremap <expr><S-TAB> coc#pum#visible() ? "\<C-p>" : "\<C-h>"
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
" Use <c-space> to trigger completion.
if has('nvim')
inoremap <silent><expr> <c-space> coc#refresh()
else
inoremap <silent><expr> <c-@> coc#refresh()
endif
" Make <CR> auto-select the first completion item and notify coc.nvim to
" format on enter, <cr> could be remapped by other vim plugin
inoremap <silent><expr> <cr> coc#pum#visible() ? coc#_select_confirm()
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
" Command Line auto-completion
augroup command_window
function! ReInitCoc()
execute("CocDisable")
execute("CocEnable")
endfunction
autocmd CmdwinEnter * startinsert
autocmd CmdwinEnter * call ReInitCoc()
augroup END
" Show all diagnostics
nnoremap <silent><leader>el :<C-u>CocList diagnostics<cr>
" Use to navigate diagnostics
nmap <silent><leader>ep <Plug>(coc-diagnostic-prev)
nmap <silent><leader>en <Plug>(coc-diagnostic-next)
" Use `:Format` to format current buffer
command! -nargs=0 Format :call CocAction('format')
" Use `:Fold` to fold current buffer
command! -nargs=? Fold :call CocAction('fold', <f-args>)
" use `:Imports` to organize import of current buffer
command! -nargs=0 Imports :call CocAction('runCommand', 'editor.action.organizeImport')
" Remap keys for gotos
nmap <silent><leader>md <Plug>(coc-definition)
nmap <silent><leader>mT <Plug>(coc-type-definition)
nmap <silent><leader>mi <Plug>(coc-implementation)
nmap <silent><leader>mI :Imports<CR>
nmap <silent><leader>mu <Plug>(coc-references)
nmap <silent><leader>mr <Plug>(coc-rename)
nmap <silent><leader>ma <Plug>(coc-codeaction)
function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>')
else
call CocAction('doHover')
endif
endfunction
nmap <silent><leader>mK :call <SID>show_documentation()<CR>
" Remap for format selected region
nmap <silent><leader>mf <Plug>(coc-format)
" Use K to show documentation in preview window
nnoremap <silent>K :call <SID>show_documentation()<CR>
" Show list
nnoremap <silent><leader>mll :<C-u>CocList<cr>
" Show commands
nnoremap <silent><leader>mlc :<C-u>CocList commands<cr>
" Find symbol of current document
nnoremap <silent><leader>mls :<C-u>CocList outline<cr>
" Search workspace symbols
nnoremap <silent><leader>mlS :<C-u>CocList -I symbols<cr>
" Manage extensions
nnoremap <silent><leader>mle :<C-u>CocList extensions<cr>
" Show actions
nnoremap <silent><leader>mla :<C-u>CocAction<cr>
" Highlight symbol under cursor on CursorHold
autocmd CursorHold * silent call CocActionAsync('highlight')
augroup mygroup
autocmd!
" Setup formatexpr specified filetype(s).
autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected')
" Update signature help on jump placeholder
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
augroup end
" Remap for do codeAction of selected region, ex: `<leader>aap` for current paragraph
xmap <silent><leader>ma <Plug>(coc-codeaction-selected)<cr>
nmap <silent><leader>ma <Plug>(coc-codeaction-selected)<cr>
" Use <TAB> for select selections ranges, needs server support, like: coc-tsserver, coc-python
nmap <silent><TAB> <Plug>(coc-range-select)
xmap <silent><TAB> <Plug>(coc-range-select)
" Add status line support, for integration with other plugin, checkout `:h coc-status`
set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}
" Typescript Plugin----------------------------------------------------
" Custom TS commands
:command! TSWatch Start tsc --watch --pretty
:command! TSBuild !tsc
" A little faster in-memory package for doing same thing as line below; must
" install ts-node
:command! TSExecute write | vsplit term://npx ts-node %
":command! TSExecute write | vsplit term://tsc --outFile /dev/stdout % \| node
augroup TSMappings
au!
au BufEnter,FileType typescript nnoremap <silent><leader>mxw :TSWatch<CR>
au BufEnter,FileType typescript nnoremap <silent><leader>mxb :TSBuild<CR>
au BufEnter,FileType typescript nnoremap <silent><leader>mxx :TSExecute<CR>
au BufEnter,FileType typescript,typescriptreact nnoremap <silent><leader>mc :TSLineCount<CR>
augroup END
" Custom JS commands--------------------------------------------
:command! JSexecute write | vsplit term://node %
augroup JSMappings
au BufEnter,FileType javascript nnoremap <silent><leader>mxx :JSexecute<CR>
au BufEnter,FileType javascript,javascriptreact nnoremap <silent><leader>mc :JSLineCount<CR>
augroup END
" Allow JSX in normal JS files
" let g:jsx_ext_required = 0
" Python commands-----------------------------------------------
:command! Pyexecute write | vsplit term://python %
augroup PythonMappings
au BufEnter,Filetype python nnoremap <silent><leader>mxx :Pyexecute<CR>
au BufEnter,Filetype python nnoremap <silent><leader>mc :PyLineCount<CR>
augroup END
let g:python3_host_prog = expand('/Users/heath/.pyenv/shims/python')
" Rust settings--------------------------------------------------
:command! RustExecute write | vsplit term://cargo run %
:command! RustExecuteProject write | vsplit term://cargo run
:command! RustBuild write | vsplit term://cargo build
:command! RustCheck write | vsplit term://cargo check
augroup RustMappings
au BufEnter,Filetype rust nnoremap <silent><leader>mxx :RustExecute<CR>
au BufEnter,Filetype rust nnoremap <silent><leader>mxX :RustExecuteProject<CR>
au BufEnter,Filetype rust nnoremap <silent><leader>mxb :RustBuild<CR>
au BufEnter,Filetype rust nnoremap <silent><leader>mxc :RustCheck<CR>
au BufEnter,Filetype rust nnoremap <silent><leader>mc :RustLineCount<CR>
augroup ENDI
" Vim-go Plugin settings------------------------------------------------
let g:go_highlight_build_constraints = 1
let g:go_highlight_extra_types = 1
let g:go_highlight_fields = 1
let g:go_highlight_functions = 1
let g:go_highlight_methods = 1
let g:go_highlight_operators = 1
let g:go_highlight_structs = 1
let g:go_highlight_types = 1
let g:go_auto_sameids = 1
let g:go_fmt_command = "goimports"
let g:go_auto_type_info = 1
let g:go_addtags_transform = "camelcase"
augroup GoMappings
au!
au BufEnter,FileType *.go nnoremap <silent><leader>mxx :GoRun<cr>
au BufEnter,FileType *.go nnoremap <silent><leader>mxb :GoBuild<cr>
au BufEnter,FileType *.go nnoremap <silent><leader>mxi :GoInstall<cr>
au BufEnter,FileType *.go nnoremap <silent><leader>mxc :GoCoverage<cr>
au BufEnter,FileType *.go nnoremap <silent><leader>mc :GoLineCount<cr>
" au BufEnter,FileType *.go nnoremap <silent><leader>mcc :GoCallers<cr>
augroup END
" Airline Plugin settings-----------------------------------------------
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#virtualenv#enabled = 1
let g:airline#extensions#coc#enabled = 1
let g:airline#extensions#vista#enabled = 1
" Tmuxline
let g:tmuxline_powerline_separators = 0
" Syntax highlighting and background mode / theme------------------------
syntax on
syntax enable
set background=dark
autocmd ColorScheme * hi CocMenuSel ctermbg=237 guibg=#13354A
let g:onedark_color_overrides = {
\ "background": {"gui": "#1F2329", "cterm": "235", "cterm16": "0" },
\}
let g:onedark_terminal_italics = 1
colorscheme onedark