Repository navigation
Expand file tree
/
Copy path_vimrc
More file actions
executable file
·3362 lines (2871 loc) · 112 KB
/
Copy path_vimrc
File metadata and controls
executable file
·3362 lines (2871 loc) · 112 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
"#¤º°`°º¤ø,¸¸,ø¤º°`°º¤øø¤º°`°º¤ø,¸¸,ø¤º°`°º¤øø¤º°`°º¤¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø
" Name: $HOME/.vimrc
" Summary: Platform-independent, overly ambitious, Vim config file
"
" The mechanic that would perfect his work must first sharpen
" his tools -- Confucius
"
" Created: Wed 06-Jun-1998 (Bob Heckel)
" Modified: Wed 09-Sep-2026 (Bob Heckel)
"#¤º°`°º¤ø,¸¸,ø¤º°`°º¤øø¤º°`°º¤ø,¸¸,ø¤º°`°º¤øø¤º°`°º¤¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø
" Settings {{{1
" Who set it last e.g.: :verbose se shiftwidth?
" Ordered by ':option option-window' convention
"--------------------------------------------------------------------------
" 00 initialization {{{2
" C:\Users\x\vim\vim81\gvim.exe -c "set noswapfile" -u c:\cygwin64\home\x\dotfiles\_vimrc
" Unleash the beast VIVIVI:
set nocompatible
" DEBUG toggle:
"""echo 'reach'
" Watch initialization, etc. Or use $ vim -V
"""set verbose=1
" Watch changes to text happen slowly (default is 0)
"""set writedelay=5
"""scriptnames
let THISBOX = hostname()
let WORKBOXARRAY = [ 'HOSTNM1', 'HOSTNM2' ]
" Setup tempspace that vim and gVim can share, make sure both Linux & Windows hostnames are added to WORKBOXARRAY
if matchstr(WORKBOXARRAY, THISBOX) == THISBOX
if has('gui') && has('win32')
" Windows gVim
" let VTMP = 't:/Personnel/bob/tmp'
let VTMP = ''
let VTMPU = 'u:/temp'
elseif has('win32unix') " Cygwin
" Cygwin terminal
" let VTMP = '/cygdrive/t/Personnel/bob/tmp'
let VTMP = ''
let VTMPU = '/cygdrive/u/temp'
else
" Linux terminal
" let VTMP = '~/bob/tmp'
let VTMP = ''
let VTMPU = '~/tmp'
endif
else
if has('gui') && has('win32')
" Windows gVim
let VTMP = 'c:/temp'
elseif has('win32unix') " Cygwin
" Cygwin terminal
let VTMP = '/cygdrive/c/temp'
else
" Linux terminal
let VTMP = '~/tmp'
endif
endif
" Fix leftward movement problem on z/OS:
if has('ebcdic')
set t_le=
endif
"if has('unix') && !has('win32unix') " not Cygwin
" " Make sure this comes before the syntax area of this file:
" echo 'do i need this?'
" set t_Co=256
"endif
" set t_ut=
" set background=dark
" Force vim to clear itself when exiting:
"""set t_ti=7[r[?47h
"""set t_te=[?47l8
" $ mkdir -p ~/.vim/autoload ~/.vim/bundle && curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
"""execute pathogen#infect()
" cd ~/.vim/bundle && git clone git://github.com/tpope/vim-commentary.git
" 01 NetRW {{{2
let g:netrw_altv=1
let g:netrw_banner=0
let g:netrw_bufsettings="noma nomod nonu nobl nowrap ro rnu"
" Avoid Cygwin CRLF problem
let g:netrw_dirhistmax=0
let g:netrw_fastbrowse=2
"let g:netrw_dirhistmax = 0
" i to toggle details
let g:netrw_liststyle=0
let g:netrw_sort_options="i"
let g:netrw_timefmt='%d-%b-%y %H:%M:%S'
"""let g:netrw_list_cmd = '\ls -l'
"""let g:netrw_list_cmd = '/cygdrive/c/windows/System32/WindowsPowerShell/v1.0/powershell -Command dir'
let g:netrw_preview = 1
let g:netrw_liststyle = 3
let g:netrw_winsize = 25
"if has ('win32unix') " Cygwin
" let g:netrw_cygwin=1 " scp to be provided by Cygwin
" let g:netrw_browsex_viewer='cygstart'
"endif
"if ! &diff
" augroup ProjectDrawer
" autocmd!
" autocmd VimEnter * :Vexplore
" augroup END
"endif
" 02 moving around, searching and pattern {{{2
" H, M, L, gg, etc commands move cursor to first blank in line.
set nostartofline
" Search pwd and subdirs when using gf, :find, etc.
" if matchstr(WORKBOXARRAY, THISBOX) == THISBOX
" set path=/sasdata/Macros,**
" else
"""set path=.,**/*
set path=**
" endif
set wrapscan
set incsearch
set magic
" Override noignorecase with /\c... but smartcase should be smart enough to not require that.
set ignorecase
" Sadly can't use smartcase because using [I while sitting on an upper or mixed
" case word - we will not find all matches. Use /\Cfoo for now.
set nosmartcase
" 03 tags {{{2
" 04 displaying text {{{2
set nowrap
set lazyredraw
set nolinebreak
set showbreak=^
set sidescroll=5
" Minimum number screen lines of context offset buffer to keep above top and below bottom the cursor
set scrolloff=0
set scrollopt=hor,ver
set nonumber
if version > 702
" if ! has("gui_running")
set cursorcolumn
" endif
set relativenumber
" :se rnu gutter at 7pt font should rarely go > 100
set numberwidth=3
endif
" :se guifont=* to open OS-specific menu
if has('gui_running')
" gVim window coordinates dimensions height/width. Overriden later depending on file type.
"winpos 295 295
set columns=110
" Most of the time we're just doing fast edits so make it small
set lines=42
if has('gui_gtk3')
set guifont=Cousine\ 8
elseif has('x11')
" set guifont=*-Consolas-medium-r-normal-*-*-180-*-*-m-*-*
set guifont=Consolas\ 9
elseif has("gui_win32")
set guifont=Consolas:h9
endif
endif
if has('gui')
" gvim's copy-on-select visual highlight mode
set guioptions+=a
set guioptions+=b
set guioptions+=r
set guioptions+=i
set guioptions-=T
set guioptions-=m
endif
" For Win32 cmd only. Unix uses t_ti and t_te.
set restorescreen
" 05 syntax, highlighting and spelling {{{2
" Adjusted by filetype below:
set hlsearch
"--------------------------------------------------------------------------
" View current highlighting: :hi or :so $VIMRUNTIME/syntax/hitest.vim
" To test term: :runtime syntax/colortest.vim
"
" To determine cterm color number:
" for i in {0..255} ; do printf "\x1b[38;5;${i}mcolour${i}\n"; done
" ~/code/misc/vim_colors.txt
"--------------------------------------------------------------------------
"set t_Co=256
"set t_ut=
"set termguicolors
syntax enable
"syntax sync maxlines=500 ccomment
"syntax sync maxlines=1000
syntax sync fromstart
" Avoid reading text presented like it was written on a lightbulb. We're " usually relying on .mintty or .Xdefaults for ctermbg/fg.
hi Normal guifg=White guibg=Black
"hi Comment ctermbg=Black ctermfg=242 guibg=Black guifg=DarkGray
"hi Comment guibg=Black guifg=DarkGray
hi Comment ctermfg=DarkGray ctermbg=Black guifg=DarkGray guibg=Black
hi Folded ctermfg=DarkGray ctermbg=Black guifg=DarkGray guibg=Black cterm=bold gui=bold
hi Conditional ctermfg=LightGreen guifg=LightGreen
hi DiffAdd ctermfg=Black ctermbg=LightGreen guifg=Black guibg=LightGreen
hi DiffChange ctermfg=Black ctermbg=Cyan guifg=Black guibg=Yellow
hi DiffDelete ctermbg=DarkGreen guibg=DarkGreen
" hi DiffText ctermfg=Green guifg=Black
hi Directory ctermfg=Magenta guifg=Magenta guibg=Black cterm=bold gui=bold
" Highlight tabs other than at start of line for indenting
"""match ErrorMsg /[^\t]\zs\t\+/
hi ErrorMsg ctermfg=Black ctermbg=124 guifg=Black guibg=Red
hi Function ctermfg=Yellow guifg=LightYellow guibg=Black
hi Identifier ctermfg=LightCyan guifg=LightCyan
hi MatchParen ctermfg=White ctermbg=Blue guifg=Cyan guibg=Magenta
hi ModeMsg ctermfg=Black ctermbg=Yellow guifg=Black guibg=Yellow
hi MoreMsg ctermfg=Blue ctermbg=Black guifg=Blue
hi Number ctermfg=Magenta guifg=Magenta
hi CursorLineNr ctermfg=White ctermbg=DarkGray guifg=White guibg=DarkGray cterm=bold gui=bold
" Vertical bar. Must use '!' due to syntax groups
hi! CursorColumn ctermfg=247 ctermbg=234 guifg=#9e9e9e guibg=#1c1c1c
" For :se rnu relative number gutter
"hi LineNr ctermfg=246 ctermbg=237 guifg=DarkGray guibg=#222222
hi LineNr ctermfg=246 ctermbg=234 guifg=DarkGray guibg=#222222
" Tab completion dropdown
hi Pmenu ctermfg=Black ctermbg=Gray guifg=White guibg=Gray
hi PmenuSbar ctermfg=Black ctermbg=Gray guifg=White guibg=Black
hi PmenuSel ctermfg=Blue ctermbg=Yellow guifg=Blue guibg=Yellow
hi PreProc ctermfg=LightMagenta guifg=LightMagenta guibg=Black
" hi IncSearch ctermfg=White ctermbg=LightBlue guifg=White guibg=LightBlue
" hls
hi Search ctermfg=Yellow ctermbg=DarkGray guifg=White guibg=DarkGray
hi SpecialKey ctermfg=Black ctermbg=DarkMagenta guifg=Black guibg=DarkMagenta
hi Statement ctermfg=Yellow guifg=LightYellow guibg=Black
hi String ctermfg=White guifg=White guibg=Black cterm=bold gui=bold
" May be overridden by aucommands. Mirror any change here to there.
hi User1 ctermfg=red guifg=red cterm=inverse,bold
if hostname() == 'webserver'
hi StatusLine ctermfg=26 ctermbg=White
hi StatusLineNC ctermfg=26 ctermbg=Gray
elseif hostname() == 'evolved'
hi StatusLine ctermfg=92 ctermbg=White
hi StatusLineNC ctermfg=92 ctermbg=Gray
else
hi StatusLine ctermfg=23 ctermbg=White guifg=#005f5f guibg=White
hi StatusLineNC ctermfg=23 ctermbg=Gray guifg=#005f5f guibg=Gray
endif
hi TabLine ctermfg=Gray ctermbg=DarkGray
hi TabLineSel ctermfg=White ctermbg=DarkGray
hi TabLineFill cterm=underline ctermbg=Gray
hi Title ctermfg=White ctermbg=Magenta guifg=White guibg=Purple
" Don't highlight NOTE
hi clear Todo
" TODO haha
"hi myTodo cterm=undercurl gui=undercurl ctermbg=Yellow guibg=Yellow
"match MyTodo /\<TODO\>/
hi Visual ctermfg=Black ctermbg=LightMagenta guifg=Black guibg=LightMagenta
hi WarningMsg ctermfg=Magenta ctermbg=Yellow guifg=Magenta guibg=Yellow
" NetRW
hi VertSplit ctermfg=243 ctermbg=233 guifg=#545454 guibg=#141414
hi netrwDir ctermfg=99 ctermbg=Black guifg=#648ed1 guibg=Black cterm=bold gui=bold
"""hi WhitespaceEOL ctermbg=red guibg=red
"""match WhitespaceEOL /\s\+$/
hi GitCollision ctermbg=red guibg=yellow
match GitCollision /^\(<\|=\|>\)\{7\}\([^=].\+\)\?$/
" Microsoft fancy quotes, Teams, etc
hi EvilChars ctermbg=Red guibg=Red
match EvilChars /\%u201c\|\%u201d\|\%u00a0/
" 06 multiple windows {{{2
" Mandatory for displaying a status line:
set laststatus=2
" Depends on this being set above:
" hi User1 term=inverse,bold cterm=inverse,bold ctermfg=red guifg=red
" ...and $VIMSTATUSL being set in .bashrc
" E.g. ~/.vimrc [+,VIM,unix,b1] rsh868@ZEBWL12H99999 485/4494L,1C(10%)
" TODO
"set statusline=%<%f%h\ [%1*%M%*%R%H%Y,%{&ff},b%n]\ %{$VIMSTATUSL}\ %=\ %l/%LL,%cC%V(%P)%{$GB_VIMSTATUSL}%{AmIPasting()}
"TODO
"function VarExists(var)
" if exists(a:var) | return v:this_session | else | return '' | endif
"endfunction
"set statusline=%<%f%h\ [%1*%M%*%R%H%Y,%{&ff},b%n]\ %{$VIMSTATUSL}\ %=\ %l/%LL,%cC%V(%P)%{AmIPasting()} %{VarExists('v:this_session')}
"if !exists('$VIMSTATUSL')
if !empty($VIMSTATUSL)
set statusline=%<%f%h\ [%1*%M%*%R%H%Y,%{&ff},b%n]\ %{$VIMSTATUSL}\ %=\ %l/%LL,%cC%V(%P)%{AmIPasting()}
"set statusline=%<%f%h\ [%1*%M%*%R%H%Y,%{&ff},b%n]\ %{$VIMSTATUSL}\ %=\ %l/%LL,%cC%V(%P)
"set statusline=%<%f%h\ [%M%R%H%Y,%{&ff},b%n]\ %{$VIMSTATUSL}\ %=\ %l/%LL,%cC%V(%P)%{AmIPasting()}
"set statusline=%<%f%h\ [%M%R%H%Y,%{&ff},b%n]\ %{$VIMSTATUSL}\ %=\ %l/%LL,%cC%V(%P)%{AmIPasting()}%*
else
set statusline=%<%f%h\ [%1*%M%*%R%H%Y,%{&ff},b%n]\ CAUTION:\ USER\ UNKNOWN\ (ROOT??)\ %=\ %l/%LL,%cC%V(%P)%{AmIPasting()}
"set statusline=%<%f%h\ [%1*%M%*%R%H%Y,%{&ff},b%n]\ CAUTION:\ USER\ UNKNOWN\ (ROOT??)\ %=\ %l/%LL,%cC%V(%P)
endif
" Use <C-W>= to force equal as needed:
set noequalalways
set helpheight=999
" To prevent losing undo on buffer switch (but does create trouble with marks). Allows switching from an
" unsaved buffer without saving it first.
set hidden
" Land in top window split
set nosplitbelow
" New window opens on the right
set splitright
" 07 multiple tab pages {{{2
" 08 terminal {{{2
" <C-r>" pastes while in insert mode:
set esckeys
set title
set titlelen=90
" 09 using the mouse {{{2
set mousehide
" For spellchecking:
set mousemodel=popup
"if has('unnamedplus') && has('gui')
"set clipboard=unnamedplus
"else
set clipboard=
"endif
" 10 printing {{{2
" Left margin is too wide by default:
set printoptions=wrap:y,left:5pc
" 11 messages and info {{{2
set shortmess=xfilmwrItn
" E.g. 111L, 15C in bottom right status bar. We're controlling the display via
" set statusline instead of set rulerformat.
set ruler
" Shhhhhhhhhhhhhhhhhhhh people are trying to work!
set visualbell
" Number of lines changed:
set report=0
set showcmd
set showmode
" 12 selecting text {{{2
set keymodel=
set selection=inclusive
" Emulate xterm mouse. Same as :behave xterm
set selectmode=
" set textwidth=130
" 13 editing text {{{2
" Show '$' on C and s actions, i.e. emulate vi
set cpoptions=s$
" set dictionary=/usr/share/dict/words
" Toggle to stop undo on massive actions (prevent memory overload)
" set undolevels=-1
set undolevels=5000
" When using C-X + C-P, look in current file and buffers. See inoremap <TAB>.
set complete=.,w,b
" Add angle brackets to the % bounce functionality
set matchpairs+=<:>
set joinspaces
" Want to avoid 0042 from being detected as octal during a C-A increment
set nrformats-=octal
" Omnicomplete C-X C-O (think Battlestar Galactica)
set omnifunc=syntaxcomplete#Complete
set showmatch
" ~ works like an operator. E.g. ~fa changes case of all chars to the first
" 'a'. BUT this screws up normal use so leave it off.
set notildeop
" 14 tabs and indenting {{{2
" Tabs expanded to spaces. Replaces the tabs you create when pressing <tab>
" with spaces (to the count of your tabstop). Alternatively use :retab to
" replace tabs with spaces.
" Without this, doing an 'o' on an indented line, or a '>>' anywhere, inserts a
" new line that starts with one or more tabs.
set expandtab
set shiftwidth=2
set softtabstop=2
" :retab to convert tabs to 2 spaces
set tabstop=2
set cinwords=if,elsif,else,while,do,for,switch,unless,until,when,otherwise,BEGIN,END
set autoindent
" Restore indent after typing hash
"""set nosmartindent
"""set cindent
"""set cinkeys-=0#
"""set indentkeys-=0#
" 15 folding {{{2
if has('folding')
set foldmethod=manual
" Fold on paragraphs
set foldexpr=getline(v:lnum)=~'^\\s*$'&&getline(v:lnum+1)=~'\\S'?'<1':1
set foldopen-=search
endif
" 16 diff mode {{{2
set diffopt+=filler
if v:version > 801 && has("patch148")
set diffopt+=iwhiteall
set diffopt+=algorithm:patience
" Avoid having to use :vert diffsplit
set diffopt+=vertical
endif
set diffexpr="--ignore-blank-lines"
" 17 mapping {{{2
" Mapping delay. E.g. ,m Also need to change HelpPager() if change this.
set timeoutlen=333
" 18 reading and writing files {{{2
" Allow backspacing in insert mode. Make sure stty is set properly.
set backspace=start,indent
if has('win32')
set fileformat=dos
set fileformats=dos,unix
elseif has('win32unix') " Cygwin, make sure this comes before has('unix')
set fileformat=dos
set fileformats=dos,unix
elseif has('unix')
set fileformat=unix
set fileformats=unix,dos
endif
" For security reasons, set to 'no'
set nomodeline
set nosourceany
" Allow gf on %foo to open /sasdata/macros/foo.sas
set suffixesadd=.sas
" 19 swap file {{{2
" Avoid placing swapfiles where other users might be confused by them
"""if has('gui_win32')
""" if $HOMEDRIVE == 'C:' && $HOMEPATH == '\Users\boheck'
""" set directory=C:\cygwin64\home\boheck\tmp
""" endif
"""else
""" set directory=~/tmp/
"""endif
set undofile
set undolevels=1000 " how many undos
set undoreload=10000 " number of lines to save for undo
set backup " enable backups
set swapfile " enable swaps
set updatetime=60000 " write swap file to disk after 60 inactive seconds
set undodir=$HOME/.vim/tmp/undo " undo files
set backupdir=$HOME/.vim/tmp/backup " backups
set directory=$HOME/.vim/tmp/swap " swap files
" Make those folders if they don't already exist
if !isdirectory(expand(&undodir))
call mkdir(expand(&undodir), "p")
endif
if !isdirectory(expand(&backupdir))
call mkdir(expand(&backupdir), "p")
endif
if !isdirectory(expand(&directory))
call mkdir(expand(&directory), "p")
endif
" 20 command line editing {{{2
" Maximize window for q: history
set cmdwinheight=999
set history=5000
" Want to emulate bash(1) tab completion
set wildmode=list:longest
set wildchar=<Tab>
if exists("&wildignorecase")
set wildignorecase
endif
set wildmenu
set suffixes=.old,.old2,.OLD,OLD2,.o,.swp,.bak,.bak2,.BAK,.BAK2,~
" 21 executing external commands {{{2
" We want the Unix version so make sure shell=/bin/sh, :se ep= to restore indent default (gg=G)
set equalprg=sort
" Default. K to activate. See Autocommands for exceptions.
set keywordprg=man
if has('gui_win32')
" Allow uniq, etc. to run in Windows gVim
set shell=c:\cygwin64\bin\bash.exe\ -login
set shellcmdflag=-c
set shellquote=\"
else
set shell=bash
endif
" 22 running make and jumping to errors {{{2
" Quickfix. :mak[e] jumps to errors (use :cn :cN to navigate). See au
" commands for C++ files. Warning: can't undo after make returns.
"""set makeprg=make
set makeprg=gcc\ -Wall\ %
"""set makeprg=gcc\ -Wall\ %\ -lmenu\ -lncurses
" 23 language specific {{{2
" Eliminated default '%' to enable SAS macro gf functionality
" TODO gvim fails to open Windows paths like \\dept\foo\file.txt
"set isfname=@,48-57,/,.,-,_,+,,,#,$,~,=
" 24 multi-byte characters {{{2
set encoding=utf-8
set fileencoding=utf-8
set listchars=eol:$,tab:>-,trail:~,extends:>,precedes:<
" 25 other {{{2
" Comments default to: sr:/*,mb:*,el:*/,://,b:#,:%,:XCOMM,n:>,fb:-
set comments=sr:/*,mb:*,el:*/,://,b:#,b:\',b:\"
" For :mksession
set sessionoptions=curdir,folds,slash,unix,winsize,winpos,buffers
" 1000 files of marks. 750 lines of registers. 5000 lines of history (see 'history' above).
" Using the '%' switch is very subtle - if you open vim w/o a filename
" it'll silently put the MRU filelist into the buffer. So don't use '%'
" because it's confusing as hell with BufExplorer.
set viminfo='1000,\"750,:5000
" For :mkview & :loadview. Force gvim to Cygwin's default.
set viewdir=~/.vim/view
" Allow e.g. :bro e /todel/testing instead of :bro e \todel\testing
set shellslash
" end Settings
"--------------------------------------------------------------------------
" Abbreviations {{{1
" Who set it last e.g.: :verbose ab BoB
" To get a literal (e.g. HtM) type CTRL-V *after* you finish typing the
" abbreviation. Do :ab to view your abbreviations. Or e.g. view all HTML
" ab's with :iab H Do :abclear to remove all.
"--------------------------------------------------------------------------
" Personal
iab BoB Bob Heckel
iab RoB Robert S. Heckel Jr.
" Misc
iab AlP ABCDEFGHIJKLMNOPQRSTUVWXYZ
iab MoN January February March April May June July August September October November December
iab MoO Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
iab NuM 1234567890123456789012345678901234567890123456789012345678901234567890
iab RuL ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0
"iab ShE #!/bin/bash<CR><CR>set -e<CR>set -o nounset<CR>
iab ShE #!/bin/bash<CR>set -euo pipefail<CR>
" Date/Time see man strftime or date --help. Convention stolen from Sven Guckes:
" iab YdC Created: <C-R>=strftime("%a %d %b %Y %H:%M:%S")<CR> (Bob Heckel)
iab YdC Created: <C-R>=strftime("%d-%b-%Y")<CR> (Bob Heckel)
" iab YdC Created: <C-R>=strftime("%d-%b-%y")<CR> (Bob Heckel)
iab YdM Modified: <C-R>=strftime("%d-%b-%Y")<CR> (Bob Heckel)
" Default. Overridden later in au commands.
iab YdA Adapted: <C-R>=strftime("%d-%b-%Y")<CR> (Bob Heckel)
" Short. ISO-8601 format. E.g. 2002-07-05
iab YdS <C-R>=strftime("%Y-%m-%d")<CR>
" 30-Jul-19
iab YdG <C-R>=strftime("%d-%b-%y")<CR>
" HTML (also see :TOhtml)
iab HtA <a href=" "> </a>
iab HtM <!DOCTYPE html><CR><html><CR> <head><meta charset="utf-8"><title></title></head><CR><body></body><CR><Left><Left></html>
iab HtT <table><CR> <tr><td> </td></tr><CR><Left><Left></table>
" Character entities:
"""iab ;< <
"""iab ;> >
"""iab ;' '
"""iab ;" "
"""iab ;& &
"""iab ;_
" See :digraphs
" === IAST Sanskrit vowels (macrons) ===
iabbrev xxa ā
iabbrev xxA Ā
iabbrev xxi ī
iabbrev xxI Ī
iabbrev xxu ū
iabbrev xxU Ū
" === Vocalic r and l ===
iabbrev xxr ṛ
iabbrev xxR Ṛ
iabbrev xxrr ṝ
iabbrev xxRR Ṝ
iabbrev xxl ḷ
iabbrev xxL Ḷ
iabbrev xxll ḹ
iabbrev xxLL ḹ
" === Anusvara / Visarga ===
iabbrev xxm ṃ
iabbrev xxM Ṃ
iabbrev xxh ḥ
iabbrev xxH Ḥ
" === Retroflexes ===
iabbrev xxt ṭ
iabbrev xxT Ṭ
iabbrev xxd ḍ
iabbrev xxD Ḍ
iabbrev xxn ṇ
iabbrev xxN Ṇ
" === Palatal / sibilants ===
iabbrev xxs ṣ
iabbrev xxS Ṣ
iabbrev xxss ś
iabbrev xxSS Ś
iabbrev xxnya ñ
iabbrev xxNYA Ñ
" === Velar nasal ===
iabbrev xxnn ṅ
iabbrev xxNN Ṅ
" === 36 Tattvas ===
iabbrev xxxha ह
iabbrev xxxsaaa स
iabbrev xxxsaa ष
iabbrev xxxsa श
iabbrev xxxva व
"iabbrev xxxla ल
iabbrev xxxra र
"iabbrev xxxya य
iabbrev xxxla ल
iabbrev xxxya य
" labial
iabbrev xxxma म
iabbrev xxxbha भ
iabbrev xxxba ब
iabbrev xxxpha फ
iabbrev xxxpa प
" dental
iabbrev xxxnnnna न
iabbrev xxxdha ध
iabbrev xxxda द
iabbrev xxxtha थ
iabbrev xxxta त
" retroflex (dotted get aa)
iabbrev xxxnnna ण
iabbrev xxxdhaa ढ
iabbrev xxxdaa ड
iabbrev xxxthaa ठ
iabbrev xxxtaa ट
" palatal
iabbrev xxxnna ञ
iabbrev xxxjha झ
iabbrev xxxja ज
iabbrev xxxcha छ
iabbrev xxxca च
" gutteral
iabbrev xxxna ङ
iabbrev xxxgha घ
iabbrev xxxga ग
iabbrev xxxkha ख
iabbrev xxxka क
" Mutt
"""iab MuX X-message-flag: Magic 8Ball says 'Outlook not so good.' Let me ask about MS Exchange Server...
" Perl
iab PeD require Data::Dumper; print STDERR "DEBUG: ", Data::Dumper::Dumper( %h ),"\n";
" Use PeD for hash dumping, this for everything else on symbol table
iab PeF open F, '>junkdumpmain'; for $s(sort keys %main::) { local *sym=$main::{$s}; print F "\\$$s is $$s\\n" if defined $sym; print F "\\@$s is @$s\\n" if defined @sym;}
iab PeO open my $read, '<', $file or die "Error: $0: $!";<CR><CR>while ( <$read> ){<CR>}<Up>
iab PeR #!/usr/bin/perl<CR><CR>use warnings;<CR>use strict;<CR>use v5.10;<CR>
" iab PeW while ( (my $k, my $v) = each %h ) { print "$k=$v\\n"; }
" SAS
" SAS/(C)onnect
"""iab SaC options ls=max;<CR>%include "&HOME/code/sas/connect_setup.sas";<CR>signon cdcjes2;<CR>%global CHICKENPARM;<CR>%syslput CHICKENPARM=&SYSPARM;<CR>rsubmit;<CR><CR><CR><CR><CR><CR>endrsubmit;<CR>signoff cdcjes2;
" Debug Log inline, best for IntrNet:
iab SaD options ls=max;<Esc>0idata _NULL_; set _LAST_(obs=100 where=(myid in:('foo'))); put "!!!wtf &SYSDSN"(_ALL_)(=);run;
" (E)lapsed
iab SaE %let START=%sysfunc(time());<CR>%put !!! (&SYSCC) Elapsed minutes: %sysevalf((%sysfunc(time())-&START)/60);
iab SaL options ls=180 ps=max; libname l '.';
iab SaO filename F 'junk'; data t(rename=(PRODDESC=nm APRCLASS=class)); infile F truncover; input PRODDESC= $100. APRCLASS= $100.; run;
iab SaP <Esc>0ititle "&SYSDSN";proc print data=_LAST_(obs=10) width=minimum heading=H;run;title;
iab SaQ proc sql;<CR> create table t as<CR>select *<CR>from t a join t2 b on a.foo=b.foo<CR>where<CR>group by<CR>;<CR><Left><Left>quit;<Esc><Up><Up><Up>
iab SaS select ( myvar );<CR><Space><Space>when ( 42 ) delete;<CR><Space><Space>otherwise;<CR><Left><Left>end;
"iab SiL :silent! w!~/onedrive/misc/bkup/%:t<CR>
"
cab Sy0 source $VIMRUNTIME/syntax/nosyntax.vim
cab SyH source $VIMRUNTIME/syntax/nosyntax.vim \| source $VIMRUNTIME/syntax/html.vim
cab SyL source $HOME/code/sas/saslog.vim
cab SyJ source $VIMRUNTIME/syntax/nosyntax.vim \| source $VIMRUNTIME/syntax/javascript.vim
cab SyQ source $VIMRUNTIME/syntax/nosyntax.vim \| source $VIMRUNTIME/syntax/sql.vim
"cab SyS source $VIMRUNTIME/syntax/nosyntax.vim \| source $HOME/code/sas/sas.vim
"cab SyS source $HOME/code/sas/sas.vim
" Oracle
iab DbO DBMS_OUTPUT.put_line('sysdate: ' \|\| SYSDATE);<Esc><Left>i
" end Abbreviations-
"--------------------------------------------------------------------------
" Mappings {{{1
"
" Must come after Settings for <> notation
"--------------------------------------------------------------------------
" Toggle search highlighting
nnoremap <Return> :set nohlsearch<Return><Return>
nnoremap <Return><Return> :set hlsearch<Return><Return>
" Assumes stty -ixon in .bashrc
nnoremap <C-S> :w<CR>
" Easily navigate wrapped '^...' long lines with arrow keys
nnoremap <Up> gk
nnoremap <Down> gj
" Quickfix output navigation
" nnoremap <F1> :cnext<CR>
" nnoremap <F2> :cprevious<CR>
if has('gui')
" Widen gvim to max column width
nnoremap <F4> :call SetOpt('columns', MaxLineLen(0))<CR>
nnoremap <F4><F4> :call SetOpt('columns', 80)<CR>
endif
"""nnoremap <F6> :se guifont=Consolas:h5<CR>z.
"""nnoremap <F7> :se guifont=Consolas:h7<CR>z.
"""nnoremap <F8> :se guifont=Consolas:h9<CR>z.
"""nnoremap <F9> :se guifont=Consolas:h12<CR>z.
"""nnoremap <F10> :se guifont=Consolas:h15<CR>z.
if has('win32')
" Minimize gvim (like alt-spacebar-n) to taskbar
" nnoremap <F2> :simalt ~n<CR>
" Maximize gvim
nnoremap <F11> :simalt ~x<CR>
" Restore gvim maximize
nnoremap <F11><F11> :simalt ~r<CR>
" Avoid mswin.vim forcing Ctrl-v act as paste, etc.
nnoremap <C-V> <C-Q>
nnoremap <C-A> <C-A>
endif
nnoremap <F12> :qa<CR>
" Like gv but for paste buffer. Some day i may actually remember to use this...
nnoremap <expr> gb '`[' . strpart(getregtype(), 0, 1) . '`]'
" Highlight last paste - (g)et (p)aste
nnoremap <expr> gp '`[' . strpart(getregtype(), 0, 1) . '`]'
" Open a window for the file under cursor - (g)et this file a (w)indow
nnoremap gw <Esc>:split<CR>gf
" Copy visual mode selection to system clipboard if :has('clipboard')==0. Like Windows gVim's default. See also :set clipboard=
if $WSLENV =~ 'WT_SESSION:WT_PROFILE_ID:' || !empty($WSL_HOST_IP)
" Not needed except to keep keystrokes consistent - see autocommands Yankme
vnoremap <silent> yx y
"vnoremap <silent> yx :'<,'>!/mnt/c/Windows/System32/clip.exe
"vnoremap <silent> yx :'<,'>!clip.exe
"elsif $PATH =~ 'termux'
" vnoremap <silent> yx :!termux-clipboard-set<CR>u
"elseif hostname() == 'metta'
" vnoremap <silent> yx :'<,'>!clip.exe
"elsif hostname() == 'penguin'
" Crostini clipboard support is a mess in 2021
" if ! has('gui_running')
" vnoremap <silent> yx :'<,'>w! ~/.crouton-clipboard/data.txt<CR>
"TODO avoid an external $ catput ~/.crouton-clipboard/data.txt
"vnoremap <silent> yx :'<,'>w! ~/.crouton-clipboard/data.txt; catput ~/.crouton-clipboard/data.txt<CR>
" else
" Crostini Gvim clipboard works normally
" vnoremap <silent> yx "+y
" endif
else
"elsif !empty($CYGWIN)
" Works for Cygwin
vnoremap <silent> yx "*y
endif
" Jump to the exact position where you left, not to beginning of line
nnoremap ' `
" Hack to fix the stray pixel problem with monospaced fonts under Cygwin rxvt
" nnoremap <Esc><Esc> <C-L>
" End of word fast append
nnoremap E ea
" Don't accidentally drop into ex mode
nnoremap Q :q
" Typo laziness
nnoremap :W :w
" Normalize yank until end of line with D and C
nnoremap Y y$
" The command {number}CTRL-G show the current buffer number. Prevent a loop in
" the mapping by using 'nnoremap'.
nnoremap <C-G> 2<C-G>
" NetRW
nnoremap <C-N> :Vexplore<CR>
" Like Firefox...
nnoremap <C-T> :tabnew<CR>
" ...except
au FileType help,HELP :nnoremap <C-T> <C-T>
" Cycle through tabs with, what else... TAB!
nnoremap <Tab> :tabnext<CR>
noremap <Space> <C-F>
" Speed up movement a bit
if !exists('g:vscode')
nnoremap <C-E> 2<C-E>
nnoremap <C-Y> 2<C-Y>
endif
" Use for simple window jumping. Use C-W for complex jumps. Normal zz is the
" same as z. so override it here since z. is better. Also see maps ,b ;b ;h ;j ;k ;ll
nnoremap zz <C-W>w
" Bondage & discipline to force using jk
" inoremap <Esc> <NOP>
" Avoid <Esc> or dealing with CapsLock remapping. The menu showing completion candidates
" will close it with <C-e> instead of exiting insert mode with <Esc>
inoremap <expr> jk pumvisible() ? "<C-e>" : "<Esc>"
" Reformat current paragraph to gq while in insert mode (avoid vap etc):
" inoremap <F1> <C-L><ESC>gqap{/<C-L><CR>xi
" Normal action, while in insert mode, CTR-E inserts the character below the
" cursor. This prevents that and allows the more useful scrolling up/down.
inoremap
inoremap
" Required for using C-I to get a tab (when 'tab as word completion' is in effect)
inoremap <C-I> <C-X><C-I>
" Line completion. Hides <C-L> so to clear the screen use my <Esc><Esc> mapping
inoremap <C-L> <C-X><C-L>
" Filesystem completion. Hides an unused <C-F>.
inoremap <C-F> <C-X><C-F>
" Dictionary completion
inoremap <C-K> <C-X><C-K>
" Remap <TAB> for smart completion on various characters
"""inoremap <silent> <TAB> <C-R>=SmartComplete()<CR>
" Tab completion. Find (p)revious completions. See set complete.
if !exists('g:vscode')
inoremap <silent> <TAB> <C-P>
endif
" TODO interferes with copy/paste inserts
" inoremap ( ()<Esc>i
" Add case-insensitivity
set grepprg=grep\ -ni\ $*\ /dev/null
" Search all open buffers
cmap bbb call setqflist([]) \| silent bufdo grepadd! %<C-F>$hha