-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
executable file
·1727 lines (1524 loc) · 53.4 KB
/
Copy pathvimrc
File metadata and controls
executable file
·1727 lines (1524 loc) · 53.4 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
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
if has("win64") || has("win32")
source $VIMRUNTIME/vimrc_example.vim
endif
let g:user_name = $USER
" let g:lsp_cl="vimlsp"
let g:lsp_cl="neocl"
" set term=xterm-256color
"fix alt arrow from terminal which is not xterm
" if &term =~ "alacritty" || &term =~ "st"
" echom "APPLY FIX"
" execute "set <xUp>=\e[1;*A"
" execute "set <xDown>=\e[1;*B"
" execute "set <xRight>=\e[1;*C"
" execute "set <xLeft>=\e[1;*D"
" " map <ESC>[1;5A <C-Up>
" " map <ESC>[1;5B <C-Down>
" " map <ESC>[1;5C <C-Right>
" " map <ESC>[1;5D <C-Left>
" " imap <ESC>[1;5A <C-Up>
" " imap <ESC>[1;5B <C-Down>
" " imap <ESC>[1;5C <C-Right>
" " imap <ESC>[1;5D <C-Left>
" endif
set nocompatible
filetype plugin on
set modelines=0
set nomodeline
set clipboard=unnamedplus
" execute pathogen#infect()
call plug#begin('~/.vim/bundle')
Plug 'andymass/vim-matchup'
" Plug 'liuchengxu/vim-clap'
" Plug 'ap/vim-buftabline'
" Plug 'pacha/vem-tabline'
" edit macros
Plug 'hiroakis/vim-breakline'
Plug 'vimwiki/vimwiki'
Plug 'haya14busa/incsearch.vim'
Plug 'haya14busa/incsearch-easymotion.vim'
Plug 'easymotion/vim-easymotion'
Plug 'rbong/vim-buffest'
Plug 'rhysd/vim-healthcheck'
Plug 'mg979/vim-visual-multi'
Plug 'mptre/vim-printf'
Plug 'ronakg/quickr-preview.vim'
" Plug 'wellle/context.vim'
Plug 'junkblocker/git-time-lapse'
" tagbar more up-to-date but seem slower
" Plug 'liuchengxu/vista.vim.git'
" Plug 'liuchengxu/vim-clap.git'
" Plug 'liuchengxu/vim-clap', { 'do': function('clap#helper#build_all') }
Plug 'liuchengxu/vim-clap', { 'do': ':Clap install-binary!' }
" Plug 'mg979/vim-yanktools'
Plug 'bignimbus/you-are-here.vim'
"comming info under cursor
" Plug 'rhysd/git-messenger.vim'
" Plug 'dhruvasagar/vim-zoom'
" Plug 'neoclide/coc.nvim', {'do': { -> coc#util#install()}}
" Plug 'junegunn/vim-peekaboo'
" Plug 'Yilin-Yang/vim-markbar'
Plug 'ojroques/vim-oscyank'
Plug 'tomtom/tcomment_vim'
"very slow on x deleting
" Plug 'vim-scripts/YankRing.vim'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
Plug 'pbogut/fzf-mru.vim'
" Plug 'jupyter-vim/jupyter-vim'
Plug '~/.vim/bundle/molokai'
" Plug 'zefei/vim-colortuner', { 'on': 'Colortuner' }
" Plug 'xolox/vim-notes'
Plug 'xolox/vim-misc'
Plug 'markonm/traces.vim'
Plug 'justinmk/vim-sneak'
if ( g:lsp_cl == "neocl" )
" Plug 'autozimu/LanguageClient-neovim', { 'on': 'LanguageClientStart' }
Plug 'autozimu/LanguageClient-neovim', {
\ 'branch': 'next',
\ 'do': 'bash install.sh',
\ }
else
" Plug 'devjoe/vim-codequery', { 'for': 'cpp' }
Plug 'prabirshrestha/vim-lsp'
" Plug 'pdavydov108/vim-lsp-cquery', { 'for': 'cpp' }
" Plug 'pdavydov108/vim-lsp-cquery'
endif
" Plug 'tomasr/molokai' " now it's ok in plug menu...but it won't update
" Plug 'simnalamburt/vim-mundo', { 'on': 'MundoToggle' }
Plug 'ronakg/quickr-cscope.vim'
" Plug 'octol/vim-cpp-enhanced-highlight', { 'for': 'cpp' } "maybe I am ok with just c.vim in .vim/syntax
" Plug 'severin-lemaignan/vim-minimap', { 'on': 'Minimap' }
" Plug 'majutsushi/tagbar', { 'for': 'cpp' }
Plug 'majutsushi/tagbar'
Plug 'vim-airline/vim-airline'
Plug '~/.vim/bundle/highlight'
Plug 'ntpeters/vim-better-whitespace'
" Plug 'metakirby5/codi.vim'
"show header file for cpp
Plug 'derekwyatt/vim-fswitch'
Plug 'airblade/vim-gitgutter'
Plug 'tpope/vim-sleuth'
"git pull --recurse-submodules
Plug 'Valloric/YouCompleteMe', { 'for': ['cpp','python','javascript'], 'do': './install.py --clang-completer --system-libclang --ts-completer' }
" Plug 'dense-analysis/ale'
Plug 'm-pilia/vim-ccls'
" Plug 'Valloric/YouCompleteMe', { 'for': 'cpp', 'do': './install.py --clang-completer' }
" Plug 'tpope/vim-fugitive', { 'on': 'Gdiff' }
" Plug 'tommcdo/vim-fugitive-blame-ext', { 'on': 'Gdiff' }
Plug 'tpope/vim-fugitive'
Plug 'tommcdo/vim-fugitive-blame-ext'
Plug 'terryma/vim-multiple-cursors'
" Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'tommcdo/vim-exchange'
Plug 'tpope/vim-abolish'
Plug 'skywind3000/asyncrun.vim'
Plug 'ramele/agrep', { 'on': 'Agrep' }
" Plug 'rdnetto/YCM-Generator', { 'for': 'cpp' }
Plug 'wellle/targets.vim'
Plug 'junegunn/vim-easy-align'
" Plug 'rhysd/clever-f.vim'
Plug 'tpope/vim-surround'
" jump between if else as if { } do I use it?
" Plug 'adelarsq/vim-matchit'
Plug 'dyng/ctrlsf.vim', { 'on': 'CtrlSF' }
Plug 'brooth/far.vim', { 'on': 'Far' }
Plug 'will133/vim-dirdiff', { 'on': 'DirDiff' }
Plug 'mh21/errormarker.vim'
Plug 'wincent/ferret'
Plug 'prabirshrestha/async.vim'
Plug 'osyo-manga/vim-over'
Plug 'jiangmiao/auto-pairs'
Plug 'jremmen/vim-ripgrep'
Plug 'skywind3000/quickmenu.vim'
Plug 'cohama/agit.vim', { 'on': 'Agit' }
Plug '~/.vim/bundle/startupFn'
Plug 'vim-airline/vim-airline-themes'
Plug '~/.vim/bundle/nuake'
" Plug 'Lenovsky/nuake'
" move selected line up/down
Plug 'zirrostig/vim-schlepp'
" do in selection B or search S
Plug 'vim-scripts/vis'
"https://github.com/t9md/vim-textmanip maybe better moving of blocks with insert/replace
" Plug 'conweller/findr.vim'
" Plug 'rbong/vim-flog'
Plug 'lambdalisue/gina.vim'
" Plug 'ggVGc/fzf_browser'
Plug '~/.vim/bundle/fzf_browser'
Plug 'yssl/QFEnter'
call plug#end()
set rtp+=~/.vim/bundle/fzf_browser
""" JUPYTER """
" autocmd FileType julia,python call jupyter#MakeStandardCommands()
set pyxversion=3
let g:csPath=""
let g:ycm_auto_hover=''
" let g:ale_statusline_format = ['☀️️ %d', '🕯️ %d', '']
" let b:ale_fixers = {'javascript': ['prettier', 'eslint']}
let g:quickr_cscope_autoload_db = 0
let g:quickr_cscope_keymaps = 0
autocmd FileType javascript nmap <buffer> <C-]> :YcmCompleter GoTo<CR>
"allows Highlight plugin to save conf
"set viminfo^=!
" % - restores buffers between sessions
"set viminfo=!,%,<800,'10,/50,:100,h,f0,n~/.vim/cache/.viminfo
if !has('nvim')
set viminfo=!,<800,'10,/50,:100,h,f0,n~/.vim/cache/.viminfo
elseif has('nvim')
set viminfo=!,<800,'10,/50,:100,h,f0,n~/.config/nvim/cache/.viminfo
endif
" autocmd TextYankPost * if v:event.operator is 'y' && v:event.regname is '' | OSCYankReg " | endif
vnoremap <silent> <leader>y :OSCYank<CR>
"""
"you are here setup
nnoremap <silent> <leader>here :call you_are_here#YouAreHere()<CR>
" top, right, bottom, left border in popups
let g:youarehere_border = [1, 1, 1, 1]
"
" " top, right, bottom, left padding in popups
let g:youarehere_padding = [1, 1, 1, 1]
"
"" g:content is passed to expand to render the filename.
"" see :help expand for more options
let g:content = "%"
"""
"data for plugin quickMenu
" call g:quickmenu#append('LspHover', 'LspHover', '')
" call g:quickmenu#append('LspCCaller', 'LspCqueryCallers', '')
" call g:quickmenu#append('LspDef', 'LspDefinition', '')
" call g:quickmenu#append('LspDiag', 'LspDocumentDiagnostics', '')
" call g:quickmenu#append('LangSMenu', 'call LanguageClient_contextMenu()', '')
" call g:quickmenu#append('LangSHover', 'call LanguageClient#textDocument_hover()', '')
" call g:quickmenu#append('LangSImpl', 'call LanguageClient#textDocument_implementation()', '')
" call g:quickmenu#append('LangSRefs', 'call LanguageClient#textDocument_references()', '')
" call g:quickmenu#append('LangSTypeDef', 'call LanguageClient#textDocument_typeDefinition()', '')
" call g:quickmenu#append('LangSDef', 'call LanguageClient#textDocument_definition()', '')
" call g:quickmenu#append('LangSCaller', "call LanguageClient#findLocations({'method':'$ccls/call'})", '')
" call g:quickmenu#append('TraceHide', 'call TraceHide("SIP\ Signalling\\|Conversation*\\|CallView*")', '')
""" LSP CONFIG
"
function! EnsureDirExists (dir)
if !isdirectory(a:dir)
if exists("*mkdir")
call mkdir(a:dir,'p')
echo "Created directory: " . a:dir
else
echo "Please create directory: " . a:dir
endif
endif
endfunction
if ( g:lsp_cl == "neocl" )
let g:execMenu = {
\ "LangServer Menu": "call LanguageClient_contextMenu()",
\ "LangServer Hover": "call LanguageClient#textDocument_hover()",
\ "LangServer Implementation": "call LanguageClient#textDocument_implementation()",
\ "LangServer References": "call LanguageClient#textDocument_references()",
\ "LangServer TypeDef": "call LanguageClient#textDocument_typeDefinition()",
\ "LangServer Definition": "call LanguageClient#textDocument_definition()",
\ "TraceHide": "call TraceHide('SIP\ Signalling\\|Conversation*\\|CallView*')",
\ "LangServer Caller": "call LanguageClient#findLocations({\'method\':\'$ccls/call\'})",
\ "Cscope callers": "call CScopeExec(\"c\")",
\ "Cscope ref1": "call CScopeExec(\"e\")",
\ "Cscope ref2": "call CScopeExec(\"t\")",
\ "Cscope decl": "call CScopeExec(\"s\")",
\}
let g:LanguageClient_diagnosticsEnable=0
let g:LanguageClient_selectionUI="quickfix"
let g:LanguageClient_loadSettings = 1 " Use an absolute configuration path if you want system-wide settings
" let g:LanguageClient_settingsPath = '/home/YOUR_USERNAME/.config/nvim/settings.json'
" https://github.com/autozimu/LanguageClient-neovim/issues/379 LSP snippet is not supported
let g:LanguageClient_hasSnippetSupport = 0
let g:LanguageClient_hoverPreview="Always"
if ( g:user_name == "pc" )
call EnsureDirExists("/home/pc/tools/cclsCache/")
let g:LanguageClient_serverCommands = {
\ 'cpp': ['ccls', '-init={"compilationDatabaseCommand":"","compilationDatabaseDirectory":"","cache":{"directory":"/home/pc/tools/cclsCache/"}}', '--log-file=/tmp/ccls.log' ]
\ }
else
call EnsureDirExists("/home/km000057/HD0/tools/ccls2/vimcache/")
let g:LanguageClient_serverCommands = {
\ 'cpp': ['ccls', '-init={"compilationDatabaseCommand":"","compilationDatabaseDirectory":"","cache":{"directory":"/home/km000057/HD0/tools/ccls2/vimcache/"}}', '--log-file=/tmp/ccls.log' ]
\ }
endif
else
let g:execMenu = {
\ "Lsp References": "LspReferences",
\ "Lsp Declaration": "LspDeclaration",
\ "Lsp Definition": "LspDefinition",
\ "Lsp PeekDef": "LspPeekDefinition",
\ "Lsp PeekDeclar": "LspPeekDeclaration",
\ "TraceHide": "call TraceHide('SIP\ Signalling\\|Conversation*\\|CallView*')",
\ "Cscope callers": "call CScopeExec(\"c\")",
\ "Cscope ref1": "call CScopeExec(\"e\")",
\ "Cscope ref2": "call CScopeExec(\"t\")",
\ "Cscope decl": "call CScopeExec(\"s\")",
\ "Lsp Hover": "LspHover",
\}
function! s:on_lsp_buffer_enabled() abort
" setlocal omnifunc=lsp#complete
" setlocal signcolumn=yes
" if exists('+tagfunc') | setlocal tagfunc=lsp#tagfunc | endif
" nmap <buffer> gd <plug>(lsp-definition)
" nmap <buffer> gs <plug>(lsp-document-symbol-search)
" nmap <buffer> gS <plug>(lsp-workspace-symbol-search)
" nmap <buffer> gr <plug>(lsp-references)
" nmap <buffer> gi <plug>(lsp-implementation)
" nmap <buffer> gt <plug>(lsp-type-definition)
" nmap <buffer> <leader>rn <plug>(lsp-rename)
" nmap <buffer> [g <plug>(lsp-previous-diagnostic)
" nmap <buffer> ]g <plug>(lsp-next-diagnostic)
" nmap <buffer> K <plug>(lsp-hover)
" inoremap <buffer> <expr><c-f> lsp#scroll(+4)
" inoremap <buffer> <expr><c-d> lsp#scroll(-4)
let g:lsp_fold_enabled = 0
let g:lsp_document_highlight_enabled = 0
let g:lsp_diagnostics_enabled = 0
let g:lsp_format_sync_timeout = 200
" autocmd! BufWritePre *.rs,*.go call execute('LspDocumentFormatSync')
" refer to doc to add more commands
endfunction
let g:lsp_fold_enabled = 0
let g:lsp_document_highlight_enabled = 0
let g:lsp_diagnostics_enabled = 0
let g:lsp_format_sync_timeout = 200
if ( g:user_name == "pc" )
call EnsureDirExists("/home/pc/tools/cclsCache2")
if executable('ccls')
au User lsp_setup call lsp#register_server({
\ 'name': 'ccls',
\ 'cmd': {server_info->['ccls']},
\ 'root_uri': {server_info->lsp#utils#path_to_uri(lsp#utils#find_nearest_parent_file_directory(lsp#utils#get_buffer_path(), 'compile_commands.json'))},
\ 'initialization_options': { 'cache': {'directory': '/home/pc/tools/cclsCache2' }},
\ 'whitelist': ['c', 'cpp', 'objc', 'objcpp', 'cc'],
\ 'allowlist': ['c', 'cpp', 'objc', 'objcpp', 'cc'],
\ })
endif
else
call EnsureDirExists("/home/km000057/tools/ccls/Release/cacheVimLsp")
if executable('ccls')
au User lsp_setup call lsp#register_server({
\ 'name': 'ccls',
\ 'cmd': {server_info->['ccls']},
\ 'root_uri': {server_info->lsp#utils#path_to_uri(lsp#utils#find_nearest_parent_file_directory(lsp#utils#get_buffer_path(), 'compile_commands.json'))},
\ 'initialization_options': { 'cache': {'directory': '/home/km000057/tools/ccls/Release/cacheVimLsp' }},
\ 'whitelist': ['c', 'cpp', 'objc', 'objcpp', 'cc'],
\ 'allowlist': ['c', 'cpp', 'objc', 'objcpp', 'cc'],
\ })
endif
endif
endif
" if executable('cquery')
" au User lsp_setup call lsp#register_server({
" \ 'name': 'cquery',
" \ 'cmd': {server_info->['cquery']},
" \ 'root_uri': {server_info->lsp#utils#path_to_uri(lsp#utils#find_nearest_parent_file_directory(lsp#utils#get_buffer_path(), 'compile_commands.json'))},
" \ 'initialization_options': { 'cacheDirectory': '/home/km000057/tools/cquery/build/release/cache' },
" \ 'whitelist': ['c', 'cpp', 'objc', 'objcpp', 'cc'],
" \ })
" endif
function ShowExecMenu()
call fzf#run({'source':keys(g:execMenu), 'down': '30%', 'sink': function('ExecMenuSelection'), 'options':['--no-sort']})
endfunction
function ExecMenuSelection(expr)
execute g:execMenu[a:expr]
endfunction
function! CScopeExec(method)
echom "PATH>" . g:csPath . "<>" . " " . empty(g:csPath) . "<"
if empty(g:csPath)
echom "cscope not configured with path"
return
endif
echom "got input " . a:method
let l:searchTerm = expand("<cword>")
echom "got searchterm " . l:searchTerm
execute "cscope find " . a:method . " " . l:searchTerm
endfunction
"missing
"call LanguageClient#findLocations({'method':'$ccls/call-hierarchy'})<cr>
"language server options
"nn <silent> xb :call LanguageClient#findLocations({'method':'$ccls/inheritance'})<cr>
" bases of up to 3 levels
" nn <silent> xB :call LanguageClient#findLocations({'method':'$ccls/inheritance','levels':3})<cr>
" " derived
" nn <silent> xd :call LanguageClient#findLocations({'method':'$ccls/inheritance','derived':v:true})<cr>
" " derived of up to 3 levels
" nn <silent> xD :call LanguageClient#findLocations({'method':'$ccls/inheritance','derived':v:true,'levels':3})<cr>
"
" " caller
" nn <silent> xc :call LanguageClient#findLocations({'method':'$ccls/call'})<cr>
" " callee
" nn <silent> xC :call LanguageClient#findLocations({'method':'$ccls/call','callee':v:true})<cr>
"
" " $ccls/member
" " nested classes / types in a namespace
" nn <silent> xs :call LanguageClient#findLocations({'method':'$ccls/member','kind':2})<cr>
" " member functions / functions in a namespace
" nn <silent> xf :call LanguageClient#findLocations({'method':'$ccls/member','kind':3})<cr>
" " member variables / variables in a namespace
" nn <silent> xm :call LanguageClient#findLocations({'method':'$ccls/member'})<cr>
"allow you to move freely in visual block mode
set virtualedit=block
" {{{
" makes * and # work on visual mode too.
function! s:VSetSearch(cmdtype)
let temp = @s
norm! gv"sy
let @/ = '\V' . substitute(escape(@s, a:cmdtype.'\'), '\n', '\\n', 'g')
" Use this line instead of the above to match matches spanning across lines
"let @/ = '\V' . substitute(escape(@s, a:cmdtype.'\'), '\_s\+', '\\_s\\+', 'g')
let @s = temp
endfunction
xnoremap * :<C-u>call <SID>VSetSearch('/')<CR>/<C-R>=@/<CR><CR>
xnoremap # :<C-u>call <SID>VSetSearch('?')<CR>?<C-R>=@/<CR><CR>
"}}}
" yankring turn off default setup
let g:yankring_paste_v_bkey = ''
let g:yankring_paste_v_akey = ''
let g:yankring_paste_n_bkey = ''
let g:yankring_paste_n_akey = ''
let g:yankring_paste_v_key = ''
let g:yankring_manage_numbered_reg = 0
let g:yankring_clipboard_monitor = 0
let g:yankring_paste_check_default_buffer = 0
let g:yankring_zap_keys = ''
"##########################
" Join lines and keep the cursor in place
" nnoremap J mzJ`z
" Split line (opposite to join lines)
nnoremap M :call <SID>split_line()<CR>
function s:split_line()
" Do a split
exe "normal! i\<CR>\<ESC>"
" Remember position and last search expression
normal! mw
let _s = @/
" Remove any trailing whitespace characters from the line above
silent! -1 s/\v +$//
" Restore last search expression
nohlsearch
let @/ = _s
" Restore cursor position
normal! `w
endfunction
"##########################
" Center search results
nnoremap n nzvzz
nnoremap N Nzvzz
nnoremap * *zvzz
nnoremap # #zvzz
"##########################
" Normalize Y behavior to yank till the end of line
nnoremap Y y$
"##############
"auto select visual block after indenting
vnoremap < <gv
vnoremap > >gv
vnoremap <Tab> >gv
vnoremap <S-Tab> <LT>gv
nnoremap <Tab> >>
nnoremap <S-Tab> <LT><LT>
inoremap <S-Tab> <C-O><LT><LT>
"##########################
" Open diffs in vertical splits
" Use 'xdiff' library options: patience algorithm with indent-heuristics (same to Git options)
" NOTE: vim uses the external diff utility which doesn't do word diffs nor can it find moved-and-modified lines.
" See: https://stackoverflow.com/questions/36519864/the-way-to-improve-vimdiff-similarity-searching-mechanism
" set diffopt=internal,filler,vertical,context:5,foldcolumn:1,indent-heuristic,algorithm:patience
" set diffopt=internal,filler,vertical,context:5,foldcolumn:1
"##########################
" Timeout settings
" Wait forever until I recall mapping
" Don't wait to much for keycodes send by terminal, so there's no delay on <ESC>
set notimeout
set ttimeout
set timeoutlen=2000
set ttimeoutlen=30
set backspace=indent,eol,start
"##########################
" autopair - do not jump do end pair
let g:AutoPairsMultilineClose=0
"##########################
" allow <C-a> increment numbres and letters
set nrformats+=alpha
let g:rainbow_active = 1
"colorscheme desert
colorscheme molokai
" fix molokai cursor disapearing on matching parenthesis
"beforehi MatchParen ctermfg=cyan ctermbg=208 cterm=bold
"fixhi MatchParen ctermfg=208 ctermbg=233 cterm=bold
"needs to be at the end of file to take effect
syntax on
"TODO REMOVE REMOVE JUST DEBUG
" let g:ycm_server_use_vim_stdout = 1
" let g:ycm_server_log_level = 'debug'
" show the editing mode on the last line
set showmode
"set statusline+=%F
"##########################
" tell vim to keep a backup file
set backup
"mkdir ~/.vim/.backup ~/.vim/.swp ~/.vim/.undo
"settings for sessions
set ssop-=options " do not store global and local values in a session
set ssop-=folds " do not store folds"
let g:session_directory = "~/.vim/tmp/session" " the directory must be created before the sessions will be saved there
let g:session_autoload = "no" " automatic reload sessions
let g:session_autosave = "no" " autosave
let g:session_command_aliases = 1
let g:gundo_prefer_python3=1
let g:DirDiffIgnore=".git,*.d,*.o"
let g:DirDiffExcludes=".git,*.d,*.o"
set backupdir=~/.vim/.backup/
set directory=~/.vim/.swp/
set undofile
set undodir=~/.vim/.undo
set undolevels=500
set undoreload=500
"##########################
set display=lastline
" \ 'cpp': ['ccls', --log-file=/tmp/cc.log --init={'initialization_options': { 'cache': {'directory': '/home/km000057/tools/ccls/Release/cache' }}}'],
" sneak config
let g:sneak#label = 1
"##########################
" codequery db
let g:my_db_path="~/GIT/mainline/"
"orig let g:my_db_path="~/bin/"
" usage :CodeQuery 'opton from list' word under cursor
" similar to \s with cscope
"
"##########################
" rules for loading tags
let g:currentTagFilePath=""
let g:lspLoaded=""
" autocmd BufReadPost,BufWinEnter *.cpp :call LoadTags()
autocmd BufWinEnter *.cpp :call LoadTags()
function! LoadTags()
let l:path = expand('%:p:h')
let l:path = substitute(l:path,'vobs.*','','')
if (g:currentTagFilePath != l:path )
let g:currentTagFilePath = l:path
call SetTags(l:path)
endif
" if (g:lspLoaded == "")
" let g:lspLoaded = "true"
" call lsp#enable()
" endif
" exec LanguageClientStart"
endfunction
function! LoadTagsFile(path)
let l:path = a:path
if (g:currentTagFilePath != l:path )
let g:currentTagFilePath = l:path
call SetTags(l:path)
endif
" if (g:lspLoaded == "")
" let g:lspLoaded = "true"
" call lsp#enable()
" endif
" exec LanguageClientStart"
endfunction
"################################################
" YouCompleteMe setup
let g:ycm_auto_hover=""
let g:ycm_min_num_of_chars_for_completion = 2
let g:ycm_auto_trigger = 1
let g:ycm_collect_identifiers_from_tags_files = 0
let g:ycm_seed_identifiers_with_syntax = 1 " Completion for programming language's keyword
let g:ycm_complete_in_comments = 1 " Completion in comments
" let g:ycm_complete_in_strings = 1 " Completion in string
let g:ycm_add_preview_to_completeopt = 1
"let g:ycm_global_ycm_extra_conf = '~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'
let g:ycm_global_ycm_extra_conf = '~/.vim/bundle/.ycm_extra_conf.py'
let g:ycm_confirm_extra_conf = 0
let g:ycm_key_list_select_completion = ['<TAB>','<Down>']
let g:ycm_key_list_previous_completion=['<Up>']
let g:ycm_autoclose_preview_window_after_insertion = 1
let g:ycm_autoclose_preview_window_after_completion = 0
"turn off YMC
"nnoremap <leader>y :let g:ycm_auto_trigger=0<CR> " turn off YCM
"nnoremap <leader>Y :let g:ycm_auto_trigger=1<CR> "turn on YCM
" turn off syntax checking
" change
" let g:ycm_show_diagnostics_ui = 1
"################################################
set completeopt=menu,menuone,preview,noselect,noinsert
"" SNIPETS
nnoremap ,hfor :-1read $HOME/.vim/bundle/after/snippets/for.txt<CR>f(a
"##########################################
let g:notes_directories = ['~/doc/vimNotes', '~/doc/vimNotes']
let g:hopping#keymapping = {
\ "\<C-n>" : "<Over>(hopping-next)",
\ "\<C-p>" : "<Over>(hopping-prev)",
\ "\<C-u>" : "<Over>(scroll-u)",
\ "\<C-d>" : "<Over>(scroll-d)",
\}
" clever f config
let g:clever_f_smart_case = 1
let g:clever_f_show_prompt = 1
" Use same highlighting group as a normal search
" let g:clever_f_mark_char_color = 'IncSearch'
set backspace=indent,eol,start
set autoindent
" highlight matching search strings
set hlsearch
" make searches case insensitive
set ignorecase
"set statusline+=%#warningmsg#
"set statusline+=%{SyntasticStatuslineFlag()}
"set statusline+=%*
set showmatch
" FOR SPACETABS
set expandtab
set shiftwidth=2
set softtabstop=2
"FOR HARD TABS
"set shiftwidth=2
"set tabstop=2
if has("unix")
" set guifont=Monospace\ 13
set guifont=Ubuntu\ Mono\ 12
else
set guifont=Lucida_Console:h12:b:cANSI:qDRAFT
endif
set wildmode=longest,list,full
set wildmenu
set path+=/home/km000057/doc/**,/home/km000057/GIT/mainline/vobs/Opera_Infrastructure_Services/Media/**,/home/km000057/GIT/mainline/vobs/Opera_Platform_Linux/GPAL/GPALMedia/**,/home/km000057/_DWE_/**,/home/km000057/GIT/mainline/vobs/Opera_Infrastructure_Services/Media/Interface/**,/home/km000057/GIT/mainline/vobs/Opera_Infrastructure_Services/Media/VoiceEngine/**,**
set scrolloff=4
set hidden
set copyindent
set smartcase
set smarttab " insert tabs on the start of a line according to shiftwidth, not tabstop
set autochdir
set hlsearch
set incsearch
set splitbelow
set splitright
set switchbuf=useopen,usetab
set encoding=utf-8
set wildignore+=*.d,*.o,*.so,*.img,*.tgz,*.o,*.d,*.patch,*.swp,*.zip
set wildignore+=*.so,*.swp,*.zip,*/node_modules/*,*.keep,*.DS_Store
set guioptions-=T "remove toolbar
set guioptions-=r "remove right-hand scroll bar
set guioptions-=L "remove left-hand scroll bar
set guioptions+=d "dark menu
set guioptions-=m "remove menu
"set guioptions-=m "remove menu bar
set go+=a " visual selection autocopied to clipboard
set clipboard=unnamedplus
let g:yankring_replace_n_pkey = '<C-p>'
let g:yankring_replace_n_nkey = '<C-o>'
let g:ctrlp_map = ''
let g:ctrlp_cmd = 'CtrlP'
noremap <C-o> :YRReplace 1 p<CR>
nnoremap ,p :YRPop<CR>
"map your keys
"noremap <C-a> :CtrlP /home/km000057/GIT/mainline/vobs/Opera_Infrastructure_Services/Media/<CR>
" noremap <C-z> :CtrlPBuffer<CR>
noremap <C-z> :Buffers<CR>
" noremap <C-x> :CtrlPMRUFiles<CR>
noremap <C-x> :FZFMru<CR>
"noremap <C-h> :CtrlPBookmarkDir<CR>
"noremap <C-j> :call DmenuOpen("Files")<CR>
" noremap <C-h> :call GetGitFolder("$HOME/GIT/")<CR>
" if has("gui_running")
" noremap <C-h> :call BrowseFolderGui("$HOME/GIT/")<CR>
" " noremap <C-j> :call BrowseFolderGui(expand('%:p:h'))<CR>
" else
" noremap <C-h> :call BrowseFolder("$HOME/GIT")<CR>
" " noremap <C-j> :call BrowseFolder(expand('%:p:h'))<CR>
" endif
" noremap <C-j> :call GetLastGitFiles()<CR>
let g:defaultTraceText = "printf"
" let g:traceText = "OPERA_ERROR"
noremap <C-l> :call InsertMethodTrace("int")<CR>
vnoremap <C-l> :call InsertMethodTracev("")<CR>
" noremap <C-P> :call InsertMethodTrace("none")<CR>
nnoremap <silent> ,l :call InsertMethodTrace("str")<CR>
nnoremap <silent> ,; :call InsertMethodTrace("none")<CR>
"lock screen
nnoremap <silent> ,ls :call LockScreen()<CR>
nnoremap <silent> ,lsx :call LockScreenx()<CR>
" noremap <C-f> :Files ~/phones_GIT/vobs/<CR>
let g:CommandTFileScanner="find"
"show class details
"open window
let g:asyncrun_open = 9
" nmap <F7> :QFix<CR>
"show header file
":AsyncRun buildParse.sh mainline 34 sip 1
" nmap <F2> :AsyncRun buildParse.sh mainline 34 sip 1 %:p:h<CR>:copen 9<CR>
" nmap <F2> :AsyncRun buildParse.sh mainline 34 sip 1 %:p:h<CR>:wincmd w<CR>
" nmap <F1> :AsyncRun uploadFw.py mainline 120 121
nmap <F1> :call UploadLoadware()<CR>
nmap <F2> :call BuildBind("")<CR>
nmap <F3> :VOBROOT=~/main2/ ~/main2/vobs/Opera_DevTools/scripts/build_and_test_WE3_4_x86.sh
nmap <F4> :AirlineToggleWhitespace<CR>
nmap <F5> :FSSplitLeft<CR>
" nmap <F6> :NERDTreeToggle<CR>
nmap <F6> :Clap yanks<CR>
nmap <F7> :call asyncrun#quickfix_toggle(9)<CR>
nmap <F8> :TagbarToggle<CR>
" nmap <F9> :MundoToggle<CR>
if ( g:lsp_cl == "neocl")
nmap <F9> :call LanguageClient#textDocument_hover()<CR>
nnoremap <silent>,hh :call LanguageClient#textDocument_hover()<CR>
nnoremap <silent>,rr :call LanguageClient#textDocument_references()<CR>
else
nmap <F9> :LspHover<CR>
nnoremap <silent>,hh :LspHover<CR>
nnoremap <silent>,rr :LspReferences<CR>
endif
nnoremap <silent>,bb :call FuzzyBrowse()<CR>
nmap <silent>,hj <plug>(YCMHover)
nmap <F10> :YRShow<CR>
nnoremap <silent> ,yy :Clap yanks<CR>
" noremap <silent><F11> :call quickmenu#toggle(0)<cr>
noremap <silent><F11> :call ShowExecMenu()<cr>
nnoremap <silent>,mm :call ShowExecMenu()<cr>
nnoremap <silent>,em :call ShowExecMenu()<cr>
nnoremap <silent>,me :call ShowExecMenu()<cr>
nnoremap <F12> :Nuake<CR>
inoremap <F12> <C-\><C-n>:Nuake<CR>
tnoremap <F12> <C-\><C-n>:Nuake<CR>
nnoremap <silent> ,tt :Nuake<CR>
nnoremap <silent> ,y :Clap yanks<CR>
nnoremap <silent> ,,y :YRShow<CR>
nnoremap gp `[v`]
" nmap ,rr :AsyncRun buildParse.sh mainline 34 sip 1 %:p:h<CR>:copen 10<CR>
" nmap ,ll :let g:phones="121 122 123" \| let g:branch="mainline"
"nmap <F2> :AsyncRun uploadFw.py mainline 121 122 123<CR>4copen<CR>
"nmap <F9> :match Error /\s\+$/<CR>
" bubble up/down current line
" nmap <C-Up> [e
" nmap <C-Down> ]e
" " bubble selected lines
" vmap <C-Up> [egv
" vmap <C-Down> ]egv
"
" move line good
nnoremap <C-Down> :m .+1<CR>==
nnoremap <C-Up> :m .-2<CR>==
inoremap <C-Down> <Esc>:m .+1<CR>==gi
inoremap <C-Up> <Esc>:m .-2<CR>==gi
" vnoremap <C-Down> :m '>+1<CR>gv=gv
" vnoremap <C-Up> :m '<-2<CR>gv=gv
vmap <C-Up> <Plug>SchleppUp
vmap <C-Down> <Plug>SchleppDown
vmap <C-Left> <Plug>SchleppLeft
vmap <C-Right> <Plug>SchleppRight
"switch windows
nnoremap <A-Left> <C-w>h
nnoremap <A-Right> <C-w>l
nnoremap <A-Up> <C-w>k
nnoremap <A-Down> <C-w>j
" nnoremap <C-PageUp> gt
" nnoremap <C-PageUp> gT
nnoremap <C-PageDown> :bn<CR>
nnoremap <C-PageUp> :bp<CR>
" new window
nnoremap <silent> ,nn :enew<CR>
nnoremap <silent> ,ne :enew<CR>
" rename files from quicfix window
nnoremap <silent> ,qr :call QfToRename()<CR>
nnoremap <silent> ,qf :call QFFilter("")
function! QFFilter(args) abort
if &filetype !=# 'qf'
echom " not a qf window"
copen
endif
let args = split(a:args, ' ')
if len(args) > 1
let query = args[1]
let reverse_filter = 1
else
let query = args[0]
let reverse_filter = 0
endif
echom query
let results = getqflist()
for d in results
if reverse_filter
if bufname(d['bufnr']) =~ query || d['text'] =~ query
call remove(results, index(results, d))
endif
else
if bufname(d['bufnr']) !~ query && d['text'] !~ query
call remove(results, index(results, d))
endif
endif
endfor
call setqflist(results)
call QFPrettify(results)
endfunction
function QFPrettify(results) abort
" unlock qf to make changes
setlocal modifiable
setlocal nolist
setlocal nowrap
" delete all the text in qf
silent %delete
" insert new text with pretty layout
let max_fn_len = 0
let max_lnum_len = 0
for d in a:results
let d['filename'] = bufname(d['bufnr'])
let max_fn_len = max([max_fn_len, len(d['filename'])])
let max_lnum_len = max([max_lnum_len, len(d['lnum'])])
endfor
let reasonable_max_len = 60
let max_fn_len = min([max_fn_len, reasonable_max_len])
let qf_format = '"%-' . max_fn_len . 'S | %' . max_lnum_len . 'S | %s"'
let evaluating_str = 'printf(' . qf_format .
\ ', v:val["filename"], v:val["lnum"], v:val["text"])'
call append('0', map(a:results, evaluating_str))
" delete empty line
global/^$/delete
" put the cursor back
normal! gg
" lock qf again
setlocal nomodifiable
setlocal nomodified
endfunction
" nnoremap <silent> ,lh call LanguageClient#findLocations({'method':'$ccls/call'})<CR>
noremap <silent> ,cx :call DoToggleComment()<CR>
noremap <silent> ,cv :call UnToggleComment()<CR>
" :c-r c-w = paste
nnoremap <silent> ,rb :call ReplaceBuffers("n")<CR>
vnoremap <silent> ,rb :call ReplaceBuffers("v")<CR>
nnoremap <silent> ,rp :call ReplacePath("n")<CR>
vnoremap <silent> ,rp :call ReplacePath("v")<CR>
nnoremap <silent> ,sb :call SearchBuffers("n")<CR>
vnoremap <silent> ,sb :call SearchBuffers("v")<CR>
nnoremap <silent> ,sp :call SearchPath("n")<CR>
vnoremap <silent> ,sp :call SearchPath("v")<CR>
" noremap <silent> ,br :call BufferReplace()<CR>
" noremap <silent> ,bb :call GrepBuffers()<CR>
" noremap <silent> ,fr :call FolderReplace()<CR>
" noremap <silent> ,fg :call FolderGrep()<CR>
" noremap <silent> ,cc :<C-B>silent <C-E>s/^/<C-R>=escape(b:comment_leader,'\/')<CR>/<CR>:nohlsearch<CR>
" noremap <silent> ,cu :<C-B>silent <C-E>s/^\V<C-R>=escape(b:comment_leader,'\/')<CR>//e<CR>:nohlsearch<CR>
" pre enter search and replace string
nnoremap <C-k> :call SearchAndReplace()<CR>
vnoremap <C-k> :call SearchAndReplacev()<CR>
augroup syntax_hghl
autocmd Syntax * syn match Error /\s\+$/
autocmd Syntax * syn match TabWhitespace /[\t]/
autocmd Syntax * syn match DoubleSpaceAfterPeriod /\. /" open gvim open file window
augroup END
let &errorformat="%f:%l:%c: %t%*[^:]:%m,%f:%l: %t%*[^:]:%m," . &errorformat
set errorformat-=%f:%l:%m
set errorformat-=%f:%l:\ %t%*[^:]:%m
"v3r5 build message
set errorformat+=%f:%l:\ error:\ %m
let g:asyncrun_auto = "make"
"function GetTagbarMethod()
" let a = tagbar#currenttag('%s','')
" return a
"endfunction
"call airline#parts#define_function('testBar', 'GetTagbarMethod')
let g:tagbar_ctags_bin='ctags'
let g:airline#extensions#tagbar#enabled = 1
let g:asyncrun_status = ''
let g:anyUnsavedBuffer = ''
let g:airline_section_error = airline#section#create_right(['%{g:asyncrun_status}'])
let g:airline_section_error = airline#section#create_right(['%{g:anyUnsavedBuffer}'])
let g:airline_theme='hybrid'
tnoremap <expr> <A-r> '<C-\><C-N>"'.nr2char(getchar()).'pi'
function BuffModified()
let g:anyUnsavedBuffer = join(filter(range(1,bufnr('$')),'getbufvar(v:val,"&modified")'),"_")
endfunction
augroup ModBuffer
autocmd!
autocmd BufLeave,BufWritePost,TextChanged,TextChangedI * execute 'call BuffModified()'
augroup END
"echom getbufvar(1,"")
"https://vim.help/41-write-a-vim-script
" paste in insert mode
" C-r register
" delete in insert mode C-u line C-w word, C-h character
" ga info about characted under cursor
" insert mode C-v {123} insert code of character
"
"cxvw exchange selection word .... another place . to exchange
" open gvim open file window
"noremap <C-o> :breakowse confirm e<CR>
"paste clipboard in insert mode and normal mode
"imap <C-]> <ESC>"+p
"map <C-]> <ESC>"+p
"vnoremap // y/<C-R>"<CR>
"#########################################
"configure plugins
"let g:ctrlp_map = '<c-a>'
"let g:ctrlp_cmd = 'CtrlP /home/martinkolouch/phones_GIT/vobs/Opera_Infrastructure_Services/Media/'
let g:ctrlp_cmd = 'CtrlP'
let g:ctrlp_match_window_reversed=0
let g:ctrlp_custom_ignore = {
\ 'dir': '\v[\/](tmp|node_modules)',
\ 'file': '\v\.(exe|so|dll|o|d)$',
\ }
"search window on top
"let g:ctrlp_match_window_bottom=1
let g:ctrlp_clear_cache_on_exit = 0
let g:ctrlp_by_filename = 1
let g:ctrlp_show_hidden = 1
let g:ctrlp_cache_dir = $HOME . '/.cache/ctrlp'