/
tlib.txt
executable file
·1864 lines (1455 loc) · 75.9 KB
/
tlib.txt
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
*tlib.txt* tlib -- A library of vim functions
Author: Tom Link, micathom at gmail com
This library provides some utility functions. There isn't much need to
install it unless another plugin requires you to do so.
Most of the library is included in autoload files. No autocommands are
created. With the exception of loading ../plugin/02tlib.vim at startup
the library has no impact on startup time or anything else.
The change-log is included at the bottom of ../plugin/02tlib.vim
(move the cursor over the file name and type gfG)
Demo of |tlib#input#List()|:
http://vimsomnia.blogspot.com/2010/11/selecting-items-from-list-with-tlibs.html
-----------------------------------------------------------------------
Install~
Edit the vba file and type: >
:so %
See :help vimball for details. If you have difficulties, please make
sure, you have the current version of vimball (vimscript #1502)
installed.
========================================================================
Contents~
:TRequire ............................... |:TRequire|
:TLet ................................... |:TLet|
:TScratch ............................... |:TScratch|
:TVarArg ................................ |:TVarArg|
:TKeyArg ................................ |:TKeyArg|
:TBrowseOutput .......................... |:TBrowseOutput|
:TBrowseScriptnames ..................... |:TBrowseScriptnames|
:TTimeCommand ........................... |:TTimeCommand|
g:tlib_pick_last_item ................... |g:tlib_pick_last_item|
g:tlib_sortprefs_threshold .............. |g:tlib_sortprefs_threshold|
g:tlib_scratch_pos ...................... |g:tlib_scratch_pos|
g:tlib_inputlist_pct .................... |g:tlib_inputlist_pct|
g:tlib_inputlist_width_filename ......... |g:tlib_inputlist_width_filename|
g:tlib_inputlist_higroup ................ |g:tlib_inputlist_higroup|
g:tlib_inputlist_livesearch_threshold ... |g:tlib_inputlist_livesearch_threshold|
g:tlib_inputlist_filename_indicators .... |g:tlib_inputlist_filename_indicators|
g:tlib_inputlist_match .................. |g:tlib_inputlist_match|
g:tlib_inputlist_shortmessage ........... |g:tlib_inputlist_shortmessage|
g:tlib_tags_extra ....................... |g:tlib_tags_extra|
g:tlib_tag_substitute ................... |g:tlib_tag_substitute|
g:tlib_filename_sep ..................... |g:tlib_filename_sep|
g:tlib_cache ............................ |g:tlib_cache|
g:tlib_viewline_position ................ |g:tlib_viewline_position|
g:tlib_inputlist_and .................... |g:tlib_inputlist_and|
g:tlib_inputlist_or ..................... |g:tlib_inputlist_or|
g:tlib_inputlist_not .................... |g:tlib_inputlist_not|
g:tlib_numeric_chars .................... |g:tlib_numeric_chars|
g:tlib_keyagents_InputList_s ............ |g:tlib_keyagents_InputList_s|
g:tlib_scroll_lines ..................... |g:tlib_scroll_lines|
g:tlib_keyagents_InputList_m ............ |g:tlib_keyagents_InputList_m|
g:tlib_handlers_EditList ................ |g:tlib_handlers_EditList|
g:tlib_debug ............................ |g:tlib_debug|
tlib#notify#Echo ........................ |tlib#notify#Echo()|
tlib#notify#TrimMessage ................. |tlib#notify#TrimMessage()|
g:tlib_persistent ....................... |g:tlib_persistent|
tlib#persistent#Dir ..................... |tlib#persistent#Dir()|
tlib#persistent#Filename ................ |tlib#persistent#Filename()|
tlib#persistent#Get ..................... |tlib#persistent#Get()|
tlib#persistent#Save .................... |tlib#persistent#Save()|
g:tlib#vim#simalt_maximize .............. |g:tlib#vim#simalt_maximize|
g:tlib#vim#simalt_restore ............... |g:tlib#vim#simalt_restore|
g:tlib#vim#use_vimtweak ................. |g:tlib#vim#use_vimtweak|
tlib#vim#Maximize ....................... |tlib#vim#Maximize()|
tlib#vim#RestoreWindow .................. |tlib#vim#RestoreWindow()|
g:tlib#vim#use_wmctrl ................... |g:tlib#vim#use_wmctrl|
tlib#progressbar#Init ................... |tlib#progressbar#Init()|
tlib#progressbar#Display ................ |tlib#progressbar#Display()|
tlib#progressbar#Restore ................ |tlib#progressbar#Restore()|
tlib#eval#FormatValue ................... |tlib#eval#FormatValue()|
tlib#list#Inject ........................ |tlib#list#Inject()|
tlib#list#Compact ....................... |tlib#list#Compact()|
tlib#list#Flatten ....................... |tlib#list#Flatten()|
tlib#list#FindAll ....................... |tlib#list#FindAll()|
tlib#list#Find .......................... |tlib#list#Find()|
tlib#list#Any ........................... |tlib#list#Any()|
tlib#list#All ........................... |tlib#list#All()|
tlib#list#Remove ........................ |tlib#list#Remove()|
tlib#list#RemoveAll ..................... |tlib#list#RemoveAll()|
tlib#list#Zip ........................... |tlib#list#Zip()|
tlib#list#Uniq .......................... |tlib#list#Uniq()|
tlib#cmd#OutputAsList ................... |tlib#cmd#OutputAsList()|
tlib#cmd#BrowseOutput ................... |tlib#cmd#BrowseOutput()|
tlib#cmd#BrowseOutputWithCallback ....... |tlib#cmd#BrowseOutputWithCallback()|
tlib#cmd#DefaultBrowseOutput ............ |tlib#cmd#DefaultBrowseOutput()|
tlib#cmd#ParseScriptname ................ |tlib#cmd#ParseScriptname()|
tlib#cmd#UseVertical .................... |tlib#cmd#UseVertical()|
tlib#cmd#Time ........................... |tlib#cmd#Time()|
tlib#syntax#Collect ..................... |tlib#syntax#Collect()|
tlib#syntax#Names ....................... |tlib#syntax#Names()|
tlib#balloon#Register ................... |tlib#balloon#Register()|
tlib#balloon#Remove ..................... |tlib#balloon#Remove()|
tlib#balloon#Expr ....................... |tlib#balloon#Expr()|
g:tlib#vcs#def .......................... |g:tlib#vcs#def|
g:tlib#vcs#executables .................. |g:tlib#vcs#executables|
g:tlib#vcs#check ........................ |g:tlib#vcs#check|
tlib#vcs#FindVCS ........................ |tlib#vcs#FindVCS()|
tlib#vcs#Ls ............................. |tlib#vcs#Ls()|
tlib#vcs#Diff ........................... |tlib#vcs#Diff()|
tlib#char#Get ........................... |tlib#char#Get()|
tlib#char#IsAvailable ................... |tlib#char#IsAvailable()|
tlib#char#GetWithTimeout ................ |tlib#char#GetWithTimeout()|
tlib#scratch#UseScratch ................. |tlib#scratch#UseScratch()|
tlib#scratch#CloseScratch ............... |tlib#scratch#CloseScratch()|
tlib#autocmdgroup#Init .................. |tlib#autocmdgroup#Init()|
g:tlib#cache#purge_days ................. |g:tlib#cache#purge_days|
g:tlib#cache#purge_every_days ........... |g:tlib#cache#purge_every_days|
g:tlib#cache#script_encoding ............ |g:tlib#cache#script_encoding|
g:tlib#cache#run_script ................. |g:tlib#cache#run_script|
g:tlib#cache#silent ..................... |g:tlib#cache#silent|
g:tlib#cache#dont_purge ................. |g:tlib#cache#dont_purge|
tlib#cache#Dir .......................... |tlib#cache#Dir()|
tlib#cache#Filename ..................... |tlib#cache#Filename()|
tlib#cache#Save ......................... |tlib#cache#Save()|
tlib#cache#Get .......................... |tlib#cache#Get()|
tlib#cache#MaybePurge ................... |tlib#cache#MaybePurge()|
tlib#cache#Purge ........................ |tlib#cache#Purge()|
tlib#cache#ListFilesInCache ............. |tlib#cache#ListFilesInCache()|
tlib#normal#WithRegister ................ |tlib#normal#WithRegister()|
tlib#time#MSecs ......................... |tlib#time#MSecs()|
tlib#time#Now ........................... |tlib#time#Now()|
tlib#time#Diff .......................... |tlib#time#Diff()|
tlib#time#DiffMSecs ..................... |tlib#time#DiffMSecs()|
tlib#var#Let ............................ |tlib#var#Let()|
tlib#var#EGet ........................... |tlib#var#EGet()|
tlib#var#Get ............................ |tlib#var#Get()|
tlib#var#List ........................... |tlib#var#List()|
tlib#agent#Exit ......................... |tlib#agent#Exit()|
tlib#agent#CopyItems .................... |tlib#agent#CopyItems()|
tlib#agent#PageUp ....................... |tlib#agent#PageUp()|
tlib#agent#PageDown ..................... |tlib#agent#PageDown()|
tlib#agent#Up ........................... |tlib#agent#Up()|
tlib#agent#Down ......................... |tlib#agent#Down()|
tlib#agent#UpN .......................... |tlib#agent#UpN()|
tlib#agent#DownN ........................ |tlib#agent#DownN()|
tlib#agent#ShiftLeft .................... |tlib#agent#ShiftLeft()|
tlib#agent#ShiftRight ................... |tlib#agent#ShiftRight()|
tlib#agent#Reset ........................ |tlib#agent#Reset()|
tlib#agent#Input ........................ |tlib#agent#Input()|
tlib#agent#SuspendToParentWindow ........ |tlib#agent#SuspendToParentWindow()|
tlib#agent#Suspend ...................... |tlib#agent#Suspend()|
tlib#agent#Help ......................... |tlib#agent#Help()|
tlib#agent#OR ........................... |tlib#agent#OR()|
tlib#agent#AND .......................... |tlib#agent#AND()|
tlib#agent#ReduceFilter ................. |tlib#agent#ReduceFilter()|
tlib#agent#PopFilter .................... |tlib#agent#PopFilter()|
tlib#agent#Debug ........................ |tlib#agent#Debug()|
tlib#agent#Select ....................... |tlib#agent#Select()|
tlib#agent#SelectUp ..................... |tlib#agent#SelectUp()|
tlib#agent#SelectDown ................... |tlib#agent#SelectDown()|
tlib#agent#SelectAll .................... |tlib#agent#SelectAll()|
tlib#agent#ToggleStickyList ............. |tlib#agent#ToggleStickyList()|
tlib#agent#EditItem ..................... |tlib#agent#EditItem()|
tlib#agent#NewItem ...................... |tlib#agent#NewItem()|
tlib#agent#DeleteItems .................. |tlib#agent#DeleteItems()|
tlib#agent#Cut .......................... |tlib#agent#Cut()|
tlib#agent#Copy ......................... |tlib#agent#Copy()|
tlib#agent#Paste ........................ |tlib#agent#Paste()|
tlib#agent#EditReturnValue .............. |tlib#agent#EditReturnValue()|
tlib#agent#ViewFile ..................... |tlib#agent#ViewFile()|
tlib#agent#EditFile ..................... |tlib#agent#EditFile()|
tlib#agent#EditFileInSplit .............. |tlib#agent#EditFileInSplit()|
tlib#agent#EditFileInVSplit ............. |tlib#agent#EditFileInVSplit()|
tlib#agent#EditFileInTab ................ |tlib#agent#EditFileInTab()|
tlib#agent#ToggleScrollbind ............. |tlib#agent#ToggleScrollbind()|
tlib#agent#ShowInfo ..................... |tlib#agent#ShowInfo()|
tlib#agent#PreviewLine .................. |tlib#agent#PreviewLine()|
tlib#agent#GotoLine ..................... |tlib#agent#GotoLine()|
tlib#agent#DoAtLine ..................... |tlib#agent#DoAtLine()|
tlib#agent#Wildcard ..................... |tlib#agent#Wildcard()|
tlib#agent#Null ......................... |tlib#agent#Null()|
tlib#agent#ExecAgentByName .............. |tlib#agent#ExecAgentByName()|
tlib#agent#CompleteAgentNames ........... |tlib#agent#CompleteAgentNames()|
g:tlib#Filter_cnfx#expander ............. |g:tlib#Filter_cnfx#expander|
tlib#Filter_cnfx#New .................... |tlib#Filter_cnfx#New()|
tlib#url#Decode ......................... |tlib#url#Decode()|
tlib#url#DecodeChar ..................... |tlib#url#DecodeChar()|
tlib#url#EncodeChar ..................... |tlib#url#EncodeChar()|
tlib#url#Encode ......................... |tlib#url#Encode()|
tlib#signs#ClearAll ..................... |tlib#signs#ClearAll()|
tlib#signs#ClearBuffer .................. |tlib#signs#ClearBuffer()|
tlib#signs#Mark ......................... |tlib#signs#Mark()|
tlib#rx#Escape .......................... |tlib#rx#Escape()|
tlib#rx#EscapeReplace ................... |tlib#rx#EscapeReplace()|
tlib#rx#Suffixes ........................ |tlib#rx#Suffixes()|
tlib#tag#Retrieve ....................... |tlib#tag#Retrieve()|
tlib#tag#Collect ........................ |tlib#tag#Collect()|
tlib#tag#Format ......................... |tlib#tag#Format()|
tlib#map#PumAccept ...................... |tlib#map#PumAccept()|
tlib#Filter_cnfd#New .................... |tlib#Filter_cnfd#New()|
g:tlib#input#use_popup .................. |g:tlib#input#use_popup|
g:tlib#input#format_filename ............ |g:tlib#input#format_filename|
g:tlib#input#filename_padding_r ......... |g:tlib#input#filename_padding_r|
g:tlib#input#filename_max_width ......... |g:tlib#input#filename_max_width|
tlib#input#List ......................... |tlib#input#List()|
tlib#input#ListD ........................ |tlib#input#ListD()|
tlib#input#ListW ........................ |tlib#input#ListW()|
tlib#input#EditList ..................... |tlib#input#EditList()|
tlib#input#Resume ....................... |tlib#input#Resume()|
tlib#input#CommandSelect ................ |tlib#input#CommandSelect()|
tlib#input#Edit ......................... |tlib#input#Edit()|
tlib#input#Dialog ....................... |tlib#input#Dialog()|
tlib#file#Split ......................... |tlib#file#Split()|
tlib#file#Join .......................... |tlib#file#Join()|
tlib#file#Relative ...................... |tlib#file#Relative()|
tlib#file#With .......................... |tlib#file#With()|
tlib#paragraph#GetMetric ................ |tlib#paragraph#GetMetric()|
tlib#paragraph#Move ..................... |tlib#paragraph#Move()|
tlib#World#New .......................... |tlib#World#New()|
tlib#tab#BufMap ......................... |tlib#tab#BufMap()|
tlib#tab#TabWinNr ....................... |tlib#tab#TabWinNr()|
tlib#tab#Set ............................ |tlib#tab#Set()|
tlib#date#DiffInDays .................... |tlib#date#DiffInDays()|
tlib#date#Parse ......................... |tlib#date#Parse()|
tlib#date#SecondsSince1970 .............. |tlib#date#SecondsSince1970()|
tlib#type#IsNumber ...................... |tlib#type#IsNumber()|
tlib#type#IsString ...................... |tlib#type#IsString()|
tlib#type#IsFuncref ..................... |tlib#type#IsFuncref()|
tlib#type#IsList ........................ |tlib#type#IsList()|
tlib#type#IsDictionary .................. |tlib#type#IsDictionary()|
tlib#Filter_fuzzy#New ................... |tlib#Filter_fuzzy#New()|
tlib#textobjects#StandardParagraph ...... |standard-paragraph|
tlib#textobjects#Init ................... |tlib#textobjects#Init()|
v_sp .................................... |v_sp|
o_sp .................................... |o_sp|
tlib#arg#Get ............................ |tlib#arg#Get()|
tlib#arg#Let ............................ |tlib#arg#Let()|
tlib#arg#Key ............................ |tlib#arg#Key()|
tlib#arg#StringAsKeyArgs ................ |tlib#arg#StringAsKeyArgs()|
tlib#arg#Ex ............................. |tlib#arg#Ex()|
tlib#dir#CanonicName .................... |tlib#dir#CanonicName()|
tlib#dir#PlainName ...................... |tlib#dir#PlainName()|
tlib#dir#Ensure ......................... |tlib#dir#Ensure()|
tlib#dir#MyRuntime ...................... |tlib#dir#MyRuntime()|
tlib#dir#CD ............................. |tlib#dir#CD()|
tlib#dir#Push ........................... |tlib#dir#Push()|
tlib#dir#Pop ............................ |tlib#dir#Pop()|
tlib#win#Set ............................ |tlib#win#Set()|
tlib#win#GetLayout ...................... |tlib#win#GetLayout()|
tlib#win#SetLayout ...................... |tlib#win#SetLayout()|
tlib#win#List ........................... |tlib#win#List()|
tlib#win#Width .......................... |tlib#win#Width()|
tlib#win#WinDo .......................... |tlib#win#WinDo()|
tlib#comments#Comments .................. |tlib#comments#Comments()|
tlib#Filter_cnf#New ..................... |tlib#Filter_cnf#New()|
prototype.Pretty
tlib#Object#New ......................... |tlib#Object#New()|
prototype.New
prototype.Inherit
prototype.Extend
prototype.IsA
prototype.IsRelated
prototype.RespondTo
prototype.Super
tlib#Object#Methods ..................... |tlib#Object#Methods()|
tlib#buffer#EnableMRU ................... |tlib#buffer#EnableMRU()|
tlib#buffer#DisableMRU .................. |tlib#buffer#DisableMRU()|
tlib#buffer#Set ......................... |tlib#buffer#Set()|
tlib#buffer#Eval ........................ |tlib#buffer#Eval()|
tlib#buffer#GetList ..................... |tlib#buffer#GetList()|
tlib#buffer#ViewLine .................... |tlib#buffer#ViewLine()|
tlib#buffer#HighlightLine ............... |tlib#buffer#HighlightLine()|
tlib#buffer#DeleteRange ................. |tlib#buffer#DeleteRange()|
tlib#buffer#ReplaceRange ................ |tlib#buffer#ReplaceRange()|
tlib#buffer#ScratchStart ................ |tlib#buffer#ScratchStart()|
tlib#buffer#ScratchEnd .................. |tlib#buffer#ScratchEnd()|
tlib#buffer#BufDo ....................... |tlib#buffer#BufDo()|
tlib#buffer#InsertText .................. |tlib#buffer#InsertText()|
tlib#buffer#InsertText0 ................. |tlib#buffer#InsertText0()|
tlib#buffer#CurrentByte ................. |tlib#buffer#CurrentByte()|
tlib#buffer#KeepCursorPosition .......... |tlib#buffer#KeepCursorPosition()|
tlib#hook#Run ........................... |tlib#hook#Run()|
tlib#string#RemoveBackslashes ........... |tlib#string#RemoveBackslashes()|
tlib#string#Chomp ....................... |tlib#string#Chomp()|
tlib#string#Format ...................... |tlib#string#Format()|
tlib#string#Printf1 ..................... |tlib#string#Printf1()|
tlib#string#TrimLeft .................... |tlib#string#TrimLeft()|
tlib#string#TrimRight ................... |tlib#string#TrimRight()|
tlib#string#Strip ....................... |tlib#string#Strip()|
tlib#string#Count ....................... |tlib#string#Count()|
========================================================================
plugin/02tlib.vim~
*:TRequire*
:TRequire NAME [VERSION [FILE]]
Make a certain vim file is loaded.
Conventions: If FILE isn't defined, plugin/NAME.vim is loaded. The
file must provide a variable loaded_{NAME} that represents the version
number.
*:TLet*
:TLet VAR = VALUE
Set a variable only if it doesn't already exist.
EXAMPLES: >
TLet foo = 1
TLet foo = 2
echo foo
=> 1
<
*:TScratch*
:TScratch
Open a scratch buffer (a buffer without a file).
TScratch ... use split window
TScratch! ... use the whole frame
This command takes an (inner) dictionary as optional argument.
EXAMPLES: >
TScratch 'scratch': '__FOO__'
=> Open a scratch buffer named __FOO__
<
*:TVarArg*
:TVarArg VAR1, [VAR2, DEFAULT2] ...
A convenience wrapper for |tlib#arg#Let|.
EXAMPLES: >
function! Foo(...)
TVarArg ['a', 1], 'b'
echo 'a='. a
echo 'b='. b
endf
<
*:TKeyArg*
:TKeyArg DICT, VAR1, [VAR2, DEFAULT2] ...
A convenience wrapper for |tlib#arg#Let|.
EXAMPLES: >
function! Foo(keyargs)
TKeyArg a:keyargs, ['a', 1], 'b'
echo 'a='. a
echo 'b='. b
endf
<
*:TBrowseOutput*
:TBrowseOutput COMMAND
Ever wondered how to efficiently browse the output of a command
without redirecting it to a file? This command takes a command as
argument and presents the output via |tlib#input#List()| so that you
can easily search for a keyword (e.g. the name of a variable or
function) and the like.
If you press enter, the selected line will be copied to the command
line. Press ESC to cancel browsing.
EXAMPLES: >
TBrowseOutput 20verb TeaseTheCulprit
<
*:TBrowseScriptnames*
:TBrowseScriptnames
List all sourced script names (the output of ':scriptnames').
When you press enter, the selected script will be opened in the current
window. Press ESC to cancel.
EXAMPLES: >
TBrowseScriptnames
<
*:TTimeCommand*
:TTimeCommand CMD
Time the execution time of CMD.
Variables~
*g:tlib_pick_last_item*
g:tlib_pick_last_item (default: 1)
When 1, automatically select the last remaining item only if the list
had only one item to begin with.
When 2, automatically select a last remaining item after applying
any filters.
See |tlib#input#List()|.
*g:tlib_sortprefs_threshold*
g:tlib_sortprefs_threshold (default: 200)
If a list is bigger than this value, don't try to be smart when
selecting an item. Be slightly faster instead.
See |tlib#input#List()|.
*g:tlib_scratch_pos*
g:tlib_scratch_pos (default: 'botright')
Scratch window position. By default the list window is opened on the
bottom. Set this variable to 'topleft' or '' to change this behaviour.
See |tlib#input#List()|.
*g:tlib_inputlist_pct*
g:tlib_inputlist_pct (default: 50)
Size of the input list window (in percent) from the main size (of &lines).
See |tlib#input#List()|.
*g:tlib_inputlist_width_filename*
g:tlib_inputlist_width_filename (default: '&co / 3')
Size of filename columns when listing filenames.
See |tlib#input#List()|.
*g:tlib_inputlist_higroup*
g:tlib_inputlist_higroup (default: 'IncSearch')
The highlight group to use for showing matches in the input list
window.
See |tlib#input#List()|.
*g:tlib_inputlist_livesearch_threshold*
g:tlib_inputlist_livesearch_threshold (default: 1000)
If a list contains more items, |tlib#input#List()| does not perform an
incremental "live search" but uses |input()| to query the user for a
filter. This is useful on slower machines or with very long lists.
*g:tlib_inputlist_filename_indicators*
g:tlib_inputlist_filename_indicators (default: 0)
If true, |tlib#input#List()| will show some indicators about the
status of a filename (e.g. buflisted(), bufloaded() etc.).
This is disabled by default because vim checks also for the file on
disk when doing this.
*g:tlib_inputlist_match*
g:tlib_inputlist_match (default: 'cnfx')
Determine how |tlib#input#List()| and related functions work.
Can be "cnf", "cnfd", "cnfx", "seq", or "fuzzy". See:
cnfx ... Like cnfd but |g:tlib#Filter_cnfx#expander| is interpreted
as a wildcard (this is the default method)
- A plus character ("+") acts as a wildcard as if ".\{-}" (see
|/\{-|) were entered.
- Examples:
- "f+o" matches "fo", "fxo", and "fxxxoo", but doesn't match
"far".
- Otherwise it is a derivate of the cnf method (see below).
- See also |tlib#Filter_cnfx#New()|.
cnfd ... Like cnf but "." is interpreted as a wildcard, i.e. it is
expanded to "\.\{-}"
- A period character (".") acts as a wildcard as if ".\{-}" (see
|/\{-|) were entered.
- Examples:
- "f.o" matches "fo", "fxo", and "fxxxoo", but doesn't match
"far".
- Otherwise it is a derivate of the cnf method (see below).
- See also |tlib#Filter_cnfd#New()|.
cnf .... Match substrings
- A blank creates an AND conjunction, i.e. the next pattern has to
match too.
- A pipe character ("|") creates an OR conjunction, either this or
the next next pattern has to match.
- Patterns are very 'nomagic' |regexp| with a |\V| prefix.
- A pattern starting with "-" makes the filter exclude items
matching that pattern.
- Examples:
- "foo bar" matches items that contain the strings "foo" AND
"bar".
- "foo|bar boo|far" matches items that contain either ("foo" OR
"bar") AND ("boo" OR "far").
- See also |tlib#Filter_cnf#New()|.
seq .... Match sequences of characters
- |tlib#Filter_seq#New()|
fuzzy .. Match fuzzy character sequences
- |tlib#Filter_fuzzy#New()|
*g:tlib_inputlist_shortmessage*
g:tlib_inputlist_shortmessage (default: 0)
If not null, display only a short info about the filter.
*g:tlib_tags_extra*
g:tlib_tags_extra (default: '')
Extra tags for |tlib#tag#Retrieve()| (see there). Can also be buffer-local.
*g:tlib_tag_substitute*
g:tlib_tag_substitute
Filter the tag description through |substitute()| for these filetypes.
This applies only if the tag cmd field (see |taglist()|) is used.
*g:tlib_filename_sep*
g:tlib_filename_sep (default: '/')
*g:tlib_cache*
g:tlib_cache (default: '')
The cache directory. If empty, use |tlib#dir#MyRuntime|.'/cache'.
You might want to delete old files from this directory from time to
time with a command like: >
find ~/vimfiles/cache/ -atime +31 -type f -print -delete
<
*g:tlib_viewline_position*
g:tlib_viewline_position (default: 'zz')
Where to display the line when using |tlib#buffer#ViewLine|.
For possible values for position see |scroll-cursor|.
Keys for |tlib#input#List|~
*g:tlib_inputlist_and*
g:tlib_inputlist_and (default: ' ')
*g:tlib_inputlist_or*
g:tlib_inputlist_or (default: '|')
*g:tlib_inputlist_not*
g:tlib_inputlist_not (default: '-')
*g:tlib_numeric_chars*
g:tlib_numeric_chars
When editing a list with |tlib#input#List|, typing these numeric chars
(as returned by getchar()) will select an item based on its index, not
based on its name. I.e. in the default setting, typing a "4" will
select the fourth item, not the item called "4".
In order to make keys 0-9 filter the items in the list and make
<m-[0-9]> select an item by its index, remove the keys 48 to 57 from
this dictionary.
Format: [KEY] = BASE ... the number is calculated as KEY - BASE.
*g:tlib_keyagents_InputList_s*
g:tlib_keyagents_InputList_s
The default key bindings for single-item-select list views. If you
want to use <c-j>, <c-k> to move the cursor up and down, add these two
lines to after/plugin/02tlib.vim: >
let g:tlib_keyagents_InputList_s[10] = 'tlib#agent#Down' " <c-j>
let g:tlib_keyagents_InputList_s[11] = 'tlib#agent#Up' " <c-k>
<
*g:tlib_scroll_lines*
g:tlib_scroll_lines (default: 10)
Number of items to move when pressing <c-up/down> in the input list window.
*g:tlib_keyagents_InputList_m*
g:tlib_keyagents_InputList_m
*g:tlib_handlers_EditList*
g:tlib_handlers_EditList
*g:tlib_debug*
g:tlib_debug
========================================================================
autoload/tlib/notify.vim~
*tlib#notify#Echo()*
tlib#notify#Echo(text, ?style='')
Print text in the echo area. Temporarily disable 'ruler' and 'showcmd'
in order to prevent |press-enter| messages.
*tlib#notify#TrimMessage()*
tlib#notify#TrimMessage(message)
Contributed by Erik Falor:
If the line containing the message is too long, echoing it will cause
a 'Hit ENTER' prompt to appear. This function cleans up the line so
that does not happen.
The echoed line is too long if it is wider than the width of the
window, minus cmdline space taken up by the ruler and showcmd
features.
========================================================================
autoload/tlib/persistent.vim~
*g:tlib_persistent*
g:tlib_persistent (default: '')
The directory for persistent data files. If empty, use
|tlib#dir#MyRuntime|.'/share'.
*tlib#persistent#Dir()*
tlib#persistent#Dir(?mode = 'bg')
Return the full directory name for persistent data files.
*tlib#persistent#Filename()*
tlib#persistent#Filename(type, ?file=%, ?mkdir=0)
*tlib#persistent#Get()*
tlib#persistent#Get(cfile)
*tlib#persistent#Save()*
tlib#persistent#Save(cfile, dictionary)
========================================================================
autoload/tlib/vim.vim~
*g:tlib#vim#simalt_maximize*
g:tlib#vim#simalt_maximize (default: 'x')
The alt-key for maximizing the window.
CAUTION: The value of this paramter depends on your locale and
maybe the windows version you are running.
*g:tlib#vim#simalt_restore*
g:tlib#vim#simalt_restore (default: 'r')
The alt-key for restoring the window.
CAUTION: The value of this paramter depends on your locale and
maybe the windows version you are running.
*g:tlib#vim#use_vimtweak*
g:tlib#vim#use_vimtweak (default: 0)
If true, use the vimtweak.dll for windows. This will enable
tlib to remove the caption for fullscreen windows.
*tlib#vim#Maximize()*
tlib#vim#Maximize(fullscreen)
Maximize the window.
You might need to redefine |g:tlib#vim#simalt_maximize| if it doesn't
work for you.
*tlib#vim#RestoreWindow()*
tlib#vim#RestoreWindow()
Restore the original vimsize after having called |tlib#vim#Maximize()|.
*g:tlib#vim#use_wmctrl*
g:tlib#vim#use_wmctrl (default: executable('wmctrl'))
If true, use wmctrl for X windows to make a window
maximized/fullscreen.
This is the preferred method for maximizing windows under X
windows. Some window managers have problem coping with the
default method of setting 'lines' and 'columns' to a large
value.
========================================================================
autoload/tlib/progressbar.vim~
*tlib#progressbar#Init()*
tlib#progressbar#Init(max, ...)
EXAMPLE: >
call tlib#progressbar#Init(20)
try
for i in range(20)
call tlib#progressbar#Display(i)
call DoSomethingThatTakesSomeTime(i)
endfor
finally
call tlib#progressbar#Restore()
endtry
<
*tlib#progressbar#Display()*
tlib#progressbar#Display(value, ...)
*tlib#progressbar#Restore()*
tlib#progressbar#Restore()
========================================================================
autoload/tlib/eval.vim~
*tlib#eval#FormatValue()*
tlib#eval#FormatValue(value, ...)
========================================================================
autoload/tlib/list.vim~
*tlib#list#Inject()*
tlib#list#Inject(list, initial_value, funcref)
EXAMPLES: >
echo tlib#list#Inject([1,2,3], 0, function('Add')
=> 6
<
*tlib#list#Compact()*
tlib#list#Compact(list)
EXAMPLES: >
tlib#list#Compact([0,1,2,3,[], {}, ""])
=> [1,2,3]
<
*tlib#list#Flatten()*
tlib#list#Flatten(list)
EXAMPLES: >
tlib#list#Flatten([0,[1,2,[3,""]]])
=> [0,1,2,3,""]
<
*tlib#list#FindAll()*
tlib#list#FindAll(list, filter, ?process_expr="")
Basically the same as filter()
EXAMPLES: >
tlib#list#FindAll([1,2,3], 'v:val >= 2')
=> [2, 3]
<
*tlib#list#Find()*
tlib#list#Find(list, filter, ?default="", ?process_expr="")
EXAMPLES: >
tlib#list#Find([1,2,3], 'v:val >= 2')
=> 2
<
*tlib#list#Any()*
tlib#list#Any(list, expr)
EXAMPLES: >
tlib#list#Any([1,2,3], 'v:val >= 2')
=> 1
<
*tlib#list#All()*
tlib#list#All(list, expr)
EXAMPLES: >
tlib#list#All([1,2,3], 'v:val >= 2')
=> 0
<
*tlib#list#Remove()*
tlib#list#Remove(list, element)
EXAMPLES: >
tlib#list#Remove([1,2,1,2], 2)
=> [1,1,2]
<
*tlib#list#RemoveAll()*
tlib#list#RemoveAll(list, element)
EXAMPLES: >
tlib#list#RemoveAll([1,2,1,2], 2)
=> [1,1]
<
*tlib#list#Zip()*
tlib#list#Zip(lists, ?default='')
EXAMPLES: >
tlib#list#Zip([[1,2,3], [4,5,6]])
=> [[1,4], [2,5], [3,6]]
<
*tlib#list#Uniq()*
tlib#list#Uniq(list, ...)
========================================================================
autoload/tlib/cmd.vim~
*tlib#cmd#OutputAsList()*
tlib#cmd#OutputAsList(command)
*tlib#cmd#BrowseOutput()*
tlib#cmd#BrowseOutput(command)
See |:TBrowseOutput|.
*tlib#cmd#BrowseOutputWithCallback()*
tlib#cmd#BrowseOutputWithCallback(callback, command)
Execute COMMAND and present its output in a |tlib#input#List()|;
when a line is selected, execute the function named as the CALLBACK
and pass in that line as an argument.
The CALLBACK function gives you an opportunity to massage the COMMAND output
and possibly act on it in a meaningful way. For example, if COMMAND listed
all URIs found in the current buffer, CALLBACK could validate and then open
the selected URI in the system's default browser.
This function is meant to be a tool to help compose the implementations of
powerful commands that use |tlib#input#List()| as a common interface. See
|TBrowseScriptnames| as an example.
EXAMPLES: >
call tlib#cmd#BrowseOutputWithCallback('tlib#cmd#ParseScriptname', 'scriptnames')
<
*tlib#cmd#DefaultBrowseOutput()*
tlib#cmd#DefaultBrowseOutput(cmd)
*tlib#cmd#ParseScriptname()*
tlib#cmd#ParseScriptname(line)
*tlib#cmd#UseVertical()*
tlib#cmd#UseVertical(?rx='')
Look at the history whether the command was called with vertical. If
an rx is provided check first if the last entry in the history matches
this rx.
*tlib#cmd#Time()*
tlib#cmd#Time(cmd)
Print the time in seconds or milliseconds (if your version of VIM
has |+reltime|) a command takes.
========================================================================
autoload/tlib/syntax.vim~
*tlib#syntax#Collect()*
tlib#syntax#Collect()
*tlib#syntax#Names()*
tlib#syntax#Names(?rx='')
========================================================================
autoload/tlib/balloon.vim~
*tlib#balloon#Register()*
tlib#balloon#Register(expr)
*tlib#balloon#Remove()*
tlib#balloon#Remove(expr)
*tlib#balloon#Expr()*
tlib#balloon#Expr()
========================================================================
autoload/tlib/vcs.vim~
*g:tlib#vcs#def*
g:tlib#vcs#def {...}
A dictionarie of supported VCS (currently: git, hg, svn, bzr).
*g:tlib#vcs#executables*
g:tlib#vcs#executables {...}
A dictionary of custom executables for VCS commands. If the value is
empty, support for that VCS will be removed. If no key is present, it
is assumed that the VCS "type" is the name of the executable.
*g:tlib#vcs#check*
g:tlib#vcs#check (default: has('win16') || has('win32') || has('win64') ? '%s.exe' : '%s')
If non-empty, use it as a format string to check whether a VCS is
installed on your computer.
*tlib#vcs#FindVCS()*
tlib#vcs#FindVCS(filename)
*tlib#vcs#Ls()*
tlib#vcs#Ls(?filename=bufname('%'), ?vcs=[type, dir])
Return the files under VCS.
*tlib#vcs#Diff()*
tlib#vcs#Diff(filename, ?vcs=[type, dir])
Return the diff for "filename"
========================================================================
autoload/tlib/char.vim~
*tlib#char#Get()*
tlib#char#Get(?timeout=0)
Get a character.
EXAMPLES: >
echo tlib#char#Get()
echo tlib#char#Get(5)
<
*tlib#char#IsAvailable()*
tlib#char#IsAvailable()
*tlib#char#GetWithTimeout()*
tlib#char#GetWithTimeout(timeout, ...)
========================================================================
autoload/tlib/scratch.vim~
*tlib#scratch#UseScratch()*
tlib#scratch#UseScratch(?keyargs={})
Display a scratch buffer (a buffer with no file). See :TScratch for an
example.
Return the scratch buffer's number.
Values for keyargs:
scratch_split ... 1: split, 0: window, -1: tab
*tlib#scratch#CloseScratch()*
tlib#scratch#CloseScratch(keyargs, ...)
Close a scratch buffer as defined in keyargs (usually a World).
Return 1 if the scratch buffer is closed (or if it already was
closed).
========================================================================
autoload/tlib/autocmdgroup.vim~
*tlib#autocmdgroup#Init()*
tlib#autocmdgroup#Init()
========================================================================
autoload/tlib/cache.vim~
*g:tlib#cache#purge_days*
g:tlib#cache#purge_days (default: 31)
|tlib#cache#Purge()|: Remove cache files older than N days.
*g:tlib#cache#purge_every_days*
g:tlib#cache#purge_every_days (default: 31)
Purge the cache every N days. Disable automatic purging by setting
this value to a negative value.
*g:tlib#cache#script_encoding*
g:tlib#cache#script_encoding (default: &enc)
The encoding used for the purge-cache script.
Default: 'enc'
*g:tlib#cache#run_script*
g:tlib#cache#run_script (default: 1)
Whether to run the directory removal script:
0 ... No
1 ... Query user
2 ... Yes
*g:tlib#cache#silent*
g:tlib#cache#silent (default: 0)
If non-nil, don't display a message that files were deleted from the
cache.
*g:tlib#cache#dont_purge*
g:tlib#cache#dont_purge (default: ['[\/]\.last_purge$'])
A list of regexps that are matched against partial filenames of the
cached files. If a regexp matches, the file won't be removed by
|tlib#cache#Purge()|.
*tlib#cache#Dir()*
tlib#cache#Dir(?mode = 'bg')
The default cache directory.
*tlib#cache#Filename()*
tlib#cache#Filename(type, ?file=%, ?mkdir=0, ?dir='')
*tlib#cache#Save()*
tlib#cache#Save(cfile, dictionary)
*tlib#cache#Get()*
tlib#cache#Get(cfile)
*tlib#cache#MaybePurge()*
tlib#cache#MaybePurge()
Call |tlib#cache#Purge()| if the last purge was done before
|g:tlib#cache#purge_every_days|.
*tlib#cache#Purge()*
tlib#cache#Purge()
Delete old files.
*tlib#cache#ListFilesInCache()*
tlib#cache#ListFilesInCache(...)
========================================================================
autoload/tlib/normal.vim~
*tlib#normal#WithRegister()*
tlib#normal#WithRegister(cmd, ?register='t', ?norm_cmd='norm!')
Execute a normal command while maintaining all registers.
========================================================================
autoload/tlib/time.vim~
*tlib#time#MSecs()*
tlib#time#MSecs()
*tlib#time#Now()*
tlib#time#Now()
*tlib#time#Diff()*
tlib#time#Diff(a, b, ...)
*tlib#time#DiffMSecs()*
tlib#time#DiffMSecs(a, b, ...)
========================================================================
autoload/tlib/var.vim~
*tlib#var#Let()*
tlib#var#Let(name, val)
Define a variable called NAME if yet undefined.
You can also use the :TLLet command.
EXAMPLES: >
exec tlib#var#Let('g:foo', 1)
TLet g:foo = 1
<
*tlib#var#EGet()*
tlib#var#EGet(var, namespace, ?default='')
Retrieve a variable by searching several namespaces.
EXAMPLES: >
let g:foo = 1
let b:foo = 2
let w:foo = 3
echo eval(tlib#var#EGet('foo', 'vg')) => 1
echo eval(tlib#var#EGet('foo', 'bg')) => 2
echo eval(tlib#var#EGet('foo', 'wbg')) => 3
<
*tlib#var#Get()*
tlib#var#Get(var, namespace, ?default='')
Retrieve a variable by searching several namespaces.
EXAMPLES: >
let g:foo = 1