-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc.nvim
1552 lines (1489 loc) · 54.8 KB
/
vimrc.nvim
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
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
" vim: foldmethod=marker path=~/.local/share/nvim/vim-plug/ isf-=/ foldcolumn=3 tw=0 ts=8
let g:loaded_sql_completion = 160
let g:ftplugin_sql_omni_key = '<C-S-Q>'
let mapleader = "\<Space>"
augroup vimrc
autocmd!
augroup END
let vim_plug_available = 0
let vim_plug_path='~/.local/share/nvim/site/autoload/plug.vim'
let vim_plug_url='https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
let vim_plug_getters = [
\ { 'name': 'curl', 'command': '!curl --fail --location --create-dirs --output ' . vim_plug_path . " " . vim_plug_url },
\ { 'name': 'wget', 'command': '!wget' },
\]
if empty(glob(vim_plug_path))
for vim_plug_getter in vim_plug_getters
echo vim_plug_getter.name . ': ' . vim_plug_getter.command
execute('silent! ' . vim_plug_getter.command)
if v:shell_error == 0
let vim_plug_available = 1
break
endif
endfor
else
let vim_plug_available = 1
endif
" Plugins {{{
if vim_plug_available
call plug#begin('~/.local/share/nvim/vim-plug')
Plug 'junegunn/fzf' "{{{
Plug 'junegunn/fzf.vim'
let g:fzf_prefer_tmux = 0
let g:fzf_command_prefix = 'Fzf'
" TODO
" -make edit of command default (not c-e)
" -add support for Redir
nmap <c-r> :FzfHistory:<cr>
nmap <c-e> :FzfHistory/<cr>
let g:fzf_tags_command = 'ctags -R'
command! Colors call fzf#vim#colors({'right': '15%', 'options': '--reverse --height=100%'})
" TODO: Make BLines/Lines support preview as well.
" command! -bang -nargs=* FzfLines
" \ call fzf#vim#lines(<q-args>,
" \ <bang>0 ? fzf#vim#with_preview('up:60%')
" \ : fzf#vim#with_preview('right:50%'),
" \ <bang>0)
command! -bang -nargs=* FzfAg
\ call fzf#vim#ag(<q-args>,
\ <bang>0 ? fzf#vim#with_preview('up:60%')
\ : fzf#vim#with_preview('right:50%'),
\ <bang>0)
command! -bang -nargs=? -complete=dir Files call fzf#vim#files(<q-args>, fzf#vim#with_preview(), <bang>0)
let g:fzf_layout = { 'down': '~70:%' }
inoremap <expr> <c-x><c-l> fzf#complete('tmuxwords.rb --all-but-current --scroll 499 --min 5')
imap <c-x><c-k> <plug>(fzf-complete-word)
imap <c-x><c-f> <plug>(fzf-complete-path)
" imap <c-x><c-L> <plug>(fzf-complete-line)
nmap <leader><tab> <plug>(fzf-maps-n)
xmap <leader><tab> <plug>(fzf-maps-x)
omap <leader><tab> <plug>(fzf-maps-o)
map <leader>T :FzfTags<cr>
map <leader>M :FzfMarks<cr>
map <leader>h :FzfHelptags<cr>
map <leader>la :FzfAg<cr>
map <leader>ll :FzfBLines<cr>
map <leader>lL :FzfLines<cr>
"
nnoremap <silent> <Leader>` :FzfMarks<CR>
function! GetSelected()
" save reg
let reg = '"'
let reg_save = getreg(reg)
let reg_type = getregtype(reg)
" yank visually selected text
silent exe 'norm! gv"'.reg.'y'
let value = getreg(reg)
" restore reg
call setreg(reg, reg_save, reg_type)
return value
endfunction
vnoremap <leader>ll :<c-u>execute("FzfBLines ") . GetSelected()<cr>
vnoremap <leader>lL :<c-u>execute("FzfLines ") . GetSelected()<cr>
vnoremap <leader>la :<c-u>execute("FzfAg ") . GetSelected()<cr>
" map <leader>b :FzfBuffers<cr>
map <leader>b :FzfHistory<cr>
map <leader>lc :FzfCommits<cr>
map <leader>lC :FzfBCommits<cr>
map <leader>CA :FzfCommands<cr>
map <leader><leader>c :FzfCommands<cr>
nmap <leader>ca :FzfCommands<cr>
nmap <leader><Space> :FzfCommands<cr>
map <leader>ff :FzfFiles<cr>
" nmap <tab> :FzfCommands<cr>
map <leader>lf :FzfFiles<cr>
map <leader>gf :FzfGFiles<cr>
map <leader>lt :FzfFiletypes<cr>
map <leader>w :FzfWindows<cr>
command! -bang -nargs=? -complete=dir FzfFiles
\ call fzf#vim#files(<q-args>, fzf#vim#with_preview({'options': ['--layout=reverse', '--info=inline']}), <bang>0)
command! -bang -nargs=? -complete=dir FzfGFiles
\ call fzf#vim#gitfiles(<q-args>, fzf#vim#with_preview({'options': ['--layout=reverse', '--info=inline']}), <bang>0)
" command! -bang -nargs=? -complete=dir FzfFiles
" \ call fzf#vim#files(<q-args>, fzf#vim#with_preview(), <bang>0)
" }}}
Plug 'tpope/vim-fugitive' "{{{
Plug 'tpope/vim-rhubarb'
Plug 'tommcdo/vim-fubitive'
" }}}
" TODO: Find out why on-load tag does not work
" Plug 'idanarye/vim-merginal', {'on': 'MerginalToggle'} "{{{
Plug 'idanarye/vim-merginal' "{{{
map <leader>gm :MerginalToggle<cr>
map <leader>y :MerginalToggle<cr>
"}}}
" HELP: Find out why the screwed up map works and the other one NOT!
nmap <leader>gd :Gvdiff<cr><c-l>
" nmap <leader>gd :Gvdiff<cr>
" nmap <silent> <leader>gd :TagbarClose<cr>:Gvdiff<cr>:ERROR<cr>:set nofoldendable<cr>:wincmd l<cr>
nmap <leader>gD :Gdelete<cr>:ERROR<cr>:wincmd L<cr>
nmap <leader>gc :tabnew<cr>:Git commit --verbose<cr>:only<cr>
nmap <leader>gC :tabnew<cr>:Git commit --verbose --amend<cr>:only<cr>
nmap <leader>gx dp:wincmd h<cr>:update<cr>:wincmd l<cr>
nmap <leader>gs :tabnew<cr>:Git<cr>o
nmap <leader>gb :Git blame<cr>
nmap <leader>gB vap:GBrowse<cr>
vmap <leader>gB :GBrowse<cr>
nmap <leader>gp :Gpush<cr>
nmap <leader>gw :Gwrite<cr>
nmap <leader>gg :Git
nmap <leader>gl :silent! Glog --<cr>:bot copen<cr>
" TODO: Find out why this end up in the left window
autocmd vimrc FileType gitcommit,fugitive map <buffer> ; dv
autocmd vimrc FileType fugitive map <buffer> D =
autocmd vimrc FileType fugitive map <buffer> e =
autocmd vimrc FileType fugitive map <buffer> dd =
autocmd vimrc FileType gitcommit map <buffer> <leader>C :Gcommit\ --verbose<cr>
autocmd vimrc FileType gitrebase map <buffer> ; :execute("only\|bo Gvsplit " . substitute(getline('.'), '^\k\+\s\(\x\+\)\s.*$','\1','g'))<cr>
" autocmd vimrc FileType gitcommit map <buffer> ; :only<cr>dv
" Enable spell checking for commit messages
autocmd vimrc BufNewFile,BufReadPost *.git/COMMIT_EDITMSG setfiletype gitcommit | set spell | silent! nunmap ;
autocmd vimrc BufReadPost /tmp/cvs*,svn-commit.tmp*,*hg-editor* setlocal spell
" }}}
Plug 'gregsexton/gitv'
Plug 'junegunn/gv.vim' "{{{
command! Gvv GV --all
command! Gvvv GV --all --date-order
" nmap <leader>gv :GV --all<cr>
nmap <leader>gv :GV<cr>
nmap <leader>gV :GV!<cr>
vmap Gv :GV!<cr>
vmap GV :GV?<cr>
autocmd vimrc FileType GV map <buffer> ; o
autocmd vimrc FileType GV map <buffer> l ;
autocmd vimrc FileType GV map <buffer> O
" }}}
Plug 'AndrewRadev/splitjoin.vim'"{{{
let g:splitjoin_quiet=0
"}}}
Plug 'inkarkat/vim-CompleteHelper' "{{{
Plug 'inkarkat/vim-ingo-library'
" Plug 'vim-scripts/PrevInsertComplete'
Plug 'vim-scripts/MotionComplete'
Plug 'vim-scripts/BracketComplete'
Plug 'vim-scripts/MultiWordComplete'
Plug 'inkarkat/vim-WORDComplete'
Plug 'https://github.com/vim-scripts/AlphaComplete'
Plug 'https://github.com/inkarkat/vim-PatternComplete'
"}}}
" Plug 'inkarkat/vim-session'"{{{
" let g:session_autoload = 'yes'
" let g:session_default_to_last = 'yes'
" let g:session_autosave = 'yes'
" let g:session_autosave_to = 'yes'
" let g:session_autosave_periodic = 'yes'
" let g:session_autosave_periodic = 'yes'
" let g:session_persist_globals = ['&makeprg', '&makeef']
" -save session periodically
" -check vim-obsession
" autocmd vimrc VimLeave * mksession! ~/.vim/lastsession
" TODO: Use fnamemodify() or fnameescape()
" let &viminfo="'50,<1000,s100,:9999,/9999,n~/.vim/viminfo/" . substitute($PWD, "/\| ", "_", "g")
" let &viminfo="'50,<1000,s100,:9999,/9999,n~/.vim/viminfo/" . substitute(substitute($PWD, "/", "_", "g"), " ", "_", "g")
"}}}
"Plug 'airblade/vim-gitgutter', {'on': 'GitGutterToggle'} "{{{
"let g:gitgutter_highlight_lines = 0
"let g:gitgutter_override_sign_column_highlight = 1
"highlight clear SignColumn
"highlight GitGutterAdd ctermbg=black
"map <leader>gG :GitGutterToggle<cr>
"" }}}
"Plug 'junegunn/vim-github-dashboard' "{{{
"let g:github_dashboard = { 'username': 'dsh2', 'password': $GHD_GITHUB_TOKEN }
"" }}}
"Plug 'Shougo/unite.vim', {'on': 'Unite'} "{{{
"nnoremap <silent> <leader>lb :<C-u>Unite buffer file_mru<CR>
"nnoremap <silent> <F3> :Unite buffer<cr>
"autocmd vimrc FileType unite map <buffer> <F3> q
"Plug 'Shougo/vimproc.vim', { 'do': 'make' }
"Plug 'Shougo/neomru.vim'
"let g:neomru#time_format='%F %T '
"let g:neomru#update_interval=60
""}}}
Plug 'AndrewRadev/linediff.vim' "{{{
nmap <leader>ld :Linediff<cr>
nmap <leader>lD :LinediffReset<cr>
"}}}
function! QfLlNext()
windo if &l:buftype == "quickfix" | silent! cnext | if &l:buftype == "location" | silent! lnext | endif | endif
endfunction
nnoremap <C-n> :call QfLlNext()<cr>
function! QfLlPrevious()
windo if &l:buftype == "quickfix" | silent! cprevious | if &l:buftype == "location" | silent! lprevious | endif | endif
endfunction
nnoremap <C-p> :call QfLlPrevious()<cr>
" FIXME: does not work :(
autocmd vimrc FileType qf set norelativenumber
autocmd vimrc FileType qf wincmd J
"}}}
" Plug 'text objects' {{{
Plug 'kana/vim-textobj-user'
Plug 'kana/vim-textobj-indent'
Plug 'kana/vim-textobj-fold'
let g:textobj_function_no_default_key_mappings = 1
xmap aF <Plug>(textobj-function-a)
vmap aF <Plug>(textobj-function-a)
xmap iF <Plug>(textobj-function-i)
vmap iF <Plug>(textobj-function-i)
Plug 'kana/vim-textobj-function'
Plug 'kana/vim-textobj-line'
Plug 'kana/vim-textobj-entire'
Plug 'kana/vim-textobj-lastpat'
" Plug 'paulhybryant/vim-textobj-path'
Plug 'coderifous/textobj-word-column.vim'
Plug 'vim-scripts/argtextobj.vim'
Plug 'thinca/vim-textobj-between'
Plug 'adriaanzon/vim-textobj-matchit'
xmap a% <Plug>(textobj-matchit-a)
omap a% <Plug>(textobj-matchit-a)
xmap i% <Plug>(textobj-matchit-i)
omap i% <Plug>(textobj-matchit-i)
Plug 'beloglazov/vim-textobj-quotes'
xmap q iq
omap q iq
" Plug 'rhysd/vim-textobj-continuous-line'
Plug 'kana/vim-textobj-datetime'
Plug 'vim-utils/vim-space'
" Plug 'rsrchboy/vim-textobj-heredocs'
Plug 'Julian/vim-textobj-variable-segment'
Plug 'whatyouhide/vim-textobj-xmlattr'
" }}}
Plug 'gcmt/taboo.vim' "{{{
let g:taboo_tab_format = "[%N|%f(%W)%m] "
" let g:taboo_tab_format = "[%N|%a/%f(%W)%m] "
let g:taboo_renamed_tab_format ="[%N|%l%m(%W)] "
" TODO: Make this work
let g:taboo_unnamed_tab_label = '%a'
nmap <leader>tR :TabooReset<cr>
nmap <leader>tr :TabooRename
nmap <leader>tn :TabooOpen
nmap <leader>, gT
nmap <leader>. gt
map <c-1> gT
map <c-2> gt
" TODO: Make this indeed pwd, same for TabooOpen
nmap <leader>N :tabnew<cr>:pwd<cr>
nmap <leader>tn :$tabnew<cr>
nmap <leader>tc :tabclose<cr>
" }}}
"Plug 'francoiscabrol/ranger.vim', {'on': 'Ranger'}"{{{
"map <leader>ff :Ranger<cr>
""}}}
Plug 'simnalamburt/vim-mundo', {'on': 'MundoToggle'} "{{{
nnoremap <F4> :MundoToggle<cr>
let g:mundo_preview_bottom=1
let g:mundo_verbose_graph=0
"let g:mundo_mappings = {
" \ '<CR>': 'preview',
" \ 'o': 'preview',
" \ 'j': 'move_older',
" \ 'k': 'move_newer',
" \ '<down>': 'move_older',
" \ '<up>': 'move_newer',
" \ 'J': 'move_older_write',
" \ 'K': 'move_newer_write',
" \ 'gg': 'move_top',
" \ 'G': 'move_bottom',
" \ 'P': 'play_to',
" \ 'd': 'diff',
" \ 'i': 'toggle_inline',
" \ '/': 'search',
" \ 'n': 'next_match',
" \ 'N': 'previous_match',
" \ 'p': 'diff_current_buffer',
" \ 'r': 'diff',
" \ '?': 'toggle_help',
" \ 'q': 'quit',
" \ '<2-LeftMouse>': 'mouse_click' }
"autocmd vimrc FileType Mundo nnoremap <buffer> ; <cr>l
"" }}}
" Plug 'mbbill/undotree', {'on': 'UndotreeToggle'} "{{{
" let g:undotree_WindowLayout = 2
" let g:undotree_SetFocusWhenToggle = 1
" " let g:undotree_DiffCommand = "diff -y"
" let g:undotree_DiffCommand = "diff -U 5"
" let g:undotree_DiffpanelHeight = 25
" let g:undotree_TreeNodeShape = "o"
" nnoremap <F4> :UndotreeToggle<cr>
" autocmd vimrc FileType undotree nmap <buffer> ; <cr>
" " }}}
" Plug 'vim-pandoc/vim-pandoc', {'for': ['pandoc', 'markdown']} "{{{
" Plug 'vim-pandoc/vim-pandoc-syntax'
" autocmd vimrc FileType markdown set wrap
" let g:pandoc#folding#level = 9
" let g:pandoc#formatting#mode = 'hA' " hard wraps, auto smart
" let g:pandoc#formatting#mode = 'h' " soft wraps
" let g:pandoc#formatting#mode = 's' " soft wraps
" let g:pandoc#formatting#mode = 'a' " autoformatting
" let g:pandoc#formatting#mode = 'A' " smart autoformatting (watch out for source code)
" let g:pandoc#formatting#textwidth=79
" let g:pandoc#modules#disabled = ["chdir"]
" let g:pandoc#formatting#extra_equalprg="--atx-headers"
" let g:pandoc#formatting#equalprg= "pandoc -t markdown --atx-headers --columns " . g:pandoc#formatting#textwidth
" let g:pandoc#formatting#smart_autoformat_on_cursormoved = 0
" }}}
"Plug 'chrisbra/csv.vim', {'for': 'csv' } "{{{
"" hi CSVColumnEven term=bold ctermbg=4 guibg=DarkBlue
"" hi CSVColumnOdd term=bold ctermbg=5 guibg=DarkMagenta
"" hi link CSVColumnOdd MoreMsg
"" hi link CSVColumnEven Question
"" autocmd vimrc Filetype csv hi CSVColumnEven ctermbg=4
"" autocmd vimrc Filetype csv hi CSVColumnOdd ctermbg=5
"let g:csv_no_column_highlight = 0
"let b:csv_arrange_align = 'l*'
"let g:csv_arrange_align = 'l*'
"let g:csv_autocmd_arrange = 1
"" TODO: If readonly set nofile?
"map <leader>CT :setlocal modifiable<cr>:setlocal filetype=csv<cr>let g:csv_delim="\t"<cr>ggVG:ArrangeColumn!<cr>let b:csv_headerline = 0<cr>
"map <leader>C; :setlocal modifiable<cr>:setlocal filetype=csv<cr>let g:csv_delim=";"<cr>ggVG:ArrangeColumn!<cr>let b:csv_headerline = 0<cr>
"" map <leader>C, :setlocal modifiable<cr>:setlocal filetype=csv<cr>let g:csv_delim=','<cr>ggVG:ArrangeColumn!<cr>let b:csv_headerline = 0<cr>
"map <leader>C, :setlocal modifiable<cr>:setlocal filetype=csv<cr>:NewDelimiter ,<cr>ggVGG:ArrangeColumn!<cr>let b:csv_headerline = 0<cr>
"map <leader>CC :setlocal modifiable<cr>:setlocal filetype=csv<cr>ggVG:ArrangeColumn!<cr>let b:csv_headerline = 0<cr>
"map <leader>CS :set noreadonly<cr>:setlocal modifiable<cr>:%s/\s\{1,\}/,/<cr>:let @/=""<cr>:setlocal filetype=csv<cr>ggVG:ArrangeColumn!<cr>let g:csv_headerline=0<cr>0
"autocmd vimrc BufRead,BufNewFile *.csv set filetype=csv
"" TODO: Add toggle reverse order support
"autocmd vimrc FileType csv map <buffer> <leader>cs :Sort<cr>
"autocmd vimrc FileType csv map <buffer> <leader>c/ :CSVSearchInColumn
"autocmd vimrc FileType csv map <buffer> <leader>ca :Analyze<cr>
"" TODO: Add maps for
"" -Toggle aligns (left, right, etc.)
"" -Number types (hex, etc.)
"" }}}
"Plug 'kelwin/vim-smali', {'for': 'smali'} "{{{
""Plug 'alderz/smali-vim'
"autocmd vimrc BufRead *.smali set filetype=smali
"" }}}
"Plug 'xolox/vim-lua-ftplugin', {'for': 'lua'} "{{{
Plug 'xolox/vim-misc'
" }}}
" Plug 'elzr/vim-json', {'for': 'json'} "{{{
" autocmd vimrc FileType json set conceallevel=0
" let g:vim_json_syntax_concealcursor = 0
" }}}
Plug 'scrooloose/nerdtree' "{{{
" Plug 'Xuyuanp/nerdtree-git-plugin'
" let g:NERDTreeShowIgnoredStatus = 1
let g:NERDTreeGitStatusShowIgnored = 1
let g:NERDTreeGitStatusIndicatorMapCustom = {
\ "Modified" : "M",
\ "Staged" : "+",
\ "Untracked" : "N",
\ "Renamed" : "R",
\ "Unmerged" : "<",
\ "Deleted" : "D",
\ "Dirty" : ">",
\ "Clean" : "C",
\ "Ignored" : 'I',
\ "Unknown" : "?"
\ }
let NERDTreeIgnore = ['\~$[[file]]', '\.pyc$[[file]]']
let NERDTreeShowHidden = 1
let NERDTreeWinSize = 46
let NERDTreeMinimalUI = 1
autocmd vimrc FileType nerdtree map <buffer> l oj^
autocmd vimrc FileType nerdtree map <buffer> c o
"autocmd vimrc FileType nerdtree map <buffer> O mo
autocmd vimrc FileType nerdtree map <buffer> h x^
autocmd vimrc FileType nerdtree map <buffer> ; go
autocmd vimrc FileType nerdtree map <buffer> <F2> :NERDTreeClose<cr>
nnoremap <F2> :NERDTreeFind<cr>
" }}}
""Plug 'tyru/open-browser.vim' "{{{
""" let g:netrw_nogx = 1 " disable netrw's gx mapping.
""nmap gx <Plug>(openbrowser-smart-search)
""vmap gx <Plug>(openbrowser-smart-search)
""command! OpenBrowserCurrent execute "OpenBrowser" "file://" . expand('%:p:gs?\\?/?')
""map gX OpenBrowserCurrent
""" let g:openbrowser_browser_commands = [
""" \ {'name': 'google-chome',
""" \ 'args': ['start', '{browser}', '{uri}']}
""" \]
"""}}}
"Plug 'dsh2/tagbar' " ", {'on': 'TagbarToggle'}
"Plug 'hushicai/tagbar-javascript.vim' " {{{
"let g:tagbar_autoclose = 0
"" TODO: Add support for percent instead of number of characters
"let g:tagbar_width = 40
"let g:tagbar_zoomwidth = 0
"let g:tagbar_compact = 1
"let g:tagbar_indent = 1
"let g:tagbar_show_linenumbers = 0
"let g:tagbar_autofocus = 0
"let g:tagbar_hide_nonpublic = 0
"let g:tagbar_autoshowtag = 1
"let g:tagbar_autopreview = 0
"map <leader>tt :silent! TagbarToggle<cr>
"autocmd vimrc VimEnter * nested :silent! call tagbar#autoopen(1)
"" autocmd vimrc VimEnter * nested :silent! TagbarToggle
"autocmd vimrc FileType tagbar map <buffer> ; p
"autocmd vimrc FileType tagbar map <buffer> A x
"autocmd vimrc FileType tagbar map <buffer> l za
"autocmd vimrc FileType tagbar map <buffer> h za
"" }}}
"Plug 'jeetsukumaran/vim-markology' "{{{
"let g:markology_enable = 0
"let g:markology_textlower = "\t>"
"let g:markology_textupper = "\t}"
"let g:markology_textother = "\t:"
"let g:markology_hlline_lower = 0
"let g:markology_hlline_upper = 0
"let g:markology_hlline_other = 0
"highlight MarkologyHLl ctermfg=Cyan ctermbg=black
"highlight MarkologyHLu ctermfg=Cyan ctermbg=black
"highlight MarkologyHLo ctermfg=Cyan ctermbg=black
"" }}}
"Plug 'brookhong/ag.vim', {'on': 'Ag'} "{{{
"" map <leader>a :Ag! \\b<cword\\b><CR>
"" map <leader>a :Ag! <cword><CR>
map <leader>a :Rg <cword><CR>
"map <leader><leader>a :Rg --no-ignore <cword><CR>
"vnoremap <leader>a :<c-u>execute("Ag -- ") . GetSelected()<cr>
"" }}}
"Plug 'szw/vim-maximizer', {'on': 'MaximizerToggle'} "{{{
"nnoremap <c-w>m :MaximizerToggle<cr>
"nnoremap <c-w><c-m> :MaximizerToggle<cr>
""}}}
Plug 'bling/vim-airline' "{{{
Plug 'vim-airline/vim-airline-themes'
Plug 'ompugao/vim-airline-cwd'
let g:airline#extensions#branch#enabled = 0
let g:airline#extensions#branch#empty_message = '(no branch)'
let g:ale_virtualtext_cursor = 0
let g:airline#extensions#ale#enabled = 1
let g:airline#extensions#syntastic#enabled = 1
let g:airline#extensions#capslock#enabled = 1
let g:airline#extensions#whitespace#enabled = 0
let g:airline#extensions#csv#enabled = 1
let g:airline#extensions#nerdtree_status = 1
let g:airline#extensions#tagbar#enabled = 1
let g:airline_detect_paste=0
let g:airline_detect_modified=1
let g:airline_detect_spelllang=1
let g:airline#parts#ffenc#skip_expected_string='utf-8[unix]'
" }}}
Plug 'tpope/vim-jdaddy'
Plug 'tpope/vim-dispatch' "{{{
" map <leader>M :update<cr>:Make<cr>:copen<cr>/error:<cr>n
map <leader>m :update<cr>:Make<cr>:checktime<cr>
" }}}
Plug 'sickill/vim-pasta' "{{{
" let g:pasta_disabled_filetypes = ['python', 'coffee', 'yaml', 'tagbar']
let g:pasta_disabled_filetypes = ['qf', 'tagbar', 'netrw']
"}}}
let g:no_cecutil_maps=1
Plug 'powerman/vim-plugin-AnsiEsc', {'on': 'AnsiEsc'} "{{{
map <leader>W :AnsiEsc<cr>
" Remove ansi escape sequence
if executable("strip-ansi")
function! StripAnsi()
:silent %!strip-ansi
echo "StripAnsi: called strip-ansi-cli"
endfunction
else
function! StripAnsi()
let @/='\v%x1b[(\d{0,3})(;\d{1,3}){0,5}(m|K)'
silent! execute "%s:::"
echo "StripAnsi: search-and-replace"
endfunction
endif
command! StripAnsi call StripAnsi()
map <leader>Q :StripAnsi<cr>
"}}}
Plug 'romgrk/winteract.vim', {'on': 'InteractiveWindow'} "{{{
nmap gw :InteractiveWindow<CR>
"}}}
"Plug 'Shougo/vinarise.vim', {'on': 'Vinarise'} "{{{
"map <leader>V :Vinarise<cr>
""}}}
"Plug 'nathanaelkane/vim-indent-guides', {'on': 'IndentGuidesToggle'} "{{{
"let g:indent_guides_guide_size = 1
"" let g:indent_guides_start_level = 2
""}}}
"Plug 'junegunn/vim-peekaboo' "{{{
"let g:peekaboo_window = 'vertical botright 51new'
"let g:peekaboo_delay = 0
"let g:peekaboo_compact = 0
""}}}
Plug 'Chiel92/vim-autoformat', {'on': 'Autoformat'} "{{{
" let g:formatdef_my_custom_json = '"jq -s"'
let g:formatdef_my_custom_json = '"jq ."'
let g:formatdef_my_custom_sh = '"shfmt -i 0 -bn -ci -sr"'
let g:formatters_sh = ['my_custom_sh']
let g:formatters_json = ['my_custom_json']
let g:formatdef_my_custom_sql = '"sqlformat -k lower -i lower --indent_width 4 -"'
let g:formatters_sql = ['my_custom_sql']
let g:autoformat_verbosemode=1
" TODO: try to understand why resetting syn is necessary
map <leader>A :Autoformat \| syn off \| syn on \" set foldlevel=1<cr>
"}}}
Plug 'tpope/vim-commentary' "{{{
autocmd vimrc BufNewFile,BufReadPost authorized_keys,known_hosts,*.conf setlocal commentstring=#\ %s
" autocmd vimrc FileType asn setlocal commentstring=--\ %s
autocmd vimrc FileType config,crontab,expect,exports,fstab,dosini,sshconfig,systemd,i3config,jq,resolv,gitconfig setlocal commentstring=#\ %s
autocmd vimrc FileType asn,sql setlocal commentstring=--\ %s
nmap gcC yygccp
"}}}
"Plug 'tpope/vim-commentary' "{{{
"autocmd vimrc BufNewFile,BufReadPost authorized_keys,known_hosts,*.conf setlocal commentstring=#\ %s
"" autocmd vimrc FileType asn setlocal commentstring=--\ %s
"autocmd vimrc FileType config,crontab,expect,exports,fstab,dosini,sshconfig,systemd,i3config,jq,resolv,gitconfig setlocal commentstring=#\ %s
"autocmd vimrc FileType asn,sql setlocal commentstring=--\ %s
"nmap gcC yygccp
""}}}
"Plug 'pseewald/vim-anyfold'
"Plug 'dsh2/diff-fold.vim', {'for': 'diff'} "{{{
"autocmd vimrc FileType diff map <buffer> <leader>d <Plug>DiffFoldNav
""}}}
"Plug 'skywind3000/asyncrun.vim', {'on': 'AsyncRun'} "{{{
"" map <leader>B :AsyncRun binwalk %<cr>
"autocmd vimrc User AsyncRunStart call asyncrun#quickfix_toggle(8, 1)
"autocmd vimrc BufReadPost .\\\{0,1\}vimrc,vimrc.nvim,init.vim,nvimrc,.nvimrc nnoremap <buffer> <silent> <cr> 0f/lgf
""}}}
"Plug 'atimholt/spiffy_foldtext' "{{{
"" TODO: Add more preview text, squece as much content as possible?
"let g:SpiffyFoldtext_format='%c{-} %<%f{-}| %4n lines |-%l{--}'
""}}}
"Plug 't9md/vim-quickhl'
"Plug 'dsh2/HiCursorWords' "{{{
"let g:HiCursorWords_delay = 10
"let g:HiCursorWords_hiGroupRegexp = ''
"" let g:HiCursorWords_style='term=reverse cterm=reverse gui=reverse'
"" let g:HiCursorWords_linkStyle='ErrorMsg'
"" let g:HiCursorWords_linkStyle='IncSearch'
"let g:HiCursorWords_linkStyle='MatchParen'
"" let g:HiCursorWords_linkStyle='VisualNOS'
"" let g:HiCursorWords_debugEchoHiName = 1
"let g:HiCursorWords_debugEchoHiName = 0
"" }}}
Plug 'flatcap/vim-keyword' "{{{
" TODO: Make this work
map <leader>k <plug>KeywordToggle
map <leader>K :call keyword#KeywordClear()<cr>
let g:keyword_group = 'keyword_group'
" let g:keyword_highlight = 'ctermbg=darkred cterm=underline'
let g:keyword_highlight = 'ctermbg=darkred'
"}}}
Plug 'vim-scripts/LargeFile'"{{{
let g:LargeFile = 50
set synmaxcol=2048"}}}
Plug 'w0rp/ale' "{{{
autocmd vimrc FileType cpp nmap <leader><leader> :ALEGoToDefinitionInVSplit<cr>
autocmd vimrc FileType cpp nmap <leader> :ALEGoToDefinitionInSplit<cr>
" autocmd vimrc FileType cpp nmap :ALEGoToDefinition<cr>
autocmd vimrc FileType cpp nmap x :ALEFindReferences<cr>
autocmd vimrc FileType cpp nmap <leader>~ :ALEHover<cr>
let g:airline#extensions#ale#enabled = 1
let g:ale_set_loclist = 1
let g:ale_set_quickfix = 0
let g:ale_open_list = 0
let g:ale_keep_list_window_open = 1
let g:ale_fix_on_save = 1
let g:ale_lint_on_enter = 1
" let g:ale_lint_on_text_changed = "never"
let g:ale_lint_on_text_changed = "always"
" let g:ale_open_list = "never"
let g:ale_open_list = "always"
" }}}
Plug 'machakann/vim-highlightedyank'"{{{
let g:highlightedyank_highlight_duration = 333
if !exists('##TextYankPost')
map y <Plug>(highlightedyank)
endif
"}}}
Plug 'derekwyatt/vim-fswitch'"{{{
autocmd vimrc BufEnter *.h let b:fswitchdst = 'cc' | let b:fswitchlocs = '../inc'
autocmd vimrc BufEnter *.cc let b:fswitchdst = 'h' | let b:fswitchlocs = '../inc'
let g:fsnonewfiles="off"
nmap <silent> <Leader>of :FSHere<cr>
nmap <silent> cof :FSHere<cr>
"}}}
" Plug tmux {{{
Plug 'tmux-plugins/vim-tmux', {'for': 'tmux'}
autocmd vimrc BufRead tmux.conf set filetype=tmux
Plug 'tmux-plugins/vim-tmux-focus-events'
Plug 'wellle/tmux-complete.vim'
let g:tmuxcomplete#trigger = 'omnifunc'
"}}}
" Plug colorschemes {{{
Plug 'machakann/vim-colorscheme-reki'
Plug 'machakann/vim-colorscheme-tatami'
Plug 'morhetz/gruvbox'
Plug 'rhysd/vim-color-spring-night'
Plug 'Lokaltog/vim-distinguished'
Plug 'altercation/vim-colors-solarized'
let g:solarized_termcolors=256
let g:solarized_contrast="normal"
let g:solarized_visibility="normal"
let g:solarized_diffmode="high"
Plug 'chriskempson/vim-tomorrow-theme'
Plug 'jnurmine/Zenburn'
Plug 'junegunn/seoul256.vim'
Plug 'nanotech/jellybeans.vim'
Plug 'pwntester/VimCobaltColourScheme'
Plug 'pwntester/cobalt2.vim'
Plug 'reedes/vim-colors-pencil'
Plug 'tomasr/molokai'
Plug 'xolox/vim-colorscheme-switcher'
" }}}
Plug 'mogelbrod/vim-jsonpath'" {{{
let g:jsonpath_register = '+'
autocmd vimrc FileType json noremap <buffer> <silent> <leader>p :call jsonpath#echo()<CR>
autocmd vimrc FileType json noremap <buffer> <silent> <leader>g :call jsonpath#goto()<CR>
"}}}
Plug 'matze/vim-ini-fold' "{{{
autocmd vimrc BufNewFile,BufReadPost wg*\.conf,*.nmconnection,*/NetworkManager/system-connections/* setfiletype dosini"
"}}}
"Plug 'machakann/vim-highlightedundo' "{{{
"let g:highlightedundo#highlight_mode=2
"nmap u <Plug>(highlightedundo-undo)
nmap U :redo<cr>
"nmap g- <Plug>(highlightedundo-gminus)
"nmap g+ <Plug>(highlightedundo-gplus)
""}}}
" autocmd vimrc FileType go nmap <a-s-k> :GoDocBrowser<cr>
" autocmd vimrc FileType go nmap <f9> :GoDebugBreakpoint<cr>
" autocmd vimrc FileType go nmap <leader>B :GoBuild<cr>
" autocmd vimrc FileType go nmap <a-s-r> :GoDebugStart<cr>
" autocmd vimrc FileType go nmap <c-a-s-r> :GoDebugStop<cr>
" autocmd vimrc FileType go nmap <s-f10> :GoDebugNext<cr>
" autocmd vimrc FileType go nmap <s-f11> :GoDebugStep<cr>
" autocmd vimrc FileType go nmap <a-s-f11> :GoDebugStepOut<cr>
" autocmd vimrc FileType go nmap <leader>T :GoDecls<CR>
" autocmd vimrc FileType go nmap <leader>m :<C-u>call <SID>build_go_files()<CR>
" autocmd vimrc FileType go map <buffer> <leader>r :GoRun<cr>
" autocmd vimrc FileType go map <buffer> <leader>~ :GoDescribe<cr>
" autocmd vimrc FileType go nmap <c-space> :GoDescribe<CR>
" autocmd vimrc FileType go map <buffer> <s-f2> :GoRename<cr>
" autocmd vimrc FileType go map <buffer> <c-\>s :GoReferrers<cr>
" autocmd vimrc FileType go map <buffer> <leader><c-]> :<C-U>call go#def#Jump("vert", 0)<CR>
" " let g:go_debug = [ 'shell-commands', 'debugger-state', 'debugger-commands', 'lsp' ]
" " let g:go_debug = [ 'lsp' ]
" let g:go_info_mode = 'guru'
" let g:go_fmt_command = "goimports"
" " }}}
" Plug 'dsh2/vim-man' " TODO: { 'dir': '~/.vim-man', 'do': 'git pull orig' } " {{{
" augroup manlaunchtoc
" autocmd!
" if has('nvim')
" autocmd FileType man
" \ call man#show_toc() |
" \ setlocal laststatus=0 nonumber norelativenumber |
" \ nnoremap <buffer> l <Enter> |
" \ wincmd H |
" \ vert resize 35 |
" \ wincmd p
" endif
" augroup end
" }}}
" Plug 'sakhnik/nvim-gdb'
" Plug 'udalov/javap-vim'
"" Plug rest... {{{
Plug 'terryma/vim-expand-region'
Plug 'tpope/vim-abolish'
Plug 'nfnty/vim-nftables'
Plug 'jremmen/vim-ripgrep'
Plug 'tpope/vim-endwise'
"Plug 'pedrohdz/vim-yaml-folds'
"Plug 'tpope/vim-bundler'
"Plug 'Quramy/tsuquyomi'
"Plug 'tommcdo/vim-exchange'
Plug 'szw/vim-dict'
Plug 'google/vim-searchindex'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-repeat'
Plug 'dsh2/vim-CtrlXA'
Plug 'Valloric/vim-operator-highlight'
Plug 'tmhedberg/matchit'
"Plug 'ervandew/matchem'
"Plug 'chrisbra/Colorizer'
"Plug 'chrisbra/Recover.vim'
"Plug 'StanAngeloff/php.vim'
"Plug 'rayburgemeestre/phpfolding.vim'
Plug 'dsh2/vim-unimpaired'
Plug 'christoomey/vim-sort-motion'
" Plug 'christoomey/vim-system-copy'
Plug 'embear/vim-foldsearch'
Plug 'junegunn/rainbow_parentheses.vim'
Plug 'lzap/vim-selinux', {'for': 'te'}
Plug 'mboughaba/i3config.vim', {'for': 'i3config'}
Plug 'nelstrom/vim-visual-star-search'
Plug 'tpope/vim-afterimage'
" Plug 'tpope/vim-dadbod'
Plug 'tpope/vim-eunuch'
"Plug 'tpope/vim-rsi'
Plug 'tpope/vim-tbone'
Plug 'tpope/vim-abolish'
"Plug 'vim-scripts/ReplaceWithRegister'
"Plug 'vim-scripts/VCard-syntax', {'for': 'vcard'}
"Plug 'vim-scripts/info.vim', {'on': 'Info'}
Plug 'vim-scripts/renamer.vim', {'on': 'Renamer'}
"Plug 'wannesm/wmgraphviz.vim', {'for': 'dot'}
Plug 'z0mbix/vim-shfmt', { 'for': 'sh' }
"Plug 'frioux/vim-regedit'
""}}}
Plug 'Shougo/deoplete.nvim' " {{{
let g:deoplete#enable_at_startup = 0
autocmd vimrc InsertEnter * call deoplete#enable()
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'Shougo/neosnippet.vim'
Plug 'Shougo/neosnippet-snippets'
Plug 'Shougo/context_filetype.vim'
" Plugin key-mappings.
" Note: It must be "imap" and "smap". It uses <Plug> mappings.
inoremap <expr><tab> pumvisible() ? "<Plug>(neosnippet_expand_or_jump)" : "\<tab>"
snoremap <expr><tab> pumvisible() ? "<Plug>(neosnippet_expand_or_jump)" : "\<tab>"
xnoremap <expr><tab> pumvisible() ? "<Plug>(neosnippet_expand_or_jump)" : "\<tab>"
imap <C-k> <Plug>(neosnippet_expand_or_jump)
smap <C-k> <Plug>(neosnippet_expand_or_jump)
xmap <C-k> <Plug>(neosnippet_expand_target)
" SuperTab like snippets behavior.
" Note: It must be "imap" and "smap". It uses <Plug> mappings.
imap <expr><TAB>
\ pumvisible() ? "\<C-n>" :
\ neosnippet#expandable_or_jumpable() ?
\ "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
smap <expr><TAB> neosnippet#expandable_or_jumpable() ?
\ "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
" For conceal markers.
if has('conceal')
set conceallevel=2 concealcursor=niv
endif
Plug 'Shougo/neoinclude.vim'
Plug 'fszymanski/deoplete-emoji'
Plug 'Shougo/neco-vim'
Plug 'ujihisa/neco-look'
Plug 'deoplete-plugins/deoplete-jedi'
Plug 'udalov/kotlin-vim'
call plug#end()
call deoplete#custom#option({
\ 'auto_refresh_delay': 100,
\ 'camel_case': v:true,
\ 'smart_case': v:true,
\ 'skip_multibyte': v:true,
\ 'prev_completion_mode': 'filter',
\ 'auto_preview': v:false,
\ })
" \ 'auto_preview': v:true,
" \ 'prev_completion_mode': 'none',
" inoremap <expr><c-j> pumvisible() ? "\<c-n>" : "\<c-j>"
" inoremap <expr><c-k> pumvisible() ? "\<c-p>" : "\<c-k>"
" inoremap <silent><expr> <tab>
" \ pumvisible() ? "\<C-n>" :
" \ <SID>check_back_space() ? "\<TAB>" :
" \ deoplete#manual_complete()
" function! s:check_back_space() abort
" let col = col('.') - 1
" return !col || getline('.')[col - 1] =~ '\s'
" endfunction
call deoplete#custom#var(
\ 'around', {
\ 'range_above': 15,
\ 'range_below': 15,
\ 'mark_above': '[↑]',
\ 'mark_below': '[↓]',
\ 'mark_changes': '[*]',})
call deoplete#custom#source('member', 'filetypes', [])
call deoplete#custom#source('emoji', 'filetypes', [])
call deoplete#custom#source('emoji', 'converters', ['converter_emoji'])
call deoplete#custom#option('omni_patterns', { 'go': '[^. *\t]\.\w*' })
"}}}
endif
"}}}
" Global options {{{
set autoindent
set autowrite
set backspace=indent,eol,start
" TODO: update to neovim
" set backupdir=~/.vim/backup/
set cmdheight=2
set cmdwinheight=10
set complete+=kt
" set completeopt=menuone,preview
set completeopt=menuone
set concealcursor=n
set conceallevel=0
set clipboard=unnamedplus
" set diffopt=iwhite
set diffopt=filler,context:4
" set dir=~/.vim/swo
set encoding=utf8
set exrc
set secure
let g:xml_syntax_folding=1
set foldmethod=syntax
" set foldlevelstart=99
" set foldopen=hor,mark,percent,quickfix,search,tag,undo
set foldopen=hor,search,quickfix,tag
set gdefault
set grepprg=grep\ -nH\ $*
set hidden
set history=9999
set hlsearch
set ignorecase
set incsearch
set isfname-==
set laststatus=2
set mouse=a
set mousefocus
set nobackup
set relativenumber
set nospell
" set nowrap
set wrap
set linebreak
set nowrapscan
set number
set previewheight=14
set ruler
au BufEnter,BufNew,OptionSet * if &diff | set scrolloff=10 | else | set scrolloff=99 | endif
set shellslash
set shiftwidth=4
set tabstop=4
set shortmess=filnxtToOI
set showbreak=›
set showcmd
set showfulltag
set showmatch
set sidescroll=15
set sidescrolloff=8
set dictionary+=/usr/share/dict/american-english
set smartcase
set smartindent
set smarttab
set statusline=%<%f%h%m%r%=%b\ 0x%B\ \ %l,%c%V\ %P
" Maybe better add this to a local vimrc for c-projects
" set tags+=$HOME/.usr.include.tags
set tags+=$HOME/.usr.include.tags
set title
set titleold=''
set titlestring=%t%(\ %M%)%(\ (%{expand(\"%:p:h\")})%)%(\ %a%)\ -\ %{v:servername}
set notimeout
set nottimeout
set ttimeoutlen=50
set undodir=~/.local/share/nvim/undo
set nofoldenable
set undofile
set updatetime=500
" set virtualedit=all
set wildignore=*~,*.o,*.obj,*.aux
set wildmenu
set wildmode=list:longest,full
autocmd vimrc BufNewFile,BufReadPost Vagrantfile setfiletype ruby
autocmd vimrc BufNewFile,BufReadPost .clang-format setfiletype yaml
autocmd vimrc BufNewFile,BufReadPost *.run setfiletype expect
autocmd vimrc BufNewFile,BufReadPost *.jq setfiletype config
" }}}
" Mappings {{{
map <leader>Dd :set spelllang=de<cr>
map <leader><c-r> :update<cr>:source %<cr>
" gdb helper {{{
nmap <m-8> :bot split term://$SHELL<cr>i
" nmapemap <cr> i
" tnoremap <leader><c-k> ?@(gdb)
" tnoremap <c-k> ?@(gdb)
tnoremap <expr> <c-s-v> '<c-\><c-n>"'.nr2char(getchar()).'pi'
tnoremap <c-[> <c-\><c-n>
" nnoremap ,w :call TermDebugSendCommand('where')<CR>
nnoremap <m-s-r> :Stop<cr>
nnoremap <f9> :Break<cr>
nnoremap <leader>B :Break<cr>
nnoremap <s-f10> :Over<cr>
nnoremap <s-f11> :Step<cr>
nnoremap <c-s-f11> :Finish<cr>
" }}}
cabbr BB <buffer>
nmap <nowait> <leader>s :update<cr>\|:silent exec "!touch %"<cr>
" nnoremap <c-s> :update<cr>
inoremap <c-s> <c-o>:update<cr><esc>
map <a-s> <c-o>:update<cr><esc>
map <c-s> :Redir let<cr>gsae:se ft=conf buftype=nofile<cr>:se ts=43<cr>:%s/^\S*\zs\s\+/\t/<cr>gg:setl nohlsearch<cr>:FzfBLines<cr>
nmap Q :cq<cr>
map <leader>S :syn off \| syn on \| se foldenable foldlevel=2<cr>
nmap <leader>J :StripAnsi<cr>:set ft=json<cr>:Autoformat<cr>:syn off \| syn on \| se foldenable foldlevel=2<cr>
nmap <leader>X :StripAnsi<cr>:set ft=xml<cr>:Autoformat<cr>
nmap <leader>Y :StripAnsi<cr>:set ft=yaml<cr>:Autoformat<cr>:syn off \| syn on \| se foldenable foldlevel=2<cr>
map
map :bnext<cr>
map <c-.> :bprev<cr>
" map <leader><c-l> :redraw!<cr>:echo "Redraw!"<cr>
nmap <leader>o :silent !open "%"<cr>
nmap <nowait> <leader>s :update<cr>
" TODO: PWD vs. CWD
" TODO: merge witih neovim rc files
map <silent><leader>R :source ~/.config/nvim/init.vim \| if filereadable("./.vimrc") \| source ./.vimrc \| endif<cr>
" TODO: source scriptname instead
map <silent><leader>R :update<cr>:source ~/.config/nvim/init.vim<cr>
nnoremap <cr> :nohlsearch<CR>/<BS><CR>
" prepend space on <c-space>?
" imap <NUL> <space>h
" imap <c-space> <space>h
imap <s-space> <space>h
nmap <leader>cc :cd ..<cr>:pwd<cr>
" TODO: Filter ansi escape sequences from filename when file not found
nnoremap gf gF
" nnoremap gF :tabedit <cfile><cr>
nnoremap gF :split <cfile><cr>
map <c-w>v <c-w>v<c-w>l
map <leader>DU :diffupdate<cr>
vmap DP :diffput<cr>
vmap <leader>dp :diffput<cr>
vmap DG :diffget<cr>
nmap <leader>DD :diffthis<CR>
nmap <leader>DO :diffoff<CR>
nmap <leader>DS :vertical diffsplit<CR>
" TODO: Clean this up...
nnoremap <leader>cd :execute ":lcd " . substitute(expand("%:p:h"), ' ', '\\ ', 'g')<cr>:pwd<cr>"<cr>
nnoremap <leader>cD :Gcd<cr>:pwd<cr>
nnoremap <leader>C :Gcd<cr>:pwd<cr>
nnoremap <leader>gcd :Gcd<cr>:pwd<cr>
nmap <c-q> :cq<cr>
nmap <leader>P :pwd<cr>
nmap zx za
nmap <leader>BD :bdelete!<cr>
nmap <leader>DW :Delete<cr>:echo "FILE DELETED."<cr>
" TODO: add toggle for this: coG?
function! ToggleLineBreakMode()
if maparg("j", "n") == "gj"
unmap j
unmap k
unmap gj
unmap gk
" unmap 0
" unmap g0
echo "NOT breaking lines on movement."
else
nnoremap gj j
nnoremap gk k
nnoremap j gj
nnoremap k gk
" nnoremap g0 0
" nnoremap 0 g0
echo "Breaking lines on movement."
endif
endfunction
nmap coG :call ToggleLineBreakMode()<cr>
noremap zz :set scrolloff=99<cr>zz
" Delete all matching lines
vmap <silent> <leader>D g*:%g//d<cr>
nmap <silent> <leader>D v$g*:%g//d<cr>
" TODO
" -Add convert to hex/bin/etc.
" -Parse as data-uri
" -Encode/decode as base64, uu, etc.
" -ROT13
" -Disassem ARM/Intel
map <leader>d :echo strftime('%F %T', expand("<cword>"))<cr>
" Split navigations
nnoremap <c-j> <c-w><c-j>
nnoremap <c-k> <c-w><c-k>
nnoremap <c-l> <c-w><c-l>
nnoremap <c-h> <c-w><c-h>