-
-
Notifications
You must be signed in to change notification settings - Fork 487
/
Copy pathtagbar.txt
2311 lines (1969 loc) · 96.7 KB
/
tagbar.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
*tagbar.txt* Display tags of a file ordered by scope
Author: Jan Larres <[email protected]>
Licence: Vim licence, see |license|
Homepage: https://preservim.github.io/tagbar
Version: 3.1.1
==============================================================================
Contents *tagbar* *tagbar-contents*
1. Intro ........................... |tagbar-intro|
Pseudo-tags ................... |tagbar-pseudotags|
Supported features ............ |tagbar-features|
Other ctags-compatible programs |tagbar-other|
2. Requirements .................... |tagbar-requirements|
3. Installation .................... |tagbar-installation|
4. Usage ........................... |tagbar-usage|
Commands ...................... |tagbar-commands|
Key mappings .................. |tagbar-keys|
5. Configuration ................... |tagbar-configuration|
Highlight colours ............. |tagbar-highlight|
Automatically opening Tagbar .. |tagbar-autoopen|
Show current tag in statusline |tagbar-statusline|
Ignoring specific files ....... |tagbar-ignore|
6. Extending Tagbar ................ |tagbar-extend|
7. Troubleshooting & Known issues .. |tagbar-issues|
8. History ......................... |tagbar-history|
9. Todo ............................ |tagbar-todo|
10. Credits ......................... |tagbar-credits|
==============================================================================
1. Intro *tagbar-intro*
Tagbar is a plugin for browsing the tags of source code files. It provides a
sidebar that displays the ctags-generated tags of the current file, ordered by
their scope. This means that for example methods in C++ are displayed under
the class they are defined in.
Let's say we have the following code inside of a C++ file:
>
namespace {
char a;
class Foo
{
public:
Foo();
~Foo();
private:
int var;
};
};
<
Then Tagbar would display the tag information like so:
>
__anon1* : namespace
Foo : class
+Foo()
+~Foo()
-var
a
<
This example shows several important points. First, the tags are listed
indented below the scope they are defined in. Second, the type of a scope is
listed after its name and a colon. Third, tags for which the visibility
information is known are prefixed with a symbol indicating that.
------------------------------------------------------------------------------
PSEUDO-TAGS *tagbar-pseudotags*
The example also introduces the concept of "pseudo-tags". Pseudo-tags are tags
that are not explicitly defined in the file but have children in it. In this
example the namespace doesn't have a name and thus ctags doesn't generate a
tag for it, but since it has children it still needs to be displayed using an
auto-generated name.
Another case where pseudo-tags appear is in C++ implementation files. Since
classes are usually defined in a header file but the member methods and
variables are in the implementation file the class itself won't generate a tag
in that file.
Since pseudo-tags don't really exist they cannot be jumped to from the Tagbar
window.
Pseudo-tags are denoted with an asterisk ('*') at the end of their name.
------------------------------------------------------------------------------
SUPPORTED FEATURES *tagbar-features*
The following features are supported by Tagbar:
- Display tags under their correct scope.
- Automatically update the tags when switching between buffers and editing
files.
- Display visibility information of tags if available.
- Highlight the tag near the cursor while editing files.
- Jump to a tag from the Tagbar window.
- Display the complete prototype of a tag.
- Tags can be sorted either by name or order of appearance in the file.
- Scopes can be folded to hide uninteresting information.
- Supports all of the languages that ctags does, i.e. Ant, Assembler, ASP,
Awk, Basic, BETA, C, C++, C#, COBOL, DosBatch, Eiffel, Erlang, Flex,
Fortran, HTML, Java, JavaScript, Lisp, Lua, Make, MatLab, OCaml, Pascal,
Perl, PHP, Python, REXX, Ruby, Scheme, Shell script, SLang, SML, SQL, Tcl,
Tex, Vera, Verilog, VHDL, Vim and YACC.
- Additional languages are supported through universal-ctags, including
CUDA, R, Rust, Go, and many others. See
https://github.com/universal-ctags/ctags/blob/master/docs/news.rst#new-parsers
for the complete list.
- Can be extended to support arbitrary new types.
------------------------------------------------------------------------------
OTHER CTAGS-COMPATIBLE PROGRAMS *tagbar-other*
Tagbar also supports filetype-specific programs that can produce
ctags-compatible output, as long as these programs can write to the standard
output. Tagbar has been tested with doctorjs/jsctags and will use that if
present, other programs require some configuration (see |tagbar-extend|). If a
program does not work even with correct configuration please contact me.
Note: Please check |tagbar-issues| for some potential issues with jsctags.
==============================================================================
2. Requirements *tagbar-requirements*
The following requirements have to be met in order to be able to use tagbar:
- Vim 7.0 or higher. Older versions will not work since Tagbar uses data
structures that were only introduced in Vim 7.
- At a minimum Exuberant Ctags >= 5.5, or (highly recommended) any version
of Universal Ctags which is a currently maintained fork of Exuberant Ctags
with many bugfixes, support for many more formats, and proper Unicode
support. Some additional formats can also be handled by other providers
such as jsctags, phpctags, or others.
Universal Ctags can be downloaded from https://ctags.io/
Tagbar will work on any platform that ctags runs on -- this includes
UNIX derivatives, Mac OS X and Windows. Note that other versions like
BSD ctags will not work.
Tagbar generates the tag information by itself and doesn't need (or use)
already existing tag files.
- File type detection must be turned on in vim. This can be done with the
following command in your vimrc:
>
filetype on
<
See |filetype| for more information.
- Tagbar will not work in |restricted-mode| or with 'compatible' set.
==============================================================================
3. Installation *tagbar-installation*
Use the normal Vimball install method for installing tagbar.vba:
>
vim tagbar.vba
:so %
:q
<
Alternatively you can clone the git repository and then add the path to
'runtimepath' or use the pathogen plugin. Don't forget to run |:helptags|.
If the ctags executable is not installed in one of the directories in your
$PATH environment variable you have to set the g:tagbar_ctags_bin variable,
see |g:tagbar_ctags_bin|.
==============================================================================
4. Usage *tagbar-usage*
There are essentially two ways to use Tagbar:
1. Have it running all the time in a window on the side of the screen. In
this case Tagbar will update its contents whenever the source file is
changed and highlight the tag the cursor is currently on in the file. If
a tag is selected in Tagbar the file window will jump to the tag and the
Tagbar window will stay open. |g:tagbar_autoclose| has to be unset for
this mode.
2. Only open Tagbar when you want to jump to a specific tag and have it
close automatically once you have selected one. This can be useful for
example for small screens where a permanent window would take up too much
space. You have to set the option |g:tagbar_autoclose| in this case. The
cursor will also automatically jump to the Tagbar window when opening it.
Opening and closing the Tagbar window~
Use |:TagbarOpen| or |:TagbarToggle| to open the Tagbar window if it is
closed. By default the window is opened on the right side, set the option
|g:tagbar_position| to open it elsewhere instead. If the window is already open,
|:TagbarOpen| will jump to it and |:TagbarToggle| will close it again.
|:TagbarClose| will simply close the window if it is open.
It is probably a good idea to assign a key to these commands. For example, put
this into your |vimrc|:
>
nnoremap <silent> <F8> :TagbarToggle<CR>
<
You can then open and close Tagbar by simply pressing the <F8> key.
You can also use |:TagbarOpenAutoClose| to open the Tagbar window, jump to it
and have it close automatically on tag selection regardless of the
|g:tagbar_autoclose| setting.
Pausing the Tagbar window~
Use |:TagbarTogglePause| to toggle freezing/locking the Tagbar window on its
currently displayed file. Freezing the window stops the Tagbar contents from
changing when switching to a different source file. All Tagbar functionality
continues to work as expected. Unfreezing the window will cause it to load the
current source file.
Jumping to tags~
When you're inside the Tagbar window you can jump to the definition of a tag
by moving the cursor to a tag and pressing <Enter> or double-clicking on it
with the mouse. The source file will then move to the definition and put the
cursor in the corresponding line. This won't work for pseudo-tags.
If the current line of the tagbar window is not on a tag, for example on the
'functions' tag-kind and <Enter> is hit, then that tag-kind will be folded or
unfolded if possible.
Sorting~
You can sort the tags in the Tagbar window in two ways: by name or by file
order. Sorting them by name simply displays the tags in their alphabetical
order under their corresponding scope. Sorting by file order means that the
tags keep the order they have in the source file, but are still associated
with the correct scope. You can change the sort order by pressing the "s" key
in the Tagbar window. The current sort order is displayed in the statusline of
the Tagbar window.
Folding~
The displayed scopes (and unscoped types) can be folded to hide uninteresting
information. Mappings similar to Vim's built-in ones are provided. Folds can
also be opened and closed by clicking on the fold icon with the mouse.
Highlighting the current tag~
When the Tagbar window is open the current tag will automatically be
highlighted in it after a short pause if the cursor is not moving. The length
of this pause is determined by the 'updatetime' option. If you want to make
that pause shorter you can change the option, but don't set it too low or
strange things will happen. This is unfortunately unavoidable.
Displaying the prototype of a tag~
Tagbar can display the prototype of a tag. More precisely it can display the
line(s) in which the tag is defined. This can be done by either pressing
<Space> when on a tag or hovering over a tag with the mouse. In the former
case the prototype will be displayed in the |Command-line|, in the latter case
it will be displayed in a pop-up window. The prototype will also be displayed
if the cursor stays on a tag for 'updatetime' milliseconds. In that case the
prototype may be abbreviated in order to avoid |hit-enter| prompts.
------------------------------------------------------------------------------
COMMANDS *tagbar-commands*
:TagbarOpen [{flags}] *:TagbarOpen*
Open the Tagbar window if it is closed.
Additional behaviour can be specified with the optional {flags} argument.
It is a string which can contain these character flags:
'f' Jump to Tagbar window when opening (just as if |g:tagbar_autofocus|
were set to 1)
'j' Jump to Tagbar window if already open
'c' Close Tagbar on tag selection (just as if |g:tagbar_autoclose| were
set to 1, but doesn't imply 'f'), but only if the Tagbar window was
opened using this command. If this is used the "c" flag will be
shown in the statusline of the Tagbar window.
For example, the following command would always jump to the Tagbar window,
opening it first if necessary, but keep it open after selecting a tag
(unless |g:tagbar_autoclose| is set): >
:TagbarOpen fj
<
:TagbarClose *:TagbarClose*
Close the Tagbar window if it is open.
:TagbarToggle [{flags}] *:TagbarToggle*
:Tagbar [{flags}]
Open the Tagbar window if it is closed, or close it if it is open.
Additional behaviour can be specified with the same optional {flags}
argument as :TagbarOpen.
:TagbarOpenAutoClose *:TagbarOpenAutoClose*
Open the Tagbar window, jump to it and close it on tag selection. This is
an alias for ":TagbarOpen fjc".
:TagbarTogglePause *:TagbarTogglePause*
Freezes/Unfreezes the Tagbar window. Stops the contents of the window
from changing when a different source file is selected.
:TagbarSetFoldlevel[!] {number} *:TagbarSetFoldlevel*
Set the foldlevel of the tags of the current file to {number}. The
foldlevel of tags in other files remains unaffected. Works in the same way
as 'foldlevel'. Folds that are specified to be closed by default in the
type configuration will not be opened, use a "!" to force applying the new
foldlevel to those folds as well.
:TagbarShowTag *:TagbarShowTag*
Open the parent folds of the current tag in the file window as much as
needed for the tag to be visible in the Tagbar window.
:TagbarCurrentTag [{flags} [{search-method}]] *:TagbarCurrentTag*
Echo the current tag in the command line. For {flags} and {search-method}
see |tagbar-statusline|.
:TagbarGetTypeConfig {filetype} *:TagbarGetTypeConfig*
Paste the Tagbar configuration of the vim filetype {filetype} at the
current cursor position (provided that filetype is supported by Tagbar)
for easy customization. The configuration will be ready to use as is but
will only contain the "kinds" entry as that is the only one that really
makes sense to customize. See |tagbar-extend| for more information about
type configurations.
:TagbarDebug [logfile] *:TagbarDebug*
Start debug mode. This will write debug messages to file [logfile] while
using Tagbar. If no argument is given "tagbardebug.log" in the current
directory is used. Note: an existing file will be overwritten!
Note also that it is usually necessary to call this command before loading
a file that creates problems in order to get all of the needed data.
:TagbarDebugEnd *:TagbarDebugEnd*
End debug mode, debug messages will no longer be written to the logfile.
:TagbarForceUpdate *:TagbarForceUpdate*
Forcefully update a file even if it exceeds the |g:tagbar_file_size_limit|
value. This will only work for one invocation of the file processing.
After the file is processed and tags are generated, then it will re-enable
the file size limit. So if the file is written and needs to be processed
again, this command will need to be re-executed.
:TagbarJump *:TagbarJump*
Jump to the tag under the cursor. This only works while the cursor is in
the tagbar window. This will leave the cursor in the tagbar window. It is
the same behavior as the |p| key mapping.
This command will call the |tagbar#jump()| function.
:TagbarJumpPrev *:TagbarJumpPrev*
Jump to the previous tag under the cursor. This works in the file window.
This will search for the previous {'nearest-stl'} type tag starting at the
line just before the current line and do a backwards search.
This command will call the |tagbar#jumpToNearbyTag(-1)| function.
:TagbarJumpNext *:TagbarJumpNext*
Jump to the next tag under the cursor. This works in the file window.
This will search for the next {'nearest-stl'} type tag starting at the
line just after the current line and do a forward search.
This command will call the |tagbar#jumpToNearbyTag(1)| function.
------------------------------------------------------------------------------
FUNCTIONS *tagbar-functions*
*tagbar#StopAutoUpdate()*
Remove autocommands that might have been installed to automatically
update tag information. This should be called after you have used
|tagbar#currenttag| manually.
*tagbar#GetTagNearLine()*
Get the current tag near the specified line number (lnum). Optionally
takes a fmt and signature specification using the same method as the
|tagbar#currenttag()| function. Defaults to GetTagNearLine(lnum, '%s', '').
This could be used in a custom foldtext function to show the current tag
the fold current fold is located in.
This function can also take in a search method similar to the
|tagbar#currenttag()| function. Full syntax is as follows:
tagbar#GetTagNearLine(lnum [, {fmt}, {flags} [, {search-method}]])
Example: >
set foldtext=MyFoldFunc()
function! MyFoldFunc()
let tag = tagbar#GetTagNearLine(v:foldend, '%s', 'p')
let lines = v:foldend - v:foldstart + 1
return tag . ' --- ' . lines . ' lines'
endfunction
<
*tagbar#ForceUpdate()*
Forcefully update a file even if it exceeds the |g:tagbar_file_size_limit|
value. This also clears the internal flags to the file will be re-examined
again.
*tagbar#printfileinfo()*
This function is used in conjunction with |TagbarDebug| and will print all
the known tags into the tagbar debug logfile. This is useful for looking
at the internal tag information that tagbar tracks.
*tagbar#IsOpen()*
This function will return 1 if the tagbar window is open, else it will
return 0.
*tagbar#jump()*
Jump to the tag under the cursor. This only works while the cursor is in
the tagbar window. This will leave the cursor in the tagbar window. It is
the same behavior as the |p| key mapping.
This is the function called when using the |:TagbarJump| command.
*tagbar#jumpToNearbyTag()*
This function will jump to the next tag or previous tag starting a search
from the line under the cursor. This works when in the file window instead
of inside the tagbar window like the |tagbar#jump()| function.
The direction of search must be provided. If the [direction] is greater
than 0, then it will do a forward search. If the [direction] is less
than 0, then it will do a backward search.
Can also optionally provide a [search_method] which is used in the
|tagbar#GetTagNearLine()| function call and behaves the same way. This
will default to *'nearest-stl'* if not specified.
Can optionally provide a flags field [flags] to control the nearby tag
jumping. The flags should be a string of characters with the following
meanings:
's' - use the |g:tagbar_scroll_off| setting when jumping
Full syntax:
tagbar#jumpToNearbyTag(direction [, {search-method} [, {flags}]])
Examples:
>
" These keymaps will jump to the next/prev tag that can be scoped. Ex:
" function calls, class definitions, etc.
nnoremap t] :call tagbar#jumpToNearbyTag(1)
nnoremap t[ :call tagbar#jumpToNearbyTag(-1)
" These keymaps will jump to the next/prev tag regardless of type. Ex:
" function calls, class definitions, variable definitions, typedefs, etc.
nnoremap t] :call tagbar#jumpToNearbyTag(1, 'nearest')
nnoremap t[ :call tagbar#jumpToNearbyTag(-1, 'nearest')
" These keymaps will jump to the next/prev tag regardless of type, and
" will also use the jump_offset configuration to position the cursor
nnoremap t] :call tagbar#jumpToNearbyTag(1, 'nearest', 's')
nnoremap t[ :call tagbar#jumpToNearbyTag(-1, 'nearest', 's')
<
------------------------------------------------------------------------------
KEY MAPPINGS *tagbar-keys*
The following mappings are valid in the Tagbar window:
<F1>/? Display key mapping help.
Map option: |tagbar_map_help|
<CR>/<Enter> Jump to the tag under the cursor. Doesn't work for pseudo-tags.
If on generic header, it will fold/unfold that header.
Map option: |tagbar_map_jump|
p Jump to the tag under the cursor, but stay in the Tagbar window.
Map option: |tagbar_map_preview|
P Open the tag in a |preview-window|.
Map option: |tagbar_map_previewwin|
<LeftMouse> When on a fold icon, open or close the fold depending on the
current state.
<2-LeftMouse> Same as <CR>. See |g:tagbar_singleclick| if you want to use a
single- instead of a double-click.
<C-N> Go to the next top-level tag.
Map option: |tagbar_map_nexttag|
<C-P> Go to the previous top-level tag.
Map option: |tagbar_map_prevtag|
<Space> Display the prototype of the current tag (i.e. the line defining
it) in the command line.
Map option: |tagbar_map_showproto|
v Hide tags that are declared non-public. Tags without any
visibility information will still be shown.
Map option: |tagbar_map_hidenonpublic|
+/zo Open the fold under the cursor.
Map option: |tagbar_map_openfold|
-/zc Close the fold under the cursor or the current one if there is
no fold under the cursor.
Map option: |tagbar_map_closefold|
o/za Toggle the fold under the cursor or the current one if there is
no fold under the cursor.
Map option: |tagbar_map_togglefold|
*/zR Open all folds by setting foldlevel to 99.
Map option: |tagbar_map_openallfolds|
=/zM Close all folds by setting foldlevel to 0.
Map option: |tagbar_map_closeallfolds|
zr Increase the fold level of the buffer by 1. Opens all folds one
level.
Map option: |tagbar_map_incrementfolds|
zm Decrease the fold level of the buffer by 1. Closes all folds one
level.
Map option: |tagbar_map_decrementfolds|
zj Go to the start of the next fold, like the standard Vim |zj|.
Map option: |tagbar_map_nextfold|
zk Go to the end of the previous fold, like the standard Vim |zk|.
Map option: |tagbar_map_prevfold|
s Toggle sort order between name and file order.
Map option: |tagbar_map_togglesort|
c Toggle the |g:tagbar_autoclose| option.
Map option: |tagbar_map_toggleautoclose|
t Toggle the pause (like :TagbarTogglePause)
Map option: |tagbar_map_togglepause|
x Toggle zooming the window.
Map option: |tagbar_map_zoomwin|
q Close the Tagbar window.
Map option: |tagbar_map_close|
These mappings can be redefined with the given map options. The argument can
be either a string or a |List| of strings. In the latter case the
functionality will be assigned to all of the keys in the list.
For example, if you want to remap the sort toggling functionality to "r":
>
let g:tagbar_map_togglesort = "r"
<
Alternatively, if you want to disable this mapping, then set to '':
>
let g:tagbar_map_togglesort = ''
<
See |key-notation| for how to write special keys like <Space> or the keypad
keys.
==============================================================================
5. Configuration *tagbar-configuration*
*g:tagbar_ctags_bin*
g:tagbar_ctags_bin~
Default: empty
Use this option to specify the location of your ctags executable. Only needed
if it is not in one of the directories in your $PATH environment variable.
Example:
>
let g:tagbar_ctags_bin = 'C:\Ctags5.8\ctags.exe'
<
*g:tagbar_ctags_options*
g:tagbar_ctags_options
Default: undefined
Use this option to specify a list of filenames to pass to ctags with the
'--options' flag. This is similar to the deffile key for tagbar type
extensions, see |tagbar-extend|, but acts globally. The special value 'NONE'
as the first entry disables reading of the default configuration files (e.g.
~/.ctags). Without this, if ~/.ctags and other files listed in
g:tagbar_ctags_options include some of the same patterns, tagbar might show
duplicate entries.
Example:
>
let g:tagbar_ctags_options = ['NONE', split(&rtp,",")[0].'/ctags.cnf']
This causes ctags to use settings from ~/.vim/ctags.cnf, ignoring other
configuration files.
*g:tagbar_position*
g:tagbar_position~
Default: 'botright vertical'
By default the Tagbar window will be opened on the right-hand side of vim in a
vertical split. Set this option to one of the standart vim split options such
as 'topleft', 'botright', 'leftabove', or 'rightbelow' to open in the
corresponding position instead. If desiring a vertically split window, then
include a ' vertical' in the field value as well. This can be useful when
activating Tagbar at the same time as another plugin which creates a new
window. It allows for more granular control of the Tagbar position in
relation to the current active window.
If using a vertical split, |g:tagbar_width| will be used to determine the
window width for the tagbar window. Else |g:tagbar_height| will be used to
determine the window height for the tagbar window.
See |split| for more details on window positioning.
Example:
>
let g:tagbar_position = 'leftabove'
<
*g:tagbar_left*
g:tagbar_left~
Default: 0
This option has been superceded by |g:tagbar_position| instead. It has been left
around for backward compatibility.
By default the Tagbar window will be opened on the right-hand side of vim. Set
this option to open it on the left instead.
If |g:tagbar_vertical| is used then setting this variable will open the Tagbar
window at the top, otherwise it will open at the bottom.
Example:
>
let g:tagbar_left = 1
<
*g:tagbar_vertical*
g:tagbar_vertical~
Default: 0
This option has been superceded by |g:tagbar_height| instead. It has been left
around for backward compatibility.
If this is set to a positive value then the Tagbar window will be opened at
the top or bottom of the Vim window instead of at the side. This can be useful
for monitors that have been rotated into a vertical position. The value of
this variable will determine the number of lines to use for the Tagbar window.
See |g:tagbar_left| for configuring the position of the window.
Example:
>
let g:tagbar_vertical = 30
<
*g:tagbar_height*
g:tagbar_height~
Default: 0
If |g:tagbar_position| does not include a 'vertical' option, then this
value is used to determine the height of the Tagbar window.
Example:
>
let g:tagbar_height = 30
<
*g:tagbar_width*
g:tagbar_width~
Default: 40
If |g:tagbar_position| does include a 'vertical' options, then this value is
used to determine the width of the Tagbar window in characters. This value can
also be set using the |winwidth(0)| function call to calculate a dynamic value
to make the tagbar width relative to a percentage of the vim window size as
seen in the example below that will open the tagbar window to 20 percent of
the window width with a limit of no less than 25 characters.
Example:
>
let g:tagbar_width = max([25, winwidth(0) / 5])
<
*g:tagbar_zoomwidth*
g:tagbar_zoomwidth~
Default: 1
Width of the Tagbar window when zoomed.
Possible values are:
1: Use the maximum width available.
0: Use the width of the longest currently visible tag.
>1: Use this width in characters.
Example:
>
let g:tagbar_zoomwidth = 0
<
*g:tagbar_autoclose*
g:tagbar_autoclose~
Default: 0
If you set this option the Tagbar window will automatically close when you
jump to a tag. This implies |g:tagbar_autofocus|. If enabled the "C" flag will
be shown in the statusline of the Tagbar window. This can also be toggled with
a key, see |tagbar-keys|.
Example:
>
let g:tagbar_autoclose = 1
<
*g:tagbar_autoclose_netrw*
g:tagbar_autoclose_netrw~
Default: 0
This option is used to control the behavior when tagbar is the last window
open, but the netrw (or nerdtree) window is also open. If this value is set to
1, that will indicate that vim should be closed if tagbar and netrw are the
last windows open. If you set this to 0 and tagbar and the netrw (or nerdtree)
windows are the only remaining windows, then it will still close the tagbar
window, however it will leave vim open with the netrw (or nerdtree) window
open.
Example:
>
let g:tagbar_autoclose_netrw = 1
<
*g:tagbar_autofocus*
g:tagbar_autofocus~
Default: 0
If you set this option the cursor will move to the Tagbar window when it is
opened.
Example:
>
let g:tagbar_autofocus = 1
<
*g:tagbar_sort*
g:tagbar_sort~
Default: 1
If this option is set the tags are sorted according to their name. If it is
unset they are sorted according to their order in the source file. Note that
in the second case Pseudo-tags are always sorted before normal tags of the
same kind since they don't have a real position in the file.
Example:
>
let g:tagbar_sort = 0
<
*g:tagbar_case_insensitive*
g:tagbar_case_insensitive~
Default: 0
If this option is set a case-insensitive comparison is used when the tags
are sorted according to their name. If it is unset a case-sensitive
comparison is used.
Example:
>
let g:tagbar_case_insensitive = 1
<
*g:tagbar_compact*
g:tagbar_compact~
Default: 0
Setting this option will result in Tagbar omitting the short help at the
top of the window and the blank lines in between top-level scopes in order to
save screen real estate.
Possible values are:
0: Show short help and blank lines between top-level scopes
1: Don't show the short help or the blank lines.
2: Don't show the short help but show the blank lines.
Example:
>
let g:tagbar_compact = 1
<
*g:tagbar_help_visibility*
g:tagbar_help_visibility~
Default: 0
Setting this option will cause the full help information to be displayed all
the time in the tagbar window.
>
let g:tagbar_help_visibility = 1
<
*g:tagbar_indent*
g:tagbar_indent~
Default: 2
The number of spaces by which each level is indented. This allows making the
display more compact or more spacious.
Example:
>
let g:tagbar_indent = 1
<
*g:tagbar_show_balloon*
g:tagbar_show_balloon~
Default: 1
Whether balloon messages should be shown in the Tagbar window.
Possible values are:
0: Don't show any balloon messages.
1: Show balloon messages. This is only available in the GUI when
compiled with the |+balloon_eval| feature.
Example:
>
let g:tagbar_show_balloon = 0
<
*g:tagbar_show_data_type*
g:tagbar_show_data_type~
Default: 0
When set to non-zero, the tag data-type will be displayed to the right of the
tag in the tagbar window.
Example:
>
let g:tagbar_show_data_type = 1
<
*g:tagbar_show_visibility*
g:tagbar_show_visibility~
Default: 1
Show the visibility symbols (public/protected/private) to the left of the tag
name.
Example:
>
let g:tagbar_show_visibility = 0
<
*g:tagbar_visibility_symbols*
g:tagbar_visibility_symbols
Default: { 'public' : '+', 'protected' : '#', 'private' : '-' }
Symbols to use for visibility (public/protected/private) to the left of the tag
name. See |g:tagbar_show_visibility|.
Example:
>
let g:tagbar_visibility_symbols = {
\ 'public' : '+',
\ 'protected' : '#',
\ 'private' : '-'
\ }
<
*g:tagbar_show_linenumbers*
g:tagbar_show_linenumbers~
Default: 0
Whether line numbers should be shown in the Tagbar window.
Possible values are:
0: Don't show any line numbers.
1: Show absolute line numbers.
2: Show relative line numbers.
-1: Use the global line number settings.
Example:
>
let g:tagbar_show_linenumbers = 2
<
*g:tagbar_show_prefix*
g:tagbar_show_prefix~
Default: 1
Controls if the prefix information is shown before the tag. The prefix info is
usually defined as the variable scope. For example, if a variable is private
scope only, then a '-' symbol will be used by default.
Possible values are:
0: Don't show the prefix.
1: Show the prefix.
Example:
>
let g:tagbar_show_prefix = 0
<
*g:tagbar_show_suffix*
g:tagbar_show_suffix~
Default: 1
Controls if the suffix information is shown after the tag. The suffix info is
usually data type.
Possible values are:
0: Don't show the suffix.
1: Show the suffix.
Example:
>
let g:tagbar_show_suffix = 0
<
*g:tagbar_show_tag_linenumbers*
g:tagbar_show_tag_linenumbers~
Default: 0
This option allows printing the tag line number next to the tag in the tagbar
window. It can be set to the following values:
0 - The line number will not be printed
1 - The line number will be printed to the right of the tag >
Example: function1(int i) [123]
<
2 - The line number will be printed to the left of the tag >
Example: [123] function1(int i)
<
Example:
>
let g:tagbar_show_tag_linenumbers = 1
<
*g:tagbar_show_tag_count*
g:tagbar_show_tag_count~
Default: 0
This option allows showing the tag count next to the tag kind in the tagbar
window. This will show up like this >
> functions (<tag-count>)
<
Example:
>
let g:tagbar_show_tag_count = 1
<
*g:tagbar_hide_nonpublic*
g:tagbar_hide_nonpublic~
Default: 0
Hide tags that are declared non-public. Tags without any visibility
information will still be shown. If enabled the "v" flag will be shown in the
statusline of the Tagbar window. This can also be toggled with a key, see
|tagbar-keys|.
Example:
>
let g:tagbar_hide_nonpublic = 1
<
*g:tagbar_expand*
g:tagbar_expand~
Default: 0
If this option is set to 1 the Vim window will be expanded by the width of the
Tagbar window if using a GUI version of Vim. Setting it to 2 will also try
expanding a terminal, but note that this is not supported by all terminals.
See also |xterm-resize|.
Example:
>
let g:tagbar_expand = 1
<
*g:tagbar_singleclick*
g:tagbar_singleclick~
Default: 0
If this option is set then a single- instead of a double-click is used to jump
to the tag definition.
Example:
>
let g:tagbar_singleclick = 1
<
*g:tagbar_foldlevel*
g:tagbar_foldlevel~
Default: 99
The initial foldlevel for folds in the Tagbar window. Folds with a level
higher than this number will be closed.
Example:
>
let g:tagbar_foldlevel = 2
<
*g:tagbar_iconchars*
g:tagbar_iconchars~
Since the display of the icons used to indicate open or closed folds depends
on the actual font used, different characters may be optimal for different
fonts. With this variable you can set the icons to characters of your liking.
The first character in the list specifies the icon to use for a closed fold,
and the second one for an open fold.
Examples (don't worry if some of the characters aren't displayed correctly,
just choose other characters in that case):
>
let g:tagbar_iconchars = ['▶', '▼'] (default on Linux and Mac OS X)
let g:tagbar_iconchars = ['▸', '▾']
let g:tagbar_iconchars = ['▷', '◢']
let g:tagbar_iconchars = ['+', '-'] (default on Windows)
<
*g:tagbar_scopestrs*
g:tagbar_scopestrs~
Default: {}
Setting to replace a tag's scope with a user-specified string in Tagbar's
display. If a scope is found in the keys of |g:tagbar_scopestrs|, then the
scope will be displayed as the corresponding value. If the scope is not
found, then the scope will be displayed as normal.
Example (don't worry if some of the characters aren't displayed correctly,
just choose other characters or strings in that case):
>
let g:tagbar_scopestrs = {
\ 'class': "\uf0e8",
\ 'const': "\uf8ff",
\ 'constant': "\uf8ff",
\ 'enum': "\uf702",
\ 'field': "\uf30b",
\ 'func': "\uf794",
\ 'function': "\uf794",
\ 'getter': "\ufab6",
\ 'implementation': "\uf776",
\ 'interface': "\uf7fe",
\ 'map': "\ufb44",
\ 'member': "\uf02b",
\ 'method': "\uf6a6",
\ 'setter': "\uf7a9",
\ 'variable': "\uf71b",
\ }
<
*g:tagbar_autoshowtag*
g:tagbar_autoshowtag~
Default: 0
If this variable is set to 1 and the current tag is inside of a closed fold
then the folds will be opened as much as needed for the tag to be visible so
it can be highlighted. If it is set to 0 then the folds will only be opened
when opening the Tagbar window and the current tag is inside a closed fold,
otherwise the folds won't be opened and the parent tag will be highlighted
instead. If it is set to 2 then the folds will never be opened automatically.
You can use the |:TagbarShowTag| command to open the folds manually.
Example:
>