-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvim-misc.vim
917 lines (799 loc) · 41.9 KB
/
vim-misc.vim
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
" -------- unused plugins -------------------------------------------
" Plug 'Shougo/neocomplete', {'commit': 'd8caad4fc14fc1be5272bf6ebc12048212d67d2c'}
" prev ap/vim-buftabline commit 12f29d2cb11d79c6ef1140a0af527e9231c98f69
Plug 'ap/vim-buftabline', {'commit': '12f29d2cb11d79c6ef1140a0af527e9231c98f69'}
"Plug 'dimxdim/jellybat'
" prev vim-airline/vim-airline commit a914cfb75438c36eefd2d7ee73da5196b0b0c2da
Plug 'vim-airline/vim-airline', {'commit': '72ca1c344fc48f8a5dec7e8c4b75da0436176338'}
" prev vim-airline/vim-airline-themes commit
Plug 'vim-airline/vim-airline-themes', {'commit': '7865fd8ba435edd01ff7b59de06a9be73e01950d'}
" " Alternative to bufferline mgee/lightline-bufferline, for use with
" lightline
" " Plug 'taohex/lightline-buffer'
" Plug 'flazz/vim-colorschemes'
" Plug 'NLKNguyen/papercolor-theme'
" Needs lua53.dll from http://lua-users.org/wiki/LuaBinaries (64bit like my vim) in the same dir as gvim.exe
" alternative source for lua binaries, mentioned on github vim distribution:
" http://luabinaries.sourceforge.net/download.html
" (also according to shougo/denite python can also be added this way from
" official site -> choose python embeddable and copy all zip contents to vim's
" install dir)
Plug 'Shougo/neocomplete', {'commit': 'd8caad4fc14fc1be5272bf6ebc12048212d67d2c'}
" ------------------------------------------------------------
" set lazyredraw
" May help with scrolling, may worsen flicker of completion popup menu
" Also may cause glitch with ycm when typing very fast, where ycm will display
" identifier (words from file) suggestions, but as if 2 last letters were not
" typed. Example: set lazyredraw and type very fast "w e r e r" (without
" spaces), then ^w until " incorrect suggestion appears.
" Setting power options to "Power saver mode" in Windows helps expose the bug.
" Also check:http://eduncan911.com/software/fix-slow-scrolling-in-vim-and-neovim.html
" set lazyredraw
" ------------------------------------------------------------------------------
" TODO migrate to pathogen and version control using git ("git submodule add" etc)
" iff there is a way in pathogen to ensure the plugin loading order (maybe
" prepend plugin dirs with numbers like 01_vim_airline/ etc and then clone
" into them and check the order in runtimepath).
" ------------------------------------------------------------------------------
" Version-controlled installation of vim-plug, that will be self-updatable
" manually later. On windows console:
" cd %USERPROFILE%
" mkdir .vim\autoload .vim\plugged
" put the following file into .vim/autoload (linebreakes will be unix-
" style, does it matter?)
" https://github.com/junegunn/vim-plug/raw/449b4f1ed6084f81a1d0c2c1136cd242ec938625/plug.vim
" (commit at SHA 449b4f1ed6084f81a1d0c2c1136cd242ec938625)
" Better to git clone, as it will auto-adjust linebreaks to-from win-unix:
" mkdir vim-plug-temp && cd vim-plug-temp
" git clone https://github.com/junegunn/vim-plug.git .\
" git reset --hard 449b4f1ed6084f81a1d0c2c1136cd242ec938625
" copy plug.vim ..\.vim\autoload
" Restart vim and ":PlugInstall youcomplete" first, then ":PlugInstall" for
" the rest of plugins. Done.
" -------------- vim-plug
" the two below are auto-called by vim-plug, leaving here for future reference
syntax enable
filetype plugin indent on
" (a better?) alternative to "syntax on"
if !exists("g:syntax_on")
syntax enable
endif
" source: https://stackoverflow.com/questions/33380451/is-there-a-difference-between-syntax-on-and-syntax-enable-in-vimscript
" current setting after plug#end:
syntax on " syntax enable syntax processing, *syntax on* overrides with defaults!
" ------------------------------------------------------------------------------
" vimproc build/install instructions
" On win10 to install win 7.1 sdk:
" https://stackoverflow.com/questions/32091593/cannot-install-windows-sdk-7-1-on-windows-10
" 7.1 sdk is needed for win32.mak file, see:
" https://github.com/Shougo/vimproc.vim/issues/58
" To build to go Start->Visual Studio->x64 native tools command prompt
" so that it includes all the needed paths. For win32.mak to be found:
" $ SET INCLUDE=%INCLUDE%;C:\Program Files\Microsoft SDKs\Windows\v7.1\Include
" (on 64bit) C:\Program Files\Microsoft SDKs\Windows\v7.1\Include
" $ nmake -f make_msvc.mak nodebug=1
" To check whether its working :echo vimproc#system('dir')
" ------------------------------------------------------------------------------
" YouCompleteMe should be updated on its own (so that it does not timeout) using:
" :PlugUpdate YouCompleteMe
" Neovim: check with :CheckHealth if python3 provider is correct.
" also check :messages to see whether ycm complains
" ycm -> was installed by .\install.py --clang-completer --js-completer
" Plug 'Valloric/YouCompleteMe', {'commit': 'bade99f5e9c5ba2f848cffb2d1a905e85d3ddb05'}
" ------------------------------------------------------------------------------
" gvimfullscreen_win32: uses dll, needs to be mapped like:
if has('win64')
nnoremap <F11> <Esc>:call libcallnr(expand('$HOME\.vim\plugged\gvimfullscreen_win32\gvimfullscreen_64.dll'), "ToggleFullScreen", 0)<CR>
elseif has('win32')
nnoremap <F11> <Esc>:call libcallnr(expand('$HOME\.vim\plugged\gvimfullscreen_win32\gvimfullscreen.dll'), "ToggleFullScreen", 0)<CR>
endif
" " Also fullscreen functionality (vim-shell + vim-misc, should work on unix too):
" vim-misc is required by vim-shell
" Plug 'xolox/vim-misc', {'commit': '3e6b8fb6f03f13434543ce1f5d24f6a5d3f34f0b'}
" vim-shell, to be used for :Fullscreen command etc
" Plug 'xolox/vim-shell', {'commit': 'c19945c6cb08db8d17b4815239e2e7e0051fb33c'}
" ------------------------------------------------------------------------------
" tern-js for javascript (unneeded with ycm, as ycm already includes it?)
" Plug 'ternjs/tern_for_vim', {'commit': 'ae42c69ada7243fe4801fce3b916bbc2f40ac4ac'}
" javacomplete2
" Plug 'artur-shaik/vim-javacomplete2', {'commit': 'ae351ecf333e77873fa4682b4d4b05f077047bc4'}
" ------------------------------------------------------------------------------
" for powerline
" set runtimepath+=$HOME/.vim/plugged/powerline/powerline/bindings/vim
" ------------------------------------------------------------------------------
" TODO investigate eclim integration with airline bug:
" when error occurs it is not shown in airline upon save, but upon next
" modification after save. Also goes away (after error is fixed) not upon
" saving but after saving and modifying.
" ------------------------------------------------------------------------------
" directx renderer will also render font shapes differently.
" to test, :h airline, start changing rop, check "i" shapes, some may render the dot too close, some "l" may be rendered as |.
" also, may affect performance (slower scrolling),
" try adding more than directx if rendering is ugly - in my w10_x64 made no difference
" set rop=type:directx,gamma:1.0,contrast:0.5,level:1,geom:1,renmode:4,taamode:1 -recom. by airline
" set renderoptions=type:directx,level:0.75,gamma:1.25,contrast:0.25,geom:1,renmode:5,taamode:1
" ------------------------------------------------------------------------------
" Old guicursor settings:
"set guicursor=n-v-c:blinkon0-block-Cursor/lCursor,ve:ver35-Cursor,o:hor50-Cursor,i-ci:ver25-Cursor/lCursor,r-cr:hor20-Cursor/lCursor,sm:block-Cursor-blinkwait175-blinkoff150-blinkon175 "dont blink
"let &guicursor = substitute(&guicursor, 'n-v-c:', '&blinkon0-', '')
"set guicursor=
" set lines=999 columns=9999 " open maximized (not always works)
" ------------------------------------------------------------------------------
" Space is the new leader
" another option is "map <Space> <Leader>" but will not trigger double leader
" aka <Leader><Leader> mappings
" let mapleader = "\<Space>" if let mapleader = " " doesnt work
" also if remapped leader is continuously pressed, next leader presses will
" not be triggered until modes are changed (easymotion probably is culprit)
"let mapleader = " "
" ------------------------------------------------------------------------------
" Paste:
" If you visually select something and hit paste
" that thing gets yanked into your buffer. This
" generally is annoying when you're copying one item
" and repeatedly pasting it. This changes the paste
" command in visual mode so that it doesn't overwrite
" whatever is in your paste buffer.
" xnoremap p "_dP doesnt work as expected when pasting upon the last line (when using linewise)
" Solution: since regular p (non-mapped) works as expected, all we need to do
" is just temporarily store what is in the + register, then write it back,
" because it will be replaced by regular p.
" Register "0 stores the value to be pasted even after pasting.
xnoremap <silent> p p:let @+=@0<CR>
" TODO activate paste mode before pasting (good for terminals)
" check whether they handle ^H and ^h as <BS>, also :h paste
" if !has("gui_running")
" xnoremap <silent> p :<C-U>set paste<CR>gvp:let @+=@0<CR>:set nopaste<CR>
" nnoremap <silent> p :set paste<CR>p:set nopaste<CR>
" endif
" Test if this is needed first (some terminals may be smart enough, also when
" using the "+" register the regular paste may be ok as it is, but not for other registers)
" we can also indent the pasted text - a bit twitchy/flashing due to reselection
"xnoremap p "_dPV`]=
" that's why we can use =`]
" (`] marker-motion == jump to end to previously changed/yanked text)
" xnoremap p "_dP=`]
" nnoremap p p=`]
" ------------------------------------------------------------------------------
" Stop highlighting matching search pattern and any vim-exchange selections pressing <ESC>
" BEGIN_ESCAPE_WORKAROUND
" In terminal <esc>smth must be mapped in order to trigger timeout.
" Only then it will work. Else numbers shown on startup in terminal.
" also, rapid pressing <esc><F*> will result in weird behavior, such
" as entering insert mode and writing S for <esc><F4>.
" Triple esc mapping prevents it.
" At the end adding :execute "normal \<Plug>(ExchangeClear)"<CR>
" to cancel any vim-exchange markings-highlights.
" If there will be no further remaps of vim-exchange's cxc then ending
" :call feedkeys("cxc")<CR>
" should work too.
" Also :call feedkeys("\<Plug>(ExchangeClear)")<CR> should work too.
" Lastly, <Plug>(ExchangeClear) wont work without parens () around
" ExchangeClear, they might be part of the name (?)
" How to call <Plugs>: https://stackoverflow.com/questions/8862290/vims-plug-based-mappings-dont-work-with-normal-command
" Also works:
" nnoremap <silent> <ESC> :nohlsearch<CR><ESC>:call feedkeys("\<Plug>(ExchangeClear)")<CR>
" My original mappings (before adding ExchangeClear):
" nnoremap <silent> <ESC> :nohlsearch<CR><ESC>
" nnoremap <silent> <ESC><ESC> :nohlsearch<CR><ESC>
" nnoremap <silent> <ESC><ESC><ESC> :nohlsearch<CR><ESC>
" Stop highlighting matching search pattern and any vim-exchange selections pressing <ESC>
" BEGIN_ESCAPE_WORKAROUND
" In terminal <esc>smth must be mapped in order to trigger timeout.
" Only then it will work. Else numbers shown on startup in terminal.
" also, rapid pressing <esc><F*> will result in weird behavior, such
" as entering insert mode and writing S for <esc><F4>.
" Triple esc mapping prevents it.
" At the end adding :execute "normal \<Plug>(ExchangeClear)"<CR>
" to cancel any vim-exchange markings-highlights.
" If there will be no further remaps of vim-exchange's cxc then ending
" :call feedkeys("cxc")<CR>
" should work too.
" Also :call feedkeys("\<Plug>(ExchangeClear)")<CR> should work too.
" Lastly, <Plug>(ExchangeClear) wont work without parens () around
" ExchangeClear, they might be part of the name (?)
" How to call <Plugs>: https://stackoverflow.com/questions/8862290/vims-plug-based-mappings-dont-work-with-normal-command
" Also works:
" nnoremap <silent> <ESC> :nohlsearch<CR><ESC>:call feedkeys("\<Plug>(ExchangeClear)")<CR>
" My original mappings (before adding ExchangeClear):
" nnoremap <silent> <ESC> :nohlsearch<CR><ESC>
" nnoremap <silent> <ESC><ESC> :nohlsearch<CR><ESC>
" nnoremap <silent> <ESC><ESC><ESC> :nohlsearch<CR><ESC>
" <ESC> clears search highlights and exhange marking highlights.
" GUI doesnt need <ESC><ESC> workaround, so lets not add the its delay.
if has('gui_running')
nnoremap <silent> <ESC> :nohlsearch<CR><ESC>:execute "normal \<Plug>(ExchangeClear)"<CR>
" the <ESC> mapping unmaps cxc for some reason, so redo the mapping
" nmap cxc <Plug>(ExchangeClear)
nnoremap <silent> cxc :execute "normal \<Plug>(ExchangeClear)"<CR>
" feedkeys("cxc") works without breaking norm cxc, not sure about
" performance though, feels like the same, keeping for future ref:
" nnoremap <silent> <ESC> :nohlsearch<CR><ESC>:call feedkeys("cxc")<CR>
else
nnoremap <silent> <ESC> :nohlsearch<CR><ESC>:execute "normal \<Plug>(ExchangeClear)"<CR>
nnoremap <silent> <ESC><ESC> :nohlsearch<CR><ESC>:execute "normal \<Plug>(ExchangeClear)"<CR>
nnoremap <silent> <ESC><ESC><ESC> :nohlsearch<CR><ESC>:execute "normal \<Plug>(ExchangeClear)"<CR>
" nmap cxc <Plug>(ExchangeClear)
nnoremap <silent> cxc :execute "normal \<Plug>(ExchangeClear)"<CR>
endif
" END_ESCAPE_WORKAROUND
" ------------------------------------------------------------------------------
" On windows with conemu:
" add this to conemu envir.variables script setting so that powerline symbols
" appear correctly.
" "#" stands for comment
" set ConEmuDefaultCp=65001
" # chcp 65001
" # chcp utf8
if &term=~'win32' && (has('win32') || has('win64')) && !has('gui_running') && !has('nvim') && exists('$ConEmuANSI')
set term=xterm
set t_Co=256
let &t_AB="\e[48;5;%dm"
let &t_AF="\e[38;5;%dm"
" set termguicolors
" fix <BS> on conemu
inoremap <Char-0x07F> <BS>
nnoremap <Char-0x07F> <BS>
endif
" " nvim on conemu, not working: colors messed up, airline copied multiple
" times
" if &term=~'win32' && (has('win32') || has('win64')) && !has('gui_running') && has('nvim') && exists('$ConEmuANSI')
" set term=xterm
" set t_Co=256
" let &t_AB="\e[48;5;%dm"
" let &t_AF="\e[38;5;%dm"
" " set termguicolors
" " fix <BS> on conemu
" inoremap <Char-0x07F> <BS>
" nnoremap <Char-0x07F> <BS>
" endif
" ------------------------------------------------------------------------------
" nvim with GUI
" if has('nvim')
" " autocmd VimEnter * execute 'GuiFont! Source Code Pro Medium:h10'
" " could not make it work yet. :messages says GuiFont not an editor command
" " TODO: find a way to check whether neovim is running in gui.
" GuiFont! Source Code Pro Medium:h10
" endif
" The below still dont work, try to test on non-linked main dir and clean
" init.vim
" echom "here"
" if has('nvim') && exists(':GuiFont')
" autocmd VimEnter * execute 'GuiFont! Source Code Pro Medium:h10' | echom 'here'
" " execute 'GuiFont! Source Code Pro Medium:h10'
" endif
augroup SetFontNeovimDDD
autocmd!
autocmd VimEnter * if has('nvim') && exists(':GuiFont') | echom 'here' | execute 'GuiFont! Source Code Pro Medium:h10' | endif
augroup END
" :GuiFont! Source Code Pro Medium:h10
" ------------------------------------------------------------------------------
" "" Special highlight of 81st char in long line, needs to be after colorscheme
" and after special term sequences or else it might be shown not show
" highlight MyColorColumn guifg=#d8d8d8 guibg=#ab4642 guisp=NONE gui=NONE ctermfg=7 ctermbg=1 cterm=NONE
" call matchadd('MyColorColumn', '\%81v', 100)
" to change the color of colorcolumn (better be done with augroup autocmd)
" highlight ColorColumn ctermbg=235 guibg=#2c2d27
" ------------------------------------------------------------------------------
" when colorscheme is changed to solarized family dark
augroup ColorschemeChangeDDD
autocmd!
autocmd ColorScheme flattened_dark,solarized8_dark,solarized8_dark_flat
" \ highlight Pmenu term=bold cterm=underline,bold
" \ ctermfg=10 ctermbg=8 gui=underline,bold guifg=#586e75
" \ guibg=#002b36
" \ | highlight EasyMotionTargetDefault gui=NONE cterm=NONE
" \ | highlight EasyMotionTarget2FirstDefault gui=NONE cterm=NONE
" \ | highlight EasyMotionTarget2SecondDefault gui=NONE cterm=NONE
" \ | AirlineRefresh
autocmd ColorScheme flattened_light,solarized8_light,solarized8_light_flat
" \ highlight Pmenu term=bold cterm=underline,bold
" \ ctermfg=14 ctermbg=15 gui=underline,bold guifg=#93a1a1
" \ guibg=#fdf6e3
" \ | highlight EasyMotionTargetDefault gui=NONE cterm=NONE
" \ | highlight EasyMotionTarget2FirstDefault gui=NONE cterm=NONE
" \ | highlight EasyMotionTarget2SecondDefault gui=NONE cterm=NONE
" \ | AirlineRefresh
augroup END
" " remove italics from comments
" highlight Comment gui=NONE cterm=NONE
" ------------------------------------------------------------------------------
" TODO: check this, executes macro over lines
" xnoremap @ :<C-u>call ExecuteMacroOverVisualRange()<CR>
" function! ExecuteMacroOverVisualRange()
" echo "@".getcmdline()
" execute ":'<,'>normal @".nr2char(getchar())
" endfunction
" ------------------------------------------------------------------------------
" Lightline:
" Only one of {taohex, mgee} sections below should be used.
" ------- Lightline with taohex/lightline-buffer
" let g:lightline = {
" \ 'colorscheme': 'solarized',
" \ 'tabline': {
" \ 'left': [ [ 'bufferinfo' ], [ 'bufferbefore', 'buffercurrent', 'bufferafter' ], ],
" \ 'right': [ [ 'close' ], ],
" \ },
" \ 'component_expand': {
" \ 'buffercurrent': 'lightline#buffer#buffercurrent2',
" \ },
" \ 'component_type': {
" \ 'buffercurrent': 'tabsel',
" \ },
" \ 'component_function': {
" \ 'bufferbefore': 'lightline#buffer#bufferbefore',
" \ 'bufferafter': 'lightline#buffer#bufferafter',
" \ 'bufferinfo': 'lightline#buffer#bufferinfo',
" \ },
" \ }
" ------------------ Airline
" TODO: set the lightest available options, else remove it.
" makes cursor lag + text flash on new appending/inserting first char - only
" when buffer was unmodified (that is, without [+]).
" do not detect modified, should not produce the above lag on first insert
" TODO: build custom statusline and tabline so that performance is good:
" The performance is currently so bad, that even entering insert causes cursor
" flicker. It's likely not a good idea to use expressions in statusline, as they will be
" evaluated every statusline auto-redraw-update. Better idea is to
" use autocmds to change variables displayed, also to change colors using
" "hi link" to switch using autocmds. Links confirming redraws/calls:
" https://vi.stackexchange.com/questions/7441/display-current-subroutine-subprogram-in-statusline
" http://vim.wikia.com/wiki/Non-native_fileformat_for_your_statusline
" For customization, some places to start are:
" https://github.com/ap/vim-buftabline <-- here first
" http://www.vim.org/scripts/script.php?script_id=1664 <-- buftabs, minimal
" https://github.com/mkitt/tabline.vim <-- only 80 sloc, but shows only tabs
" https://www.reddit.com/r/vim/comments/e19bu/whats_your_status_line/
" https://github.com/tpope/vim-flagship
" https://shapeshed.com/vim-statuslines/
" https://www.blaenkdenum.com/posts/a-simpler-vim-statusline/
" http://got-ravings.blogspot.gr/search/label/statuslines
" https://nkantar.com/blog/my-vim-statusline/
" https://gabri.me/blog/diy-vim-statusline/
" http://got-ravings.blogspot.gr/search/label/statuslines
let g:airline_detect_modified=0
let g:airline_detect_spell=0
let g:airline#extensions#tabline#enabled = 1
" let g:airline_theme='dark_minimal'
" -------------------------------------------
let g:airline#extensions#eclim#enabled = 1
let g:airline#extensions#wordcount#enabled = 0
let g:airline_powerline_fonts = 1
let g:airline_theme='solarized'
let g:airline_solarized_dark_inactive_border = 1
" set t_Co=256
" get rid of rightmost triangle, small perf. penalty
" let g:airline_skip_empty_sections = 1
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
let g:airline_symbols.branch = ''
let g:airline_symbols.readonly = ''
let g:airline_symbols.linenr = ''
" to look like non-powerline version:
"let g:airline_left_sep = ''
"let g:airline_right_sep = ''
"let g:airline_left_alt_sep = ''
"let g:airline_right_alt_sep = ''
"let g:airline#extensions#tabline#left_sep = ' '
"let g:airline#extensions#tabline#left_alt_sep = '|'
let g:airline#extensions#syntastic#enabled = 0
let airline#extensions#syntastic#error_symbol = 'E:'
let airline#extensions#syntastic#warning_symbol = 'W:'
" below just for checking the capabilities / correct rendering of fonts
" and for general reference, in case I need them again
" unicode symbols
let g:airline_left_sep = '»'
let g:airline_left_sep = '▶'
let g:airline_right_sep = '«'
let g:airline_right_sep = '◀'
let g:airline_symbols.linenr = '␊'
let g:airline_symbols.linenr = ''
let g:airline_symbols.linenr = '¶'
let g:airline_symbols.branch = '⎇'
let g:airline_symbols.paste = 'ρ'
let g:airline_symbols.paste = 'Þ'
let g:airline_symbols.paste = '∥'
let g:airline_symbols.whitespace = 'Ξ'
" airline symbols
let g:airline_left_sep = ''
let g:airline_left_alt_sep = ''
let g:airline_right_sep = ''
let g:airline_right_alt_sep = ''
let g:airline_symbols.branch = ''
let g:airline_symbols.readonly = ''
let g:airline_symbols.linenr = ''
" ------------------------------------------------------------------------------
" -------------------- Vim-easymotion
" The new/latest default mapping of easymotion is <Leader><Leader>, that is
" double-pressing <Space> in my case. Using old mapping of sinle <Leader>,
" even though it may break some future plugins (check when installing new
" plugins that there is no conflict between it and easymotion).
" original command:
" map <Leader> <Plug>(easymotion-prefix)
" TODO maybe redo mappings? (see above mapping leader to <nop>)
" The below will undo all easymotion mappings (dunno why)
" let g:EasyMotion_do_mapping = 0
" ------------------------------------------------------------------------------
" -------------------- Vim-exchange
" c-x marks for exchange in visual-only, default is "X" aka my black hole delete
" (manual suggests xmap, doesnt say anything about xnoremap)
" Reminder:
" (must be pressed in rather quick succession, has smth to do with timeout)
" cxc clears any selections
" cxx exchanges lines
" dot operator "." is usually what is used on the second text piece in exchange
" xnore does not work, so using xmap
xmap <C-X> <Plug>(Exchange)
" -------------------- YouCompleteMe
" doesnt work to manually trigger identifier completion
let g:ccc = 'call feedkeys("\<C-x>\<C-u>\<C-p>", "n")'
inoremap <silent><c-v> <c-r>=execute(g:ccc)<CR>
inoremap <silent><c-v> <c-r>=feedkeys("\<C-x>\<C-u>\<C-p>", "n")<CR>
" Works: Manually trigger ycm without losing identifier completion:
inoremap <silent><C-l> <C-r>=execute('let g:ycm_auto_trigger=1 \| doautocmd <nomodeline> ycmcompletemecursormove TextChangedI \| let g:ycm_auto_trigger=0')<CR>
inoremap <silent><C-l> <C-r>=execute("let g:ycm_auto_trigger=1 \| doautocmd <nomodeline> ycmcompletemecursormove TextChangedI \| let g:ycm_auto_trigger=0")<CR>
" The "\" before "|" is needed, else this will not run correctly. Single vs
" double quotes seem the same, keeping both just in case.
" The above but with a list:
inoremap <silent><C-l> <C-r>=execute(['let g:ycm_auto_trigger=1' , 'doautocmd <nomodeline> ycmcompletemecursormove TextChangedI' , 'let g:ycm_auto_trigger=0'])<CR>
se se
" "silent" is the default either way
inoremap <silent><C-l> <C-r>=execute(['let g:ycm_auto_trigger=1' , 'doautocmd <nomodeline> ycmcompletemecursormove TextChangedI' , 'let g:ycm_auto_trigger=0'], "silent")<CR>
" "silent!" will suppress error msgs as well
inoremap <silent><C-l> <C-r>=execute(['let g:ycm_auto_trigger=1' , 'doautocmd <nomodeline> ycmcompletemecursormove TextChangedI' , 'let g:ycm_auto_trigger=0'], "silent!")<CR>
" WORKAROUND-YCM1 FOR https://github.com/Valloric/YouCompleteMe/issues/526
" When using <BS> completion results change and become fewer.
" <C-w> to begin typing again will give correct results, but maybe not worth
" retyping. This will most likely break deletion in any pair auto close plugins.
" inoremap <expr><BS> pumvisible()? "\<C-y>\<BS>" : "\<BS>"
" " Should not use <c-p>, <c-x>, <c-u>, conflicts with ycm (ycm disables it too)
" inoremap <C-p> <nop>
" inoremap <C-x> <nop>
" inoremap <C-u> <nop>
" THIS IS THE BEST WAY FOR PREVENTING COMPLETION:
" (still a hack though)
" It will not re-trigger anything, but will not hide the usual menu.
" Still, much better. Maybe should be called on vimenter (as would not be
" recognized otherwise?)
" call youcompleteme#DisableCursorMovedAutocommands()
" call youcompleteme#EnableCursorMovedAutocommands()
" also to consider preventing completion:
" (this should also halt collection of identifiers and reparsing on change)
" :let b:ycm_largefile = 1
" :unlet b:ycm_largefile
" this should kill popup on next char with au InsertCharPre:
" if pumvisible()
" call feedkeys( "\<C-e>", 'n' )
" endif
" UNSOLVABLE ISSUE: (???) ycm feeds the whole line to ycm, meaning that:
" // s is a string, try to fuzzy complete "s.toLowercase":
" s.tlc<c-space> <-- error: eclim cannot resolve s to a type.
" Confusingly, it WILL work if "s.<c-space>" was pressed right before on the
" same line. Ycm will fetch the results from cache and fuzzy complete
" correctly. Need to adjust the pattern to cut whatever follows "." yet use it
" to fuzzy filter the results from eclim omni. When using auto-trigger this is
" not an issue, since as soon as "." was typed, ycm's cache was filled and
" fuzzying is correct.
" TODO figure out how to manually trigger the real completion function:
" youcompleteme#CompleteFunc(...)
" do not trigger as-I-type-completion
let g:ycm_auto_trigger = 1
" do not cache eclim's omnifunc, will break fuzziness - see above.
" let g:ycm_cache_omnifunc = 0
" complete language keywords from vim syntax file
let g:ycm_seed_identifiers_with_syntax = 1
" complete using ctags
let g:ycm_collect_identifiers_from_tags_files = 1
" let g:ycm_always_populate_location_list = 1
" auto close preview after leaving insert mode
" Lets keep it == 0 since we dont allow it in menuopt anyway
let g:ycm_autoclose_preview_window_after_insertion = 0
" stop highlighting warning/error parts of line, causes highlighing at the
" same point in all the other open buffers
let g:ycm_enable_diagnostic_highlighting = 0
" if =1 adds preview to completeopt, if not there already, 0 is default
let g:ycm_add_preview_to_completeopt = 0
let g:ycm_min_num_of_chars_for_completion = 2
" only menu (even if only one valid suggestion result), ycm auto sets it to menuone too
" set completeopt=menuone
" complete in comments too
let g:ycm_complete_in_comments = 1
" TODO make a mapping trigger preview opening on demand while completing
" TODO try out calling ycm's autocmd as callbacks:
" assuming ycm_min_num_of_char == 0 initially
" Timer:
" set ycm-auto-popup true (or maybe set min_num_chars to 0 here, see below)
" doautocmd ycm-on-insert-leave (as if we pressed esc)
" doautocmd ycm-on-insert-enter (as if we pressed insert)
" InsertPre: (with <nomodelines>???)
" pumvisible -> <c-y> to close popup (ycm already does it?)
" set ycm-auto-popup false (or maybe set min_num_chars to 100, effectively
" disabling identifier based completion)
" if needed:
" doautocmd ycm-on-insert-leave (as if we pressed esc)
" doautocmd ycm-on-insert-enter (as if we pressed insert)
" ------------- completion after 1500ms with CursorHoldI --------------------
" " Dont use swapfile, needed for setting low updatetime values.
" " Manual says all text will be in memory, dont use this for big files, likely
" " no problems on high ram systems.
" set noswapfile
" " Set updatetime - CursorHold and CursorHoldI trigger after this time
" " autocommands (also used to write swap, default is 4000 ms)
" " To be used to set my artificial delay of YouCompleteMe.
" " UPDATE: better use timers, see below.
" set updatetime=500
" " this will work as a test without ycm
" " but skips every second letter popup after the initial popup
" set updatetime=500
" autocmd! CursorHoldI * call feedkeys("\<c-n>\<c-p>") | echom "cncpfeedkeysDDD"
" " TODO maybe it is related to popup being visible?(pumvisible) or because my autocmd are
" executed first. To make them execute last, I should make them into a plugin
" and load it first. Test the following:
" inore <c-y> <nop>
" autocmd! CursorHoldI * call feedkeys("\<c-y>\<c-n>\<c-p>") | echom "cncpfeedkeysDDD"
" this works and will trigger once per completion initiation, that is
" continuing to type after menu pop will not trigger additional <c-spaces>
" until after next <space> is inserted.
" autocmd! CursorHoldI * call feedkeys ("\<C-Space>") | echom "semanticfeedkeysDDD"
" warning: weird behaior of feedkeys:
" autocmd! CursorHoldI * call feedkeys ("a") | echom "aaaaa"
" as it will trigger EVERY updatetime, although <c-space> will trigger once
" per menu popup.
" The following will autotrigger the semantic completion after 'updatetime':
" This is hacky though as it relies on the internal function that gets mapped
" to <C-Space>.
" autocmd CursorHoldI * :call <SNR>70_InvokeSemanticCompletion() | echom "semanticDDD"
" InvokeCompletion will trigger only every second letter, but provides
" identifier completion, feedkeys will re-trigger after updatetime (likely a
" bug in vim)
" autocmd CursorHoldI * :call <SNR>70_InvokeCompletion() | echom "nonsemanticDDD"
" autocmd! CursorHoldI * :call feedkeys ("\<C-Space>") | echom "semanticfeedkeysDDD"
" TODO: try autocmd to set g:ycm_auto_trigger to 1 and 0 and see if it can
" pick it up in the middle of completion - does not work
" autocmd! CursorHoldI * :let g:ycm_auto_trigger=1 | call <SNR>70_InvokeSemanticCompletion() | call <SNR>70_OnCompleteDone()
" autocmd InsertCharPre * :let g:ycm_auto_trigger=0
" autocmd CompleteDone * :let g:ycm_auto_trigger=0
" autocmd TextChangedI * :let g:ycm_auto_trigger=0
" "-----------------------------------------------------------------------------
" -------------- completion after 1500ms with timers ---------------------------
" " for debugging / timers demo:
" function! MyComplPresserFunc(timer)
" " only the last will trigger
" if exists('g:myLastComplTimerIdDDD') && g:myLastComplTimerIdDDD ==# a:timer
" unlet g:myLastComplTimerIdDDD
" " call feedkeys("\<c-n>\<c-p>")
" echom a:timer . " pressed"
" else
" echom "concurrent " . a:timer . " not pressed"
" endif
" endfunction
" autocmd TextChangedI * echom "TextChangedI" | let g:myLastComplTimerIdDDD = timer_start(1500, 'MyComplPresserFunc')
" " now the real running code:
" function! MyComplPresserFunc(timer)
" " only the last will trigger, as each new TextChangedI autocmd overwrites
" " g:myLastComplTimerIdDDD, so that when MyComplPresserFunc() callbacks are
" " executed they do nothing, except the last. That is, every subsequent
" " TextChangedI autocmd "invalidates" the previous one, which in turn
" " "invalidated" the one before it etc...
" if exists('g:myLastComplTimerIdDDD') && g:myLastComplTimerIdDDD ==# a:timer
" unlet g:myLastComplTimerIdDDD
" call feedkeys("\<c-n>\<c-p>")
" " better not have whatever in feedkeys mapped in norm (see below)
" endif
" endfunction
" augroup MyCompletionTriggerDDD
" autocmd!
" " autocmd TextChangedI * let g:myLastComplTimerIdDDD = timer_start(1500, 'MyComplPresserFunc')
" " autocmd InsertEnter * let g:myLastComplTimerIdDDD = timer_start(1500, 'MyComplPresserFunc')
" " autocmd InsertLeave * if exists('g:myLastComplTimerIdDDD')
" " \ | unlet g:myLastComplTimerIdDDD | endif
" " autocmd InsertLeave * if exists('g:myLastComplTimerIdDDD')
" " \ | call timer_stop(g:myLastComplTimerIdDDD) | unlet g:myLastComplTimerIdDDD | endif
" " P.S. Not sure what happens if there is a race condition when <esc>
" " is pressed right at the moment of 1500ms and both the autocmd and
" " the MyComplPresserFunc callback try to unlet g:myLastComplTimerIdDDD at
" " the same time. TODO investigate whether there are locks. How safe is
" " this? Also, pipe (:h bar) will stop subsequent execution if one of
" " commands errors out. This can leave us with an unclosed 'if'? Maybe
" " 'try-catch' is better.
" " TODO maybe better to set ID out of range instead of unlet? What is
" " the range of IDs generated? It is integer, but is it overflown?
" " Also, unlet! does not produce error and does not prevent | execution!
" augroup END
" until I clarify the above this is the working variant
let g:myLastComplTimerIdDDD = -1
function! MyComplPresserFunc(timer)
" only the last will trigger, as each new TextChangedI autocmd overwrites
" g:myLastComplTimerIdDDD, so that when MyComplPresserFunc() callbacks are
" executed they do nothing, except the last. That is, every subsequent
" TextChangedI autocmd "invalidates" the previous one, which in turn
" "invalidated" the one before it etc...
" From tests IDs returned by timer_start are auto-incremening
" integers, so maybe they are overflown when reaching 32bit max
" 32bit max int == 2,147,483,647
if g:myLastComplTimerIdDDD ==# a:timer
let g:myLastComplTimerIdDDD = -1
call feedkeys("\<c-n>\<c-p>")
" better not have whatever in feedkeys mapped in norm (see below)
endif
endfunction
augroup MyCompletionTriggerDDD
autocmd!
" " TextChangedI does not trigger when popup is open (it does not autoclose)
" autocmd TextChangedI * let g:myLastComplTimerIdDDD = timer_start(1500, 'MyComplPresserFunc')
" autocmd InsertLeave * let g:myLastComplTimerIdDDD = -1
" " autocmd InsertEnter * let g:myLastComplTimerIdDDD = timer_start(1500, 'MyComplPresserFunc')
augroup END
" " ------------------- Javacomplete2
" autocmd FileType java setlocal omnifunc=javacomplete#Complete
" " " unmap all default mappings
" " nunmap <leader>jI
" " nunmap <leader>jR
" " nunmap <leader>ji
" " nunmap <leader>jii
" " iunmap <C-j>I
" " iunmap <C-j>R
" " iunmap <C-j>i
" " iunmap <C-j>ii
" " nunmap <leader>jM
" " iunmap <C-j>jM
" " nunmap <leader>jA
" " nunmap <leader>js
" " nunmap <leader>jg
" " nunmap <leader>ja
" " nunmap <leader>jts
" " nunmap <leader>jeq
" " nunmap <leader>jc
" " nunmap <leader>jcc
" " iunmap <C-j>s
" " iunmap <C-j>g
" " iunmap <C-j>a
" " vunmap <leader>js
" " vunmap <leader>jg
" " vunmap <leader>ja
" " nunmap <silent> <buffer> <leader>jn
" " nunmap <silent> <buffer> <leader>jN
" " -------------- vim-shell --------------------------------------------
" " dont be always on top, so that alt-tabbing works
let g:shell_fullscreen_always_on_top = 0
" " dont use default mappings
let g:shell_mappings_enabled = 0
" " prevent airline's tab line from being hidden
let g:shell_fullscreen_items=''
" nnoremap <F11> :Fullscreen<CR>
" -------------- regex ------------------------------------------------
" :h usr_27.txt
" :h pattern
" ------------- neocomplete
" Autodetected value,to manually disable using it. To check if neovim has
" recognized vimproc: echo neocomplete#has_vimproc()
" let g:neocomplete#use_vimproc
" After dot and text completion: "b.tst|" -> "b.toString()|". Has delay/flashes.
" inoremap <c-l> <c-left><C-r>=neocomplete#mappings#start_manual_complete()<CR><esc>ea<C-r>=neocomplete#mappings#start_manual_complete()<CR>
" imap <silent> <c-l> <c-left><c-r>=execute('let g:neocomplete#disable_auto_complete = 0')<cr><c-space><esc>ea<c-space><c-r>=execute('let g:neocomplete#disable_auto_complete = 1')<cr>
imap <silent> <c-m> <c-left><c-r>=execute('let g:neocomplete#disable_auto_complete = 0')<cr><C-r>=neocomplete#mappings#start_manual_complete()<CR><esc>ea<C-r>=neocomplete#mappings#start_manual_complete()<CR><c-r>=execute('let g:neocomplete#disable_auto_complete = 1')<cr>
" TODO: try to achieve the same with saving cursor position with getpos, doing
" <c-l>, then restoring cursor position with setpos, its possible that
" flipping disable_auto_complete switch will not be needed (like in ycm)
" let g:neocomplete#sources#omni#input_patterns.java = '\%(\h\w*\|)\)\.\w*'
" let g:neocomplete#sources#omni#input_patterns.java = '\k\.\k*'
" let g:neocomplete#sources#omni#input_patterns.java = '\h\w*\.\w*'
" let g:neocomplete#sources#omni#input_patterns.java = '\(\S.*\.\)\+[^;]*'
" " ------------------ Neocomplete -> newer transfer from vimrc
" set completeopt=menuone,noselect
" " TODO: on terminals <c-space> may not be valid. Use :<c-v><c-space> to see
" " what it resolves to. Possibly <c-@>
" " inoremap <expr><c-space> pumvisible() ? "\<C-n>" : neocomplete#start_manual_complete()
" " inoremap <expr><s-space> pumvisible() ? "\<C-p>" : neocomplete#start_manual_complete()
" " INFO: there is no way to get fuzzy autocomplete from eclim omni after having
" " some letters after ".". Example: this will complete "s.<c-space>", while
" " this will not: "s.toStr<c-space>". The best way when having custom manual
" " timer (auto timer will still produce lags) to trigger <c-space> and wait for
" " the first popup after "s." (or manually press <c-space>), this will open
" " popup with [O] for "omni" and the results will be cached. Afterwards, press
" " "tst" and wait (or manually <c-space>) and the "toString()" result will be
" " in the popup.
" " helpful: i_c-o execute a command, return to insert
" " i_c-r= insert a result of expression, function returning "" should work.
" " check whether side effects are allowed in the above.
" " Also inoremap <expr> func(), also not sure about side effects.
" " '\%(\h\w*\|)\)\.\w*'
" " TODO: the above will omni complete after "()." but will falsely try to omni
" " after "someVar.tst" (note that eclim will not make it into "toString")
" " TODO: make manual trigger that will detect pattern "someVar.tst" and will
" " delete "tst", press <c-space> to cache omnicompletion, then restore tst and
" " present fuzzy results. :h i_ctrl-o, :h getline(), :h append().
" " The regular manual complete.
" inoremap <expr><c-space> neocomplete#start_manual_complete()
" " inoremap <c-space> <c-left><C-r>=neocomplete#mappings#manual_complete()<CR><esc>ea<C-r>=neocomplete#mappings#manual_complete()<CR>
" " After dot and text completion: "b.tst|" -> "b.toString()|". Has delay/flashes.
" imap <silent> <c-l> <c-left><c-r>=execute('let g:neocomplete#disable_auto_complete = 0')<cr><C-r>=neocomplete#mappings#start_manual_complete()<CR><esc>ea<C-r>=neocomplete#mappings#start_manual_complete()<CR><c-r>=execute('let g:neocomplete#disable_auto_complete = 1')<cr>
" " -------------------------------------
" function! MyComplPresserFunc(timer)
" if exists('g:myLastComplTimerIdDDD')
" echom a:timer . " pressed"
" " call neocomplete#start_manual_complete()
" call feedkeys("\<C-r>=neocomplete#mappings#start_manual_complete()\<CR>", 'n')
" echom a:timer . " pressed after"
" " call feedkeys("\<c-n>\<c-p>")
" " try call feedkeys("\<c-space>", 'm')
" endif
" endfunction
" " augroup MyCompletionTriggerDDD
" " autocmd!
" " autocmd TextChangedI * if exists('g:myLastComplTimerIdDDD') | call timer_stop(g:myLastComplTimerIdDDD) | endif | let g:myLastComplTimerIdDDD = timer_start(1500, 'MyComplPresserFunc') | echom "textChangedI event created timer " . g:myLastComplTimerIdDDD
" " autocmd InsertLeave * if exists('g:myLastComplTimerIdDDD') | call timer_stop(g:myLastComplTimerIdDDD) | endif | unlet! g:myLastComplTimerIdDDD
" " autocmd InsertCharPre * if pumvisible() | call feedkeys("\<c-y>", 'n') | endif
" " augroup END
" " -------------------------------------
" let g:neocomplete#enable_at_startup = 1
" " disable neocomplete in cygwin/mintty
" if exists('$OS') && $OS ==# 'Windows_NT' && &term =~ '^xterm'
" let g:neocomplete#enable_at_startup = 0
" endif
" " disable automatic completion
" let g:neocomplete#disable_auto_complete = 1
" " TODO investigate whether it is the same as :NeoCompleteToggle
" " When ==1 -> more flicker, gives more correct results, when in autopopup mode.
" " It seems like fuzzying is triggered when no candidates whose chars are matched
" " consequently are not available. 1 always trigger fuzzying (it seems).
" let g:neocomplete#enable_refresh_always = 0
" " Use smartcase.
" let g:neocomplete#enable_smart_case = 0
" " Set minimum syntax keyword length.
" let g:neocomplete#sources#syntax#min_keyword_length = 2
" " create delay before popup in ms (50 is default)
" let g:neocomplete#auto_complete_delay = 0
" " neocomplete + eclim:
" " " faq says it does not support eclim out of the box
" " " then add one of the 2 following:
" " " 1. from documentation(fixed):
" if !exists('g:neocomplete#sources#omni#input_patterns')
" let g:neocomplete#sources#omni#input_patterns = {}
" endif
" let g:neocomplete#sources#omni#input_patterns.java = '\(\S.*\.\)\+'
" " 2. but others seem to be using this. This may disable fuzzy completion when
" " omni source is used.
" " if !exists('g:neocomplete#force_omni_input_patterns')
" " let g:neocomplete#force_omni_input_patterns = {}
" " endif
" " let g:neocomplete#force_omni_input_patterns.java = '\k\.\k*'
" " same as 1, different regex
" " " if !exists('g:neocomplete#sources#omni#input_patterns')
" " " let g:neocomplete#sources#omni#input_patterns = {}
" " " endif
" " " let g:neocomplete#sources#omni#input_patterns.java = '\h\w*\.\w*'
" " " ---------
" " let g:neocomplete#skip_auto_completion_time = ''
" " " Define keyword.
" " if !exists('g:neocomplete#keyword_patterns')
" " let g:neocomplete#keyword_patterns = {}
" " endif
" " let g:neocomplete#keyword_patterns['default'] = '\h\w*'
" " " TODO check what exactly this does. Must be equivalent to:
" " " let g:neocomplete#keyword_patterns._ = '\h\w*'
" " if !exists('g:neocomplete#sources')
" " let g:neocomplete#sources = {}
" " endif
" " " ---------
" " " <CR>: close popup and save indent.
" " inoremap <silent> <CR> <C-r>=<SID>my_cr_function_DDD()<CR>
" " function! s:my_cr_function_DDD()
" " return (pumvisible() ? "\<C-y>" : "" ) . "\<CR>"
" " endfunction
" " " <TAB>: completion.
" " inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
" " neocomplete#start_manual_complete([{sources}])
" " inoremap <expr><Tab> neocomplete#start_manual_complete()
" " " <C-h>, <BS>: close popup and delete backword char
" " inoremap <expr><C-h> neocomplete#smart_close_popup()."\<C-h>"
" " inoremap <expr><BS> neocomplete#smart_close_popup()."\<C-h>"
" ----------------------------------
" In foxit to get j and k to go to next/prev page -> right click ribbon ->
" "Customize ribbon" -> "Keyboard"
" -------------------------------------------
" prev tpope/vim-commentary commit
Plug 'tpope/vim-commentary', {'commit': 'be79030b3e8c0ee3c5f45b4333919e4830531e80'}
" ^^ Changing the above because it is too simple and will not use correct
" comment-delimiters in code-embedded-in-other-code (like css-in-html, js-in-html, jsx too?)