115413bacSMasatake YAMATO.. _ctags(1): 215413bacSMasatake YAMATO 315413bacSMasatake YAMATO============================================================== 415413bacSMasatake YAMATO@CTAGS_NAME_EXECUTABLE@ 515413bacSMasatake YAMATO============================================================== 615413bacSMasatake YAMATO-------------------------------------------------------------- 715413bacSMasatake YAMATOGenerate tag files for source code 815413bacSMasatake YAMATO-------------------------------------------------------------- 915413bacSMasatake YAMATO:Version: @VERSION@ 10dccba5efSHiroo HAYASHI:Manual group: Universal Ctags 1115413bacSMasatake YAMATO:Manual section: 1 1215413bacSMasatake YAMATO 1315413bacSMasatake YAMATOSYNOPSIS 1415413bacSMasatake YAMATO-------- 1579d3a4e6SHiroo HAYASHI| **@CTAGS_NAME_EXECUTABLE@** [<options>] [<source_file(s)>] 1679d3a4e6SHiroo HAYASHI| **@ETAGS_NAME_EXECUTABLE@** [<options>] [<source_file(s)>] 1715413bacSMasatake YAMATO 1815413bacSMasatake YAMATO 1915413bacSMasatake YAMATODESCRIPTION 2015413bacSMasatake YAMATO----------- 2115413bacSMasatake YAMATO 2282af7a26SHiroo HAYASHIThe *@CTAGS_NAME_EXECUTABLE@* and *@ETAGS_NAME_EXECUTABLE@* (see ``-e`` option) programs 235eff651fSMasatake YAMATO(hereinafter collectively referred to as @CTAGS_NAME_EXECUTABLE@, 2415413bacSMasatake YAMATOexcept where distinguished) generate an index (or "tag") file for a 25329358a8SHiroo HAYASHIvariety of *language objects* found in *source file(s)*. This tag file allows 2615413bacSMasatake YAMATOthese items to be quickly and easily located by a text editor or other 27329358a8SHiroo HAYASHIutilities (*client tools*). A *tag* signifies a language object for which an index entry is 2815413bacSMasatake YAMATOavailable (or, alternatively, the index entry created for that object). 2915413bacSMasatake YAMATO 305eff651fSMasatake YAMATOAlternatively, @CTAGS_NAME_EXECUTABLE@ can generate a cross reference 3115413bacSMasatake YAMATOfile which lists, in human readable form, information about the various 32bcc38b40SMasatake YAMATOlanguage objects found in a set of source files. 3315413bacSMasatake YAMATO 3415413bacSMasatake YAMATOTag index files are supported by numerous editors, which allow the user to 3515413bacSMasatake YAMATOlocate the object associated with a name appearing in a source file and 361d1b5057SMasatake YAMATOjump to the file and line which defines the name. See the manual of your 371d1b5057SMasatake YAMATOfavorite editor about utilizing @CTAGS_NAME_EXECUTABLE@ command and 381d1b5057SMasatake YAMATOthe tag index files in the editor. 3915413bacSMasatake YAMATO 40329358a8SHiroo HAYASHI@CTAGS_NAME_EXECUTABLE@ is capable of generating different *kinds* of tags 41329358a8SHiroo HAYASHIfor each of many different *languages*. For a complete list of supported 4215413bacSMasatake YAMATOlanguages, the names by which they are recognized, and the kinds of tags 437ab22c67SHadriel Kaplanwhich are generated for each, see the ``--list-languages`` and ``--list-kinds-full`` 4415413bacSMasatake YAMATOoptions. 4515413bacSMasatake YAMATO 46329358a8SHiroo HAYASHIThis man page describes *Universal Ctags*, an implementation of ctags 47329358a8SHiroo HAYASHIderived from *Exuberant Ctags*. The major incompatible changes between 48bb84f88aSHiroo HAYASHIUniversal Ctags and Exuberant Ctags are enumerated in 493cd29b7fSMasatake YAMATOctags-incompatibilities(7). 5087928daeSMasatake YAMATO 51bb84f88aSHiroo HAYASHIOne of the advantages of Exuberant Ctags is that it allows a user to 527ab22c67SHadriel Kaplandefine a new parser from the command line. Extending this capability is one 53dccba5efSHiroo HAYASHIof the major features of Universal Ctags. ctags-optlib(7) 547ab22c67SHadriel Kaplandescribes how the capability is extended. 5587928daeSMasatake YAMATO 567ab22c67SHadriel KaplanNewly introduced experimental features are not explained here. If you 577ab22c67SHadriel Kaplanare interested in such features and @CTAGS_NAME_EXECUTABLE@ internals, 5855bfb323SHiroo HAYASHIvisit https://docs.ctags.io/. 595f761ac5SMasatake YAMATO 6015413bacSMasatake YAMATO 61753aaa67SMasatake YAMATOCOMMAND LINE INTERFACE 62753aaa67SMasatake YAMATO---------------------- 6315413bacSMasatake YAMATO 6415413bacSMasatake YAMATODespite the wealth of available options, defaults are set so that 6515413bacSMasatake YAMATO@CTAGS_NAME_EXECUTABLE@ is most commonly executed without any options (e.g. 66329358a8SHiroo HAYASHI"``@CTAGS_NAME_EXECUTABLE@ *``", or "``@CTAGS_NAME_EXECUTABLE@ -R``"), which will 6715413bacSMasatake YAMATOcreate a tag file in the current directory for all recognized source 6815413bacSMasatake YAMATOfiles. The options described below are provided merely to allow custom 6915413bacSMasatake YAMATOtailoring to meet special needs. 7015413bacSMasatake YAMATO 7115413bacSMasatake YAMATONote that spaces separating the single-letter options from their parameters 7215413bacSMasatake YAMATOare optional. 7315413bacSMasatake YAMATO 7415413bacSMasatake YAMATONote also that the boolean parameters to the long form options (those 75185906aaSHiroo HAYASHIbeginning with ``--`` and that take a ``[=(yes|no)]`` parameter) may be omitted, 76185906aaSHiroo HAYASHIin which case ``=yes`` is implied. (e.g. ``--sort`` is equivalent to ``--sort=yes``). 77185906aaSHiroo HAYASHINote further that ``=1``, ``=on``, and ``=true`` are considered synonyms for ``=yes``, 78185906aaSHiroo HAYASHIand that ``=0``, ``=off``, and ``=false`` are considered synonyms for ``=no``. 7915413bacSMasatake YAMATO 8015413bacSMasatake YAMATOSome options are either ignored or useful only when used while running in 81329358a8SHiroo HAYASHIetags mode (see ``-e`` option). Such options will be noted. 8215413bacSMasatake YAMATO 83185906aaSHiroo HAYASHI*<options>* must precede the *<source_file(s)>* following the standard POSIX 8479d3a4e6SHiroo HAYASHIconvention. 8515413bacSMasatake YAMATO 8615413bacSMasatake YAMATOOptions taking language names will accept those names in either upper or 870da78f84SMasatake YAMATOlower case. See the ``--list-languages`` option for a complete list of the 8815413bacSMasatake YAMATObuilt-in language names. 8915413bacSMasatake YAMATO 90a9debc03SMasatake YAMATO 91a9debc03SMasatake YAMATOLetters and names 92a9debc03SMasatake YAMATO~~~~~~~~~~~~~~~~~ 93a9debc03SMasatake YAMATO 94cd2e08bbSMasatake YAMATOSome options take one-letter flags as parameters (e.g. ``--kinds-<LANG>`` option). 957ab22c67SHadriel KaplanSpecifying just letters help a user create a complicated command line 96cd2e08bbSMasatake YAMATOquickly. However, a command line including sequences of one-letter flags 977ab22c67SHadriel Kaplanbecomes difficult to understand. 98a9debc03SMasatake YAMATO 99dccba5efSHiroo HAYASHIUniversal Ctags accepts long-name flags in 100525538b7SMasatake YAMATOaddition to such one-letter flags. The long-name and one-letter flags can be mixed in an 101525538b7SMasatake YAMATOoption parameter by surrounding each long-name by braces. Thus, for an 1027ab22c67SHadriel Kaplanexample, the following three notations for ``--kinds-C`` option have 103a9debc03SMasatake YAMATOthe same meaning:: 104a9debc03SMasatake YAMATO 105a9debc03SMasatake YAMATO --kinds-C=+pLl 106a9debc03SMasatake YAMATO --kinds-C=+{prototype}{label}{local} 107a9debc03SMasatake YAMATO --kinds-C=+{prototype}L{local} 108a9debc03SMasatake YAMATO 109a9debc03SMasatake YAMATONote that braces may be meta characters in your shell. Put 110a9debc03SMasatake YAMATOsingle quotes in such case. 111a9debc03SMasatake YAMATO 112525538b7SMasatake YAMATO``--list-...`` options shows one-letter flags and associated long-name flags. 113a9debc03SMasatake YAMATO 114a9debc03SMasatake YAMATO 115a9debc03SMasatake YAMATOList options 116a9debc03SMasatake YAMATO~~~~~~~~~~~~ 117a9debc03SMasatake YAMATO 118dccba5efSHiroo HAYASHIUniversal Ctags introduces many ``--list-...`` options that provide 11982af7a26SHiroo HAYASHIthe internal data of Universal Ctags (See "`Listing Options`_"). Both users and client tools may 120a9debc03SMasatake YAMATOuse the data. ``--with-list-header`` and ``--machinable`` options 121a9debc03SMasatake YAMATOadjust the output of the most of ``--list-...`` options. 122a9debc03SMasatake YAMATO 123a9debc03SMasatake YAMATOThe default setting (``--with-list-header=yes`` and ``--machinable=no``) 124a9debc03SMasatake YAMATOis for using interactively from a terminal. The header that explains 12518dce508SMasatake YAMATOthe meaning of columns is simply added to the output, and each column is 126329358a8SHiroo HAYASHIaligned in all lines. The header line starts with a hash ('``#``') character. 127a9debc03SMasatake YAMATO 128a9debc03SMasatake YAMATOFor scripting in a client tool, ``--with-list-header=no`` and 129a9debc03SMasatake YAMATO``--machinable=yes`` may be useful. The header is not added to the 130a9debc03SMasatake YAMATOoutput, and each column is separated by tab characters. 131a9debc03SMasatake YAMATO 132a9debc03SMasatake YAMATONote the order of columns will change in the future release. 133a9debc03SMasatake YAMATOHowever, labels in the header will not change. So by scanning 134a9debc03SMasatake YAMATOthe header, a client tool can find the index for the target 135a9debc03SMasatake YAMATOcolumn. 136a9debc03SMasatake YAMATO 137b6609649SMasatake YAMATO.. options that should be explained and revised here 138934804d2SMasatake YAMATO ``--list-features`` (done) 13991809da0SMasatake YAMATO ``--machinable`` (done) 14091809da0SMasatake YAMATO ``--with-list-header`` (done) 141a9debc03SMasatake YAMATO 14219c65d37SK.Takata 1432c6d8896SMasatake YAMATOOPTIONS 144753aaa67SMasatake YAMATO------------ 1457ab22c67SHadriel Kaplan@CTAGS_NAME_EXECUTABLE@ has more options than listed here. 146185906aaSHiroo HAYASHIOptions starting with an underscore character, such as ``--_echo=<msg>``, 1477ab22c67SHadriel Kaplanare not listed here. They are experimental or for debugging purpose. 148a9debc03SMasatake YAMATO 1492b762320SHiroo HAYASHINotation: ``<foo>`` is for a variable string ``foo``, ``[ ... ]`` for optional, 1502b762320SHiroo HAYASHI``|`` for selection, and ``( ... )`` for grouping. For example 1512b762320SHiroo HAYASHI``--foo[=(yes|no)]'' means ``--foo``, ``-foo=yes``, or ``-foo=no``. 1522b762320SHiroo HAYASHI 1530ceef997SHiroo HAYASHI.. _option_input_output_file: 1540ceef997SHiroo HAYASHI 1550ceef997SHiroo HAYASHIInput/Output File Options 156ccc98105SHiroo HAYASHI~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 157185906aaSHiroo HAYASHI``--exclude=<pattern>`` 158185906aaSHiroo HAYASHI Add *<pattern>* to a list of excluded files and directories. This option may 15915413bacSMasatake YAMATO be specified as many times as desired. For each file name considered 16015413bacSMasatake YAMATO by @CTAGS_NAME_EXECUTABLE@, each pattern specified using this option 16115413bacSMasatake YAMATO will be compared against both the complete path (e.g. 162329358a8SHiroo HAYASHI ``some/path/base.ext``) and the base name (e.g. ``base.ext``) of the file, thus 16315413bacSMasatake YAMATO allowing patterns which match a given file name irrespective of its 16455bfb323SHiroo HAYASHI path, or match only a specific path. 16555bfb323SHiroo HAYASHI 16655bfb323SHiroo HAYASHI If appropriate support is available 16715413bacSMasatake YAMATO from the runtime library of your C compiler, then pattern may 16815413bacSMasatake YAMATO contain the usual shell wildcards (not regular expressions) common on 16915413bacSMasatake YAMATO Unix (be sure to quote the option parameter to protect the wildcards from 17015413bacSMasatake YAMATO being expanded by the shell before being passed to @CTAGS_NAME_EXECUTABLE@; 171329358a8SHiroo HAYASHI also be aware that wildcards can match the slash character, '``/``'). 17215413bacSMasatake YAMATO You can determine if shell wildcards are available on your platform by 173934804d2SMasatake YAMATO examining the output of the ``--list-features`` option, which will include 174329358a8SHiroo HAYASHI ``wildcards`` in the compiled feature list; otherwise, pattern is matched 17515413bacSMasatake YAMATO against file names using a simple textual comparison. 17615413bacSMasatake YAMATO 177185906aaSHiroo HAYASHI If *<pattern>* begins with the character '``@``', then the rest of the string 17815413bacSMasatake YAMATO is interpreted as a file name from which to read exclusion patterns, 17915413bacSMasatake YAMATO one per line. If pattern is empty, the list of excluded patterns is 1807ab22c67SHadriel Kaplan cleared. 18115413bacSMasatake YAMATO 1827ab22c67SHadriel Kaplan Note that at program startup, the default exclude list contains names of 1837ab22c67SHadriel Kaplan common hidden and system files, patterns for binary files, and directories 1847ab22c67SHadriel Kaplan for which it is generally not desirable to descend while processing the 1857ab22c67SHadriel Kaplan ``--recurse`` option. To see the list of built-in exclude patterns, use 1867ab22c67SHadriel Kaplan ``--list-excludes``. 187199c84cdSHadriel Kaplan 188b24bee68SMasatake YAMATO See also the description for ``--exclude-exception=`` option. 189b24bee68SMasatake YAMATO 190185906aaSHiroo HAYASHI``--exclude-exception=<pattern>`` 191185906aaSHiroo HAYASHI Add *<pattern>* to a list of included files and directories. The pattern 192b24bee68SMasatake YAMATO affects the files and directories that are excluded by the pattern 193b24bee68SMasatake YAMATO specified with ``--exclude=`` option. 194b24bee68SMasatake YAMATO 195329358a8SHiroo HAYASHI For an example, you want @CTAGS_NAME_EXECUTABLE@ to ignore all files 196329358a8SHiroo HAYASHI under ``foo`` directory except ``foo/main.c``, use the following command 19755e29447SHiroo HAYASHI line: ``--exclude=foo/* --exclude-exception=foo/main.c``. 19855bfb323SHiroo HAYASHI 199185906aaSHiroo HAYASHI``--filter[=(yes|no)]`` 200ccc98105SHiroo HAYASHI Makes @CTAGS_NAME_EXECUTABLE@ behave as a filter, reading source 201ccc98105SHiroo HAYASHI file names from standard input and printing their tags to standard 202ccc98105SHiroo HAYASHI output on a file-by-file basis. If ``--sort`` is enabled, tags are sorted 203ccc98105SHiroo HAYASHI only within the source file in which they are defined. File names are 204ccc98105SHiroo HAYASHI read from standard input in line-oriented input mode (see note for ``-L`` 205ccc98105SHiroo HAYASHI option) and only after file names listed on the command line or from 206ccc98105SHiroo HAYASHI any file supplied using the ``-L`` option. When this option is enabled, 207ccc98105SHiroo HAYASHI the options ``-f``, ``-o``, and ``--totals`` are ignored. This option is quite 20879d3a4e6SHiroo HAYASHI esoteric and is disabled by default. 209ccc98105SHiroo HAYASHI 210185906aaSHiroo HAYASHI``--filter-terminator=<string>`` 211185906aaSHiroo HAYASHI Specifies a *<string>* to print to standard output following the tags for 21255e29447SHiroo HAYASHI each file name parsed when the ``--filter`` option is enabled. This may 21355e29447SHiroo HAYASHI permit an application reading the output of @CTAGS_NAME_EXECUTABLE@ 21455e29447SHiroo HAYASHI to determine when the output for each file is finished. 21555e29447SHiroo HAYASHI 21655e29447SHiroo HAYASHI Note that if the 21755e29447SHiroo HAYASHI file name read is a directory and ``--recurse`` is enabled, this string will 21855e29447SHiroo HAYASHI be printed only once at the end of all tags found for by descending 21955e29447SHiroo HAYASHI the directory. This string will always be separated from the last tag 22055e29447SHiroo HAYASHI line for the file by its terminating newline. 22155e29447SHiroo HAYASHI 22279d3a4e6SHiroo HAYASHI This option is quite esoteric and is empty by default. 22355e29447SHiroo HAYASHI 224185906aaSHiroo HAYASHI``--links[=(yes|no)]`` 225ccc98105SHiroo HAYASHI Indicates whether symbolic links (if supported) should be followed. 226ccc98105SHiroo HAYASHI When disabled, symbolic links are ignored. This option is on by default. 227ccc98105SHiroo HAYASHI 228185906aaSHiroo HAYASHI``--maxdepth=<N>`` 229ccc98105SHiroo HAYASHI Limits the depth of directory recursion enabled with the ``--recurse`` 230ccc98105SHiroo HAYASHI (``-R``) option. 231ccc98105SHiroo HAYASHI 232185906aaSHiroo HAYASHI``--recurse[=(yes|no)]`` 233ccc98105SHiroo HAYASHI Recurse into directories encountered in the list of supplied files. 23455bfb323SHiroo HAYASHI 235ccc98105SHiroo HAYASHI If the list of supplied files is empty and no file list is specified with 236329358a8SHiroo HAYASHI the ``-L`` option, then the current directory (i.e. '``.``') is assumed. 23755bfb323SHiroo HAYASHI Symbolic links are followed by default (See ``--links`` option). If you don't like these behaviors, either 238329358a8SHiroo HAYASHI explicitly specify the files or pipe the output of ``find(1)`` into 239185906aaSHiroo HAYASHI "``@CTAGS_NAME_EXECUTABLE@ -L -``" instead. See, also, the ``--exclude`` and 240ccc98105SHiroo HAYASHI ``--maxdepth`` to limit recursion. 241ccc98105SHiroo HAYASHI 24255bfb323SHiroo HAYASHI Note: This option is not supported on 24355bfb323SHiroo HAYASHI all platforms at present. It is available if the output of the ``--help`` 24455bfb323SHiroo HAYASHI option includes this option. 24555bfb323SHiroo HAYASHI 24655bfb323SHiroo HAYASHI.. TODO(code): --list-features option should support this. 24755bfb323SHiroo HAYASHI 248ccc98105SHiroo HAYASHI``-R`` 249ccc98105SHiroo HAYASHI Equivalent to ``--recurse``. 250ccc98105SHiroo HAYASHI 251185906aaSHiroo HAYASHI``-L <file>`` 252185906aaSHiroo HAYASHI Read from *<file>* a list of file names for which tags should be generated. 25355bfb323SHiroo HAYASHI 254329358a8SHiroo HAYASHI If file is specified as '``-``', then file names are read from standard 255ccc98105SHiroo HAYASHI input. File names read using this option are processed following file 256ccc98105SHiroo HAYASHI names appearing on the command line. Options are also accepted in this 257ccc98105SHiroo HAYASHI input. If this option is specified more than once, only the last will 25855bfb323SHiroo HAYASHI apply. 25955bfb323SHiroo HAYASHI 26055bfb323SHiroo HAYASHI Note: file is read in line-oriented mode, where a new line is 261ccc98105SHiroo HAYASHI the only delimiter and non-trailing white space is considered significant, 262ccc98105SHiroo HAYASHI in order that file names containing spaces may be supplied 263ccc98105SHiroo HAYASHI (however, trailing white space is stripped from lines); this can affect 264ccc98105SHiroo HAYASHI how options are parsed if included in the input. 265ccc98105SHiroo HAYASHI 266185906aaSHiroo HAYASHI``--append[=(yes|no)]`` 267ccc98105SHiroo HAYASHI Indicates whether tags generated from the specified files should be 268ccc98105SHiroo HAYASHI appended to those already present in the tag file or should replace them. 26979d3a4e6SHiroo HAYASHI This option is ``no`` by default. 270ccc98105SHiroo HAYASHI 271ccc98105SHiroo HAYASHI``-a`` 272ccc98105SHiroo HAYASHI Equivalent to ``--append``. 273ccc98105SHiroo HAYASHI 274185906aaSHiroo HAYASHI``-f <tagfile>`` 275185906aaSHiroo HAYASHI Use the name specified by *<tagfile>* for the tag file (default is "``tags``", 276185906aaSHiroo HAYASHI or "``TAGS``" when running in etags mode). If *<tagfile>* is specified as '``-``', 27755bfb323SHiroo HAYASHI then the tags are written to standard output instead. 27855bfb323SHiroo HAYASHI 27955bfb323SHiroo HAYASHI @CTAGS_NAME_EXECUTABLE@ 280ccc98105SHiroo HAYASHI will stubbornly refuse to take orders if tagfile exists and 281ccc98105SHiroo HAYASHI its first line contains something other than a valid tags line. This 282185906aaSHiroo HAYASHI will save your neck if you mistakenly type "``@CTAGS_NAME_EXECUTABLE@ -f 283185906aaSHiroo HAYASHI *.c``", which would otherwise overwrite your first C file with the tags 284ccc98105SHiroo HAYASHI generated by the rest! It will also refuse to accept a multi-character 285329358a8SHiroo HAYASHI file name which begins with a '``-``' (dash) character, since this most 286ccc98105SHiroo HAYASHI likely means that you left out the tag file name and this option tried to 287ccc98105SHiroo HAYASHI grab the next option as the file name. If you really want to name your 288185906aaSHiroo HAYASHI output tag file ``-ugly``, specify it as "``-f ./-ugly``". 28955bfb323SHiroo HAYASHI 29055bfb323SHiroo HAYASHI This option must 291ccc98105SHiroo HAYASHI appear before the first file name. If this option is specified more 292ccc98105SHiroo HAYASHI than once, only the last will apply. 293ccc98105SHiroo HAYASHI 294185906aaSHiroo HAYASHI``-o <tagfile>`` 295185906aaSHiroo HAYASHI Equivalent to "``-f tagfile``". 296ccc98105SHiroo HAYASHI 2970ceef997SHiroo HAYASHI.. _option_output_format: 2980ceef997SHiroo HAYASHI 2990ceef997SHiroo HAYASHIOutput Format Options 300ccc98105SHiroo HAYASHI~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 301185906aaSHiroo HAYASHI``--format=(1|2)`` 302ccc98105SHiroo HAYASHI Change the format of the output tag file. Currently the only valid 303ccc98105SHiroo HAYASHI values for level are 1 or 2. Level 1 specifies the original tag file 304ccc98105SHiroo HAYASHI format and level 2 specifies a new extended format containing extension 305ccc98105SHiroo HAYASHI fields (but in a manner which retains backward-compatibility with 30679d3a4e6SHiroo HAYASHI original ``vi(1)`` implementations). The default level is 2. 30779d3a4e6SHiroo HAYASHI [Ignored in etags mode] 308ccc98105SHiroo HAYASHI 309185906aaSHiroo HAYASHI``--output-format=(u-ctags|e-ctags|etags|xref|json)`` 310329358a8SHiroo HAYASHI Specify the output format. The default is ``u-ctags``. 311329358a8SHiroo HAYASHI See tags(5) for ``u-ctags`` and ``e-ctags``. 312329358a8SHiroo HAYASHI See ``-e`` for ``etags``, and ``-x`` for ``xref``. 31306d74c84SHiroo HAYASHI ``json`` format is available only if 314329358a8SHiroo HAYASHI the ctags executable is built with ``libjansson``. 315d75d4cb9SMasatake YAMATO See ctags-client-tools(7) for more about ``json`` format. 316ccc98105SHiroo HAYASHI 317ccc98105SHiroo HAYASHI``-e`` 318ccc98105SHiroo HAYASHI Same as ``--output-format=etags``. 319ccc98105SHiroo HAYASHI Enable etags mode, which will create a tag file for use with the Emacs 320ccc98105SHiroo HAYASHI editor. Alternatively, if @CTAGS_NAME_EXECUTABLE@ is invoked by a 321ccc98105SHiroo HAYASHI name containing the string "@ETAGS_NAME_EXECUTABLE@" (either by renaming, 322ccc98105SHiroo HAYASHI or creating a link to, the executable), etags mode will be enabled. 323ccc98105SHiroo HAYASHI 324ccc98105SHiroo HAYASHI``-x`` 325ccc98105SHiroo HAYASHI Same as ``--output-format=xref``. 326ccc98105SHiroo HAYASHI Print a tabular, human-readable cross reference (xref) file to standard 327ccc98105SHiroo HAYASHI output instead of generating a tag file. The information contained in 328ccc98105SHiroo HAYASHI the output includes: the tag name; the kind of tag; the line number, 329ccc98105SHiroo HAYASHI file name, and source line (with extra white space condensed) of the 330ccc98105SHiroo HAYASHI file which defines the tag. No tag file is written and all options 33155bfb323SHiroo HAYASHI affecting tag file output will be ignored. 33255bfb323SHiroo HAYASHI 33355bfb323SHiroo HAYASHI Example applications for this 334ccc98105SHiroo HAYASHI feature are generating a listing of all functions located in a source 335185906aaSHiroo HAYASHI file (e.g. "``@CTAGS_NAME_EXECUTABLE@ -x --kinds-c=f file``"), or generating 336ccc98105SHiroo HAYASHI a list of all externally visible global variables located in a source 337185906aaSHiroo HAYASHI file (e.g. "``@CTAGS_NAME_EXECUTABLE@ -x --kinds-c=v --extras=-F file``"). 338ccc98105SHiroo HAYASHI 339185906aaSHiroo HAYASHI``--sort=(yes|no|foldcase)`` 340ccc98105SHiroo HAYASHI Indicates whether the tag file should be sorted on the tag name 341185906aaSHiroo HAYASHI (default is ``yes``). Note that the original ``vi(1)`` required sorted tags. 342185906aaSHiroo HAYASHI The ``foldcase`` value specifies case insensitive (or case-folded) sorting. 343ccc98105SHiroo HAYASHI Fast binary searches of tag files sorted with case-folding will require 344ccc98105SHiroo HAYASHI special support from tools using tag files, such as that found in the 345ccc98105SHiroo HAYASHI @CTAGS_NAME_EXECUTABLE@ readtags library, or Vim version 6.2 or higher 346185906aaSHiroo HAYASHI (using "``set ignorecase``"). 34779d3a4e6SHiroo HAYASHI [Ignored in etags mode] 348ccc98105SHiroo HAYASHI 349ccc98105SHiroo HAYASHI``-u`` 350ccc98105SHiroo HAYASHI Equivalent to ``--sort=no`` (i.e. "unsorted"). 351ccc98105SHiroo HAYASHI 352185906aaSHiroo HAYASHI``--etags-include=<file>`` 353185906aaSHiroo HAYASHI Include a reference to *<file>* in the tag file. This option may be specified 354ccc98105SHiroo HAYASHI as many times as desired. This supports Emacs' capability to use a 355185906aaSHiroo HAYASHI tag file which *includes* other tag files. [Available only in etags mode] 356ccc98105SHiroo HAYASHI 357185906aaSHiroo HAYASHI``--input-encoding=<encoding>`` 358185906aaSHiroo HAYASHI Specifies the *<encoding>* of the input files. 359ccc98105SHiroo HAYASHI If this option is specified, Universal Ctags converts the input from this 360ccc98105SHiroo HAYASHI encoding to the encoding specified by ``--output-encoding=encoding``. 361ccc98105SHiroo HAYASHI 362185906aaSHiroo HAYASHI``--input-encoding-<LANG>=<encoding>`` 363185906aaSHiroo HAYASHI Specifies a specific input *<encoding>* for *<LANG>*. It overrides the global 364ccc98105SHiroo HAYASHI default value given with ``--input-encoding``. 365ccc98105SHiroo HAYASHI 366185906aaSHiroo HAYASHI``--output-encoding=<encoding>`` 367185906aaSHiroo HAYASHI Specifies the *<encoding>* of the tags file. 368ccc98105SHiroo HAYASHI Universal Ctags converts the encoding of input files from the encoding 369185906aaSHiroo HAYASHI specified by ``--input-encoding=<encoding>`` to this encoding. 370ccc98105SHiroo HAYASHI 371185906aaSHiroo HAYASHI In addition *<encoding>* is specified at the top the tags file as the 372ccc98105SHiroo HAYASHI value for the ``TAG_FILE_ENCODING`` pseudo-tag. The default value of 373185906aaSHiroo HAYASHI *<encoding>* is ``UTF-8``. 374ccc98105SHiroo HAYASHI 3750ceef997SHiroo HAYASHI.. _option_lang_mapping: 3760ceef997SHiroo HAYASHI 3770ceef997SHiroo HAYASHILanguage Selection and Mapping Options 3780ceef997SHiroo HAYASHI~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 379185906aaSHiroo HAYASHI``--language-force=(<language>|auto)`` 380ccc98105SHiroo HAYASHI By default, @CTAGS_NAME_EXECUTABLE@ automatically selects the language 381ccc98105SHiroo HAYASHI of a source file, ignoring those files whose language cannot be 38255bfb323SHiroo HAYASHI determined (see "`Determining file language`_"). This option forces the specified 383ccc98105SHiroo HAYASHI *language* (case-insensitive; either built-in or user-defined) to be used 384ccc98105SHiroo HAYASHI for every supplied file instead of automatically selecting the language 385185906aaSHiroo HAYASHI based upon its extension. 386185906aaSHiroo HAYASHI 387185906aaSHiroo HAYASHI In addition, the special value ``auto`` indicates 388ccc98105SHiroo HAYASHI that the language should be automatically selected (which effectively 389ccc98105SHiroo HAYASHI disables this option). 390ccc98105SHiroo HAYASHI 391185906aaSHiroo HAYASHI``--languages=[+|-](<list>|all)`` 392185906aaSHiroo HAYASHI Specifies the languages for which tag generation is enabled, with *<list>* 393ccc98105SHiroo HAYASHI containing a comma-separated list of language names (case-insensitive; 394185906aaSHiroo HAYASHI either built-in or user-defined). 395185906aaSHiroo HAYASHI 396185906aaSHiroo HAYASHI If the first language of *<list>* is not 397329358a8SHiroo HAYASHI preceded by either a '``+``' or '``-``', the current list (the current settings 398ccc98105SHiroo HAYASHI of enabled/disabled languages managed in @CTAGS_NAME_EXECUTABLE@ internally) 399185906aaSHiroo HAYASHI will be cleared before adding or removing the languages in *<list>*. Until a '``-``' is 400185906aaSHiroo HAYASHI encountered, each language in the *<list>* will be added to the current list. 401185906aaSHiroo HAYASHI 402185906aaSHiroo HAYASHI As either the '``+``' or '``-``' is encountered in the *<list>*, the languages 403ccc98105SHiroo HAYASHI following it are added or removed from the current list, respectively. 404ccc98105SHiroo HAYASHI Thus, it becomes simple to replace the current list with a new one, or 405ccc98105SHiroo HAYASHI to add or remove languages from the current list. 406ccc98105SHiroo HAYASHI 407ccc98105SHiroo HAYASHI The actual list of 408ccc98105SHiroo HAYASHI files for which tags will be generated depends upon the language 409185906aaSHiroo HAYASHI extension mapping in effect (see the ``--langmap`` option). Note that the most of 410ccc98105SHiroo HAYASHI languages, including user-defined languages, are enabled unless explicitly 411ccc98105SHiroo HAYASHI disabled using this option. Language names included in list may be any 412185906aaSHiroo HAYASHI built-in language or one previously defined with ``--langdef``. 413185906aaSHiroo HAYASHI 414185906aaSHiroo HAYASHI The default 415329358a8SHiroo HAYASHI is ``all``, which is also accepted as a valid argument. See the 416ccc98105SHiroo HAYASHI ``--list-languages`` option for a list of the all (built-in and user-defined) 417ccc98105SHiroo HAYASHI language names. 418ccc98105SHiroo HAYASHI 419ccc98105SHiroo HAYASHI Note ``--languages=`` option works cumulative way; the option can be 420ccc98105SHiroo HAYASHI specified with different arguments multiple times in a command line. 421ccc98105SHiroo HAYASHI 422185906aaSHiroo HAYASHI``--alias-<LANG>=[+|-](<pattern>|default)`` 423185906aaSHiroo HAYASHI Adds ('``+``') or removes ('``-``') an alias *<pattern>* to a language specified 424ccc98105SHiroo HAYASHI with *<LANG>*. @CTAGS_NAME_EXECUTABLE@ refers to the alias pattern in 425ccc98105SHiroo HAYASHI "`Determining file language`_" stage. 426ccc98105SHiroo HAYASHI 427185906aaSHiroo HAYASHI The parameter *<pattern>* is not a list. Use this option multiple 428ccc98105SHiroo HAYASHI times in a command line to add or remove multiple alias 429ccc98105SHiroo HAYASHI patterns. 430ccc98105SHiroo HAYASHI 431185906aaSHiroo HAYASHI To restore the default language aliases, specify ``default``. 432185906aaSHiroo HAYASHI 433185906aaSHiroo HAYASHI Using ``all`` for *<LANG>* has meaning in following two cases: 434ccc98105SHiroo HAYASHI 435ccc98105SHiroo HAYASHI ``--alias-all=`` 436ccc98105SHiroo HAYASHI This clears aliases setting of all languages. 437ccc98105SHiroo HAYASHI 438ccc98105SHiroo HAYASHI ``--alias-all=default`` 439ccc98105SHiroo HAYASHI This restores the default languages aliases for all languages. 440ccc98105SHiroo HAYASHI 441ccc98105SHiroo HAYASHI``--guess-language-eagerly`` 442ccc98105SHiroo HAYASHI Looks into the file contents for heuristically guessing the proper language parser. 443ccc98105SHiroo HAYASHI See "`Determining file language`_". 444ccc98105SHiroo HAYASHI 445ccc98105SHiroo HAYASHI``-G`` 446ccc98105SHiroo HAYASHI Equivalent to ``--guess-language-eagerly``. 447ccc98105SHiroo HAYASHI 448185906aaSHiroo HAYASHI``--langmap=<map>[,<map>[...]]`` 449ccc98105SHiroo HAYASHI Controls how file names are mapped to languages (see the ``--list-maps`` 450185906aaSHiroo HAYASHI option). Each comma-separated *<map>* consists of the language name (either 451329358a8SHiroo HAYASHI a built-in or user-defined language), a colon, and a list of *file 452329358a8SHiroo HAYASHI extensions* and/or *file name patterns*. A file extension is specified by 453329358a8SHiroo HAYASHI preceding the extension with a period (e.g. ``.c``). A file name pattern 454ccc98105SHiroo HAYASHI is specified by enclosing the pattern in parentheses (e.g. 455329358a8SHiroo HAYASHI ``([Mm]akefile)``). 456ccc98105SHiroo HAYASHI 457ccc98105SHiroo HAYASHI If appropriate support is available from the runtime 458ccc98105SHiroo HAYASHI library of your C compiler, then the file name pattern may contain the usual 459ccc98105SHiroo HAYASHI shell wildcards common on Unix (be sure to quote the option parameter to 460ccc98105SHiroo HAYASHI protect the wildcards from being expanded by the shell before being 461ccc98105SHiroo HAYASHI passed to @CTAGS_NAME_EXECUTABLE@). You can determine if shell wildcards 462ccc98105SHiroo HAYASHI are available on your platform by examining the output of the 463329358a8SHiroo HAYASHI ``--list-features`` option, which will include ``wildcards`` in the compiled 464ccc98105SHiroo HAYASHI feature list; otherwise, the file name patterns are matched against 465ccc98105SHiroo HAYASHI file names using a simple textual comparison. 466ccc98105SHiroo HAYASHI 467ccc98105SHiroo HAYASHI When mapping a file extension with ``--langmap`` option, 468ccc98105SHiroo HAYASHI it will first be unmapped from any other languages. (``--map-<LANG>`` 469ccc98105SHiroo HAYASHI option provides more fine-grained control.) 470ccc98105SHiroo HAYASHI 471185906aaSHiroo HAYASHI If the first character in a *<map>* is a plus sign ('``+``'), then the extensions and 472ccc98105SHiroo HAYASHI file name patterns in that map will be appended to the current map 473ccc98105SHiroo HAYASHI for that language; otherwise, the map will replace the current map. 474329358a8SHiroo HAYASHI For example, to specify that only files with extensions of ``.c`` and ``.x`` are 475329358a8SHiroo HAYASHI to be treated as C language files, use ``--langmap=c:.c.x``; to also add 476329358a8SHiroo HAYASHI files with extensions of ``.j`` as Java language files, specify 477329358a8SHiroo HAYASHI ``--langmap=c:.c.x,java:+.j``. To map makefiles (e.g. files named either 478329358a8SHiroo HAYASHI ``Makefile``, ``makefile``, or having the extension ``.mak``) to a language 479329358a8SHiroo HAYASHI called ``make``, specify ``--langmap=make:([Mm]akefile).mak``. To map files 480ccc98105SHiroo HAYASHI having no extension, specify a period not followed by a non-period 481329358a8SHiroo HAYASHI character (e.g. '``.``', ``..x``, ``.x.``). 482ccc98105SHiroo HAYASHI 483ccc98105SHiroo HAYASHI To clear the mapping for a 484ccc98105SHiroo HAYASHI particular language (thus inhibiting automatic generation of tags for 485329358a8SHiroo HAYASHI that language), specify an empty extension list (e.g. ``--langmap=fortran:``). 486ccc98105SHiroo HAYASHI To restore the default language mappings for a particular language, 487329358a8SHiroo HAYASHI supply the keyword ``default`` for the mapping. To specify restore the 488329358a8SHiroo HAYASHI default language mappings for all languages, specify ``--langmap=default``. 489ccc98105SHiroo HAYASHI 490ccc98105SHiroo HAYASHI Note that file name patterns are tested before file extensions when inferring 491ccc98105SHiroo HAYASHI the language of a file. This order of Universal Ctags is different from 492ccc98105SHiroo HAYASHI Exuberant Ctags. See ctags-incompatibilities(7) for the background of 493ccc98105SHiroo HAYASHI this incompatible change. 494ccc98105SHiroo HAYASHI 495185906aaSHiroo HAYASHI``--map-<LANG>=[+|-]<extension>|<pattern>`` 496ccc98105SHiroo HAYASHI This option provides the way to control mapping(s) of file names to 497ccc98105SHiroo HAYASHI languages in a more fine-grained way than ``--langmap`` option. 498ccc98105SHiroo HAYASHI 499ccc98105SHiroo HAYASHI In @CTAGS_NAME_EXECUTABLE@, more than one language can map to a 500185906aaSHiroo HAYASHI file name *<pattern>* or file *<extension>* (*N:1 map*). Alternatively, 501ccc98105SHiroo HAYASHI ``--langmap`` option handle only *1:1 map*, only one language 502185906aaSHiroo HAYASHI mapping to one file name *<pattern>* or file *<extension>*. A typical N:1 503ccc98105SHiroo HAYASHI map is seen in C++ and ObjectiveC language; both languages have 504329358a8SHiroo HAYASHI a map to ``.h`` as a file extension. 505ccc98105SHiroo HAYASHI 506329358a8SHiroo HAYASHI A file extension is specified by preceding the extension with a period (e.g. ``.c``). 507ccc98105SHiroo HAYASHI A file name pattern is specified by enclosing the pattern in parentheses (e.g. 508329358a8SHiroo HAYASHI ``([Mm]akefile)``). A prefixed plus ('``+``') sign is for adding, and 509329358a8SHiroo HAYASHI minus ('``-``') is for removing. No prefix means replacing the map of *<LANG>*. 510ccc98105SHiroo HAYASHI 511185906aaSHiroo HAYASHI Unlike ``--langmap``, *<extension>* (or *<pattern>*) is not a list. 512185906aaSHiroo HAYASHI ``--map-<LANG>`` takes one extension (or pattern). However, 513ccc98105SHiroo HAYASHI the option can be specified with different arguments multiple times 514ccc98105SHiroo HAYASHI in a command line. 515ccc98105SHiroo HAYASHI 5160ceef997SHiroo HAYASHI.. _option_tags_file_contents: 5170ceef997SHiroo HAYASHI 5180ceef997SHiroo HAYASHITags File Contents Options 519ccc98105SHiroo HAYASHI~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 52082af7a26SHiroo HAYASHISee "`TAG ENTRIES`_" about fields, kinds, roles, and extras. 52182af7a26SHiroo HAYASHI 522185906aaSHiroo HAYASHI``--excmd=(number|pattern|mix|combine)`` 523329358a8SHiroo HAYASHI Determines the type of ``EX`` command used to locate tags in the source 52415413bacSMasatake YAMATO file. [Ignored in etags mode] 52515413bacSMasatake YAMATO 526185906aaSHiroo HAYASHI The valid values for type (either the entire word or the first letter 52715413bacSMasatake YAMATO is accepted) are: 52815413bacSMasatake YAMATO 529329358a8SHiroo HAYASHI ``number`` 53015413bacSMasatake YAMATO Use only line numbers in the tag file for locating tags. This has 53115413bacSMasatake YAMATO four advantages: 53215413bacSMasatake YAMATO 53315413bacSMasatake YAMATO 1. Significantly reduces the size of the resulting tag file. 53415413bacSMasatake YAMATO 2. Eliminates failures to find tags because the line defining the 53515413bacSMasatake YAMATO tag has changed, causing the pattern match to fail (note that 536329358a8SHiroo HAYASHI some editors, such as ``vim``, are able to recover in many such 53715413bacSMasatake YAMATO instances). 53815413bacSMasatake YAMATO 3. Eliminates finding identical matching, but incorrect, source 53919c65d37SK.Takata lines (see "`BUGS`_"). 54015413bacSMasatake YAMATO 4. Retains separate entries in the tag file for lines which are 54115413bacSMasatake YAMATO identical in content. In pattern mode, duplicate entries are 54215413bacSMasatake YAMATO dropped because the search patterns they generate are identical, 54315413bacSMasatake YAMATO making the duplicate entries useless. 54415413bacSMasatake YAMATO 54515413bacSMasatake YAMATO However, this option has one significant drawback: changes to the 54615413bacSMasatake YAMATO source files can cause the line numbers recorded in the tag file 54715413bacSMasatake YAMATO to no longer correspond to the lines in the source file, causing 54815413bacSMasatake YAMATO jumps to some tags to miss the target definition by one or more 54915413bacSMasatake YAMATO lines. Basically, this option is best used when the source code 55015413bacSMasatake YAMATO to which it is applied is not subject to change. Selecting this 55155bfb323SHiroo HAYASHI option type causes the following options to be ignored: ``-B``, ``-F``. 55215413bacSMasatake YAMATO 553f814dad1SHiroo HAYASHI ``number`` type is ignored in Xref and JSON output formats. Use 554f814dad1SHiroo HAYASHI ``--_xformat="...%n"`` for Xref output format, or ``--fields=+n-P`` for 555f814dad1SHiroo HAYASHI JSON output format. 556f814dad1SHiroo HAYASHI 557f814dad1SHiroo HAYASHI .. NOTE: #2792 558f814dad1SHiroo HAYASHI 559329358a8SHiroo HAYASHI ``pattern`` 56015413bacSMasatake YAMATO Use only search patterns for all tags, rather than the line numbers 56115413bacSMasatake YAMATO usually used for macro definitions. This has the advantage of 56215413bacSMasatake YAMATO not referencing obsolete line numbers when lines have been added or 56315413bacSMasatake YAMATO removed since the tag file was generated. 56415413bacSMasatake YAMATO 565329358a8SHiroo HAYASHI ``mixed`` 56615413bacSMasatake YAMATO In this mode, patterns are generally used with a few exceptions. 56755bfb323SHiroo HAYASHI For C, line numbers are used for macro definition tags. For Fortran, line numbers 56815413bacSMasatake YAMATO are used for common blocks because their corresponding source lines 56915413bacSMasatake YAMATO are generally identical, making pattern searches useless 57015413bacSMasatake YAMATO for finding all matches. 57115413bacSMasatake YAMATO 57255bfb323SHiroo HAYASHI This was the default format generated by the original ctags and is, 57355bfb323SHiroo HAYASHI therefore, retained as the default for this option. 57455bfb323SHiroo HAYASHI 575329358a8SHiroo HAYASHI ``combine`` 5764a9f00a1SAmaiKinono Concatenate the line number and pattern with a semicolon in between. 577d62cebebSMasatake YAMATO 578ccc98105SHiroo HAYASHI``-n`` 579ccc98105SHiroo HAYASHI Equivalent to ``--excmd=number``. 580503460ccSMasatake YAMATO 581ccc98105SHiroo HAYASHI``-N`` 582ccc98105SHiroo HAYASHI Equivalent to ``--excmd=pattern``. 583503460ccSMasatake YAMATO 584185906aaSHiroo HAYASHI``--extras=[+|-][<flags>|*]`` 58515413bacSMasatake YAMATO Specifies whether to include extra tag entries for certain kinds of 586a5293a02SMasatake YAMATO information. See also "`Extras`_" subsection to know what are extras. 587503460ccSMasatake YAMATO 588185906aaSHiroo HAYASHI The parameter *<flags>* is a set of one-letter flags (and/or long-name flags), each 58915413bacSMasatake YAMATO representing one kind of extra tag entry to include in the tag file. 590329358a8SHiroo HAYASHI If flags is preceded by either the '``+``' or '``-``' character, the effect of 59115413bacSMasatake YAMATO each flag is added to, or removed from, those currently enabled; 59215413bacSMasatake YAMATO otherwise the flags replace any current settings. All entries are 593329358a8SHiroo HAYASHI included if '``*``' is given. 59415413bacSMasatake YAMATO 5957ab22c67SHadriel Kaplan This ``--extras=`` option is for controlling extras common in all 596dccba5efSHiroo HAYASHI languages (or language-independent extras). Universal Ctags also 59719c65d37SK.Takata supports language-specific extras. (See "`Language-specific fields and 59819c65d37SK.Takata extras`_" about the concept). Use ``--extras-<LANG>=`` option for 599503460ccSMasatake YAMATO controlling them. 600503460ccSMasatake YAMATO 601185906aaSHiroo HAYASHI``--extras-(<LANG>|all)=[+|-][<flags>|*]`` 6027ab22c67SHadriel Kaplan Specifies whether to include extra tag entries for certain kinds of 603329358a8SHiroo HAYASHI information for language *<LANG>*. Universal Ctags 604a5293a02SMasatake YAMATO introduces language-specific extras. See "`Language-specific fields and 605a5293a02SMasatake YAMATO extras`_" about the concept. This option is for controlling them. 606ca5a477eSMasatake YAMATO 607185906aaSHiroo HAYASHI Specifies ``all`` as *<LANG>* to apply the parameter *<flags>* to all 608329358a8SHiroo HAYASHI languages; all extras are enabled with specifying '``*``' as the 6097ab22c67SHadriel Kaplan parameter flags. If specifying nothing as the parameter flags 61091a7be3aSMasatake YAMATO (``--extras-all=``), all extras are disabled. These two combinations 6117ab22c67SHadriel Kaplan are useful for testing. 6127ab22c67SHadriel Kaplan 6137ab22c67SHadriel Kaplan Check the output of the ``--list-extras=<LANG>`` option for the 614329358a8SHiroo HAYASHI extras of specific language *<LANG>*. 6157ab22c67SHadriel Kaplan 616185906aaSHiroo HAYASHI``--fields=[+|-][<flags>|*]`` 6172b762320SHiroo HAYASHI Specifies which language-independent fields are to be included in the tag 6182b762320SHiroo HAYASHI entries. Language-independent fields are extension fields which are common 6192b762320SHiroo HAYASHI in all languages. See "`TAG FILE FORMAT`_" section, and "`Extension fields`_" 6202b762320SHiroo HAYASHI subsection, for details of extension fields. 62115413bacSMasatake YAMATO 622185906aaSHiroo HAYASHI The parameter *<flags>* is a set of one-letter or long-name flags, 623ca5a477eSMasatake YAMATO each representing one type of extension field to include. 62455bfb323SHiroo HAYASHI Each flag or group of flags may be preceded by either '``+``' to add it 625329358a8SHiroo HAYASHI to the default set, or '``-``' to exclude it. In the absence of any 626329358a8SHiroo HAYASHI preceding '``+``' or '``-``' sign, only those fields explicitly listed in flags 627ca5a477eSMasatake YAMATO will be included in the output (i.e. overriding the default set). All 628185906aaSHiroo HAYASHI fields are included if '``*``' is given. 629185906aaSHiroo HAYASHI 630185906aaSHiroo HAYASHI This option is ignored if the 6317ab22c67SHadriel Kaplan option ``--format=1`` (legacy tag file format) has been specified. 632ca5a477eSMasatake YAMATO 6332b762320SHiroo HAYASHI Use ``--fields-<LANG>=`` option for controlling language-specific fields. 63455bfb323SHiroo HAYASHI 635185906aaSHiroo HAYASHI``--fields-(<LANG>|all)=[+|-][<flags>|*]`` 63687d186ebSMasatake YAMATO Specifies which language-specific fields are to be included in 6372b762320SHiroo HAYASHI the tag entries. Universal Ctags 63887d186ebSMasatake YAMATO supports language-specific fields. (See "`Language-specific fields and 6392b762320SHiroo HAYASHI extras`_" about the concept). 64087d186ebSMasatake YAMATO 641185906aaSHiroo HAYASHI Specify ``all`` as *<LANG>* to apply the parameter *<flags>* to all 642329358a8SHiroo HAYASHI languages; all fields are enabled with specifying '``*``' as the 643185906aaSHiroo HAYASHI parameter flags. If specifying nothing as the parameter *<flags>* 64455bfb323SHiroo HAYASHI (i.e. ``--fields-all=``), all fields are disabled. These two combinations 64587d186ebSMasatake YAMATO are useful for testing. 64687d186ebSMasatake YAMATO 6472b762320SHiroo HAYASHI See the description of ``--fields=[+|-][<flags>|*]`` about *<flags>*. 6482b762320SHiroo HAYASHI 6492b762320SHiroo HAYASHI Use ``--fields=`` option for controlling language-independent fields. 6502b762320SHiroo HAYASHI 6512b762320SHiroo HAYASHI 652185906aaSHiroo HAYASHI``--kinds-(<LANG>|all)=[+|-](<kinds>|*)`` 653185906aaSHiroo HAYASHI Specifies a list of language-specific *<kinds>* of tags (or kinds) to 654329358a8SHiroo HAYASHI include in the output file for a particular language, where *<LANG>* is 65515413bacSMasatake YAMATO case-insensitive and is one of the built-in language names (see the 656185906aaSHiroo HAYASHI ``--list-languages`` option for a complete list). 657185906aaSHiroo HAYASHI 658185906aaSHiroo HAYASHI The parameter *<kinds>* is a group 65955bfb323SHiroo HAYASHI of one-letter or long-name flags designating kinds of tags (particular to the language) 66015413bacSMasatake YAMATO to either include or exclude from the output. The specific sets of 66115413bacSMasatake YAMATO flags recognized for each language, their meanings and defaults may be 662185906aaSHiroo HAYASHI list using the ``--list-kinds-full`` option. 663185906aaSHiroo HAYASHI 664185906aaSHiroo HAYASHI Each letter or group of letters 665329358a8SHiroo HAYASHI may be preceded by either '``+``' to add it to, or '``-``' to remove it from, 666329358a8SHiroo HAYASHI the default set. In the absence of any preceding '``+``' or '``-``' sign, only 66715413bacSMasatake YAMATO those kinds explicitly listed in kinds will be included in the output 66815413bacSMasatake YAMATO (i.e. overriding the default for the specified language). 66915413bacSMasatake YAMATO 670329358a8SHiroo HAYASHI Specify '``*``' as the parameter to include all kinds implemented 671329358a8SHiroo HAYASHI in *<LANG>* in the output. Furthermore if ``all`` is given as *<LANG>*, 672329358a8SHiroo HAYASHI specification of the parameter ``kinds`` affects all languages defined 673329358a8SHiroo HAYASHI in @CTAGS_NAME_EXECUTABLE@. Giving ``all`` makes sense only when '``*``' or 674329358a8SHiroo HAYASHI '``F``' is given as the parameter ``kinds``. 67515413bacSMasatake YAMATO 67615413bacSMasatake YAMATO As an example for the C language, in order to add prototypes and 67715413bacSMasatake YAMATO external variable declarations to the default set of tag kinds, 678329358a8SHiroo HAYASHI but exclude macros, use ``--kinds-c=+px-d``; to include only tags for 679329358a8SHiroo HAYASHI functions, use ``--kinds-c=f``. 68015413bacSMasatake YAMATO 681fabc9b0aSMasatake YAMATO Some kinds of C and C++ languages are synchronized; enabling 682fabc9b0aSMasatake YAMATO (or disabling) a kind in one language enables the kind having 683525538b7SMasatake YAMATO the same one-letter and long-name in the other language. See also the 684329358a8SHiroo HAYASHI description of ``MASTER`` column of ``--list-kinds-full``. 685fabc9b0aSMasatake YAMATO 68655e29447SHiroo HAYASHI.. COMMENT: 6878a87cfffSMasatake YAMATO ``--param-<LANG>.name=argument`` is moved to "Language Specific Options" 68855e29447SHiroo HAYASHI 689185906aaSHiroo HAYASHI``--pattern-length-limit=<N>`` 690185906aaSHiroo HAYASHI Truncate patterns of tag entries after *<N>* characters. Disable by setting to 0 69155bfb323SHiroo HAYASHI (default is 96). 692ccc98105SHiroo HAYASHI 693ccc98105SHiroo HAYASHI An input source file with long lines and multiple tag matches per 694ccc98105SHiroo HAYASHI line can generate an excessively large tags file with an 695ccc98105SHiroo HAYASHI unconstrained pattern length. For example, running ctags on a 696ccc98105SHiroo HAYASHI minified JavaScript source file often exhibits this behavior. 697ccc98105SHiroo HAYASHI 698ccc98105SHiroo HAYASHI The truncation avoids cutting in the middle of a UTF-8 code point 699ccc98105SHiroo HAYASHI spanning multiple bytes to prevent writing invalid byte sequences from 700ccc98105SHiroo HAYASHI valid input files. This handling allows for an extra 3 bytes above the 701ccc98105SHiroo HAYASHI configured limit in the worse case of a 4 byte code point starting 702ccc98105SHiroo HAYASHI right before the limit. Please also note that this handling is fairly 703ccc98105SHiroo HAYASHI naive and fast, and although it is resistant against any input, it 704ccc98105SHiroo HAYASHI requires a valid input to work properly; it is not guaranteed to work 705ccc98105SHiroo HAYASHI as the user expects when dealing with partially invalid UTF-8 input. 706ccc98105SHiroo HAYASHI This also partially affect non-UTF-8 input, if the byte sequence at 707ccc98105SHiroo HAYASHI the truncation length looks like a multibyte UTF-8 sequence. This 708ccc98105SHiroo HAYASHI should however be rare, and in the worse case will lead to including 709ccc98105SHiroo HAYASHI up to an extra 3 bytes above the limit. 710ccc98105SHiroo HAYASHI 711185906aaSHiroo HAYASHI``--pseudo-tags=[+|-](<pseudo-tag>|*)`` 712185906aaSHiroo HAYASHI Enable/disable emitting pseudo-tag named *<pseudo-tag>*. 713185906aaSHiroo HAYASHI If '``*``' is given, enable/disable emitting all pseudo-tags. 714ccc98105SHiroo HAYASHI 715ccc98105SHiroo HAYASHI``--put-field-prefix`` 716329358a8SHiroo HAYASHI Put ``UCTAGS`` as prefix for the name of fields newly introduced in 717ccc98105SHiroo HAYASHI Universal Ctags. 718ccc98105SHiroo HAYASHI 719ccc98105SHiroo HAYASHI Some fields are newly introduced in Universal Ctags and more will 720ccc98105SHiroo HAYASHI be introduced in the future. Other tags generators may also 721ccc98105SHiroo HAYASHI introduce their specific fields. 722ccc98105SHiroo HAYASHI 723ccc98105SHiroo HAYASHI In such a situation, there is a concern about conflicting field 724ccc98105SHiroo HAYASHI names; mixing tags files generated by multiple tags generators 725ccc98105SHiroo HAYASHI including Universal Ctags is difficult. This option provides a 726ccc98105SHiroo HAYASHI workaround for such station. 727ccc98105SHiroo HAYASHI 728ccc98105SHiroo HAYASHI .. code-block:: console 729ccc98105SHiroo HAYASHI 730ccc98105SHiroo HAYASHI $ @CTAGS_NAME_EXECUTABLE@ --fields='{line}{end}' -o - hello.c 731ccc98105SHiroo HAYASHI main hello.c /^main(int argc, char **argv)$/;" f line:3 end:6 73255bfb323SHiroo HAYASHI $ @CTAGS_NAME_EXECUTABLE@ --put-field-prefix --fields='{line}{end}' -o - hello.c 73355bfb323SHiroo HAYASHI main hello.c /^main(int argc, char **argv)$/;" f line:3 UCTAGSend:6 734ccc98105SHiroo HAYASHI 735329358a8SHiroo HAYASHI In the above example, the prefix is put to ``end`` field which is 736ccc98105SHiroo HAYASHI newly introduced in Universal Ctags. 737ccc98105SHiroo HAYASHI 738*899c9f48SMasatake YAMATO``--roles-(<LANG>|all).(<kind>|*)=[+|-][<roles>|*]`` 739ccc98105SHiroo HAYASHI Specifies a list of kind-specific roles of tags to include in the 740ccc98105SHiroo HAYASHI output file for a particular language. 741185906aaSHiroo HAYASHI *<kind>* specifies the kind where the *<roles>* are defined. 742329358a8SHiroo HAYASHI *<LANG>* specifies the language where the kind is defined. 743185906aaSHiroo HAYASHI Each role in *<roles>* must be surrounded by braces (e.g. ``{system}`` 744ccc98105SHiroo HAYASHI for a role named "system"). 745ccc98105SHiroo HAYASHI 746329358a8SHiroo HAYASHI Like ``--kinds-<LANG>`` option, '``+``' is for adding the role to the 747329358a8SHiroo HAYASHI list, and '``-``' is for removing from the list. '``*``' is for including 748ccc98105SHiroo HAYASHI all roles of the kind to the list. The option with no argument 749ccc98105SHiroo HAYASHI makes the list empty. 750ccc98105SHiroo HAYASHI 751ccc98105SHiroo HAYASHI Both a one-letter flag or a long name flag surrounded by braces are 752329358a8SHiroo HAYASHI acceptable for specifying a kind (e.g. ``--roles-C.h=+{system}{local}`` 753329358a8SHiroo HAYASHI or ``--roles-C.{header}=+{system}{local}``). '``*``' can be used for *<KIND>* 754ccc98105SHiroo HAYASHI only for adding/removing all roles of all kinds in a language to/from 755329358a8SHiroo HAYASHI the list (e.g. ``--roles-C.*=*`` or ``--roles-C.*=``). 756ccc98105SHiroo HAYASHI 757329358a8SHiroo HAYASHI ``all`` can be used for *<LANG>* only for adding/removing all roles of 758ccc98105SHiroo HAYASHI all kinds in all languages to/from the list 759329358a8SHiroo HAYASHI (e.g. ``--roles-all.*=*`` or ``--roles-all.*=``). 760ccc98105SHiroo HAYASHI 761185906aaSHiroo HAYASHI``--tag-relative=(yes|no|always|never)`` 76255e29447SHiroo HAYASHI Specifies how the file paths recorded in the tag file. 76379d3a4e6SHiroo HAYASHI The default is ``yes`` when running in etags mode (see 764329358a8SHiroo HAYASHI the ``-e`` option), ``no`` otherwise. 765ccc98105SHiroo HAYASHI 76655e29447SHiroo HAYASHI ``yes`` 76755e29447SHiroo HAYASHI indicates that the file paths recorded in the tag file should be 76855e29447SHiroo HAYASHI *relative to the directory containing the tag file* 76955e29447SHiroo HAYASHI unless the files supplied on the command line 77055e29447SHiroo HAYASHI are specified with absolute paths. 77155e29447SHiroo HAYASHI 77255e29447SHiroo HAYASHI ``no`` 77355e29447SHiroo HAYASHI indicates that the file paths recorded in the tag file should be 77455e29447SHiroo HAYASHI *relative to the current directory* 77555e29447SHiroo HAYASHI unless the files supplied on the command line 77655e29447SHiroo HAYASHI are specified with absolute paths. 77755e29447SHiroo HAYASHI 77855e29447SHiroo HAYASHI ``always`` 77955e29447SHiroo HAYASHI indicates the recorded file paths should be relative 78055e29447SHiroo HAYASHI even if source file names are passed in with absolute paths. 78155e29447SHiroo HAYASHI 78255e29447SHiroo HAYASHI ``never`` 78355e29447SHiroo HAYASHI indicates the recorded file paths should be absolute 78455e29447SHiroo HAYASHI even if source file names are passed in with relative paths. 78555bfb323SHiroo HAYASHI 786185906aaSHiroo HAYASHI``--use-slash-as-filename-separator[=(yes|no)]`` 78755bfb323SHiroo HAYASHI Uses slash ('``/``') character as filename separators instead of backslash 78855bfb323SHiroo HAYASHI ('``\``') character when printing ``input:`` field. 789329358a8SHiroo HAYASHI The default is ``yes`` for the default "u-ctags" output format, and 790329358a8SHiroo HAYASHI ``no`` for the other formats. 791ccc98105SHiroo HAYASHI 7922b762320SHiroo HAYASHI This option is available on MS Windows only. 7932b762320SHiroo HAYASHI 794ccc98105SHiroo HAYASHI``-B`` 795329358a8SHiroo HAYASHI Use backward searching patterns (e.g. ``?pattern?``). [Ignored in etags mode] 796ccc98105SHiroo HAYASHI 797ccc98105SHiroo HAYASHI``-F`` 798329358a8SHiroo HAYASHI Use forward searching patterns (e.g. ``/pattern/``) (default). [Ignored 799ccc98105SHiroo HAYASHI in etags mode] 800ccc98105SHiroo HAYASHI 8010ceef997SHiroo HAYASHIOption File Options 802ccc98105SHiroo HAYASHI~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 80355bfb323SHiroo HAYASHI.. TODO: merge some of description in option-file.rst into FILE or a dedicated 80455bfb323SHiroo HAYASHI section 80555bfb323SHiroo HAYASHI 806185906aaSHiroo HAYASHI``--options=<pathname>`` 807ccc98105SHiroo HAYASHI Read additional options from file or directory. 808ccc98105SHiroo HAYASHI 809185906aaSHiroo HAYASHI @CTAGS_NAME_EXECUTABLE@ searches *<pathname>* in the optlib path list 810ccc98105SHiroo HAYASHI first. If @CTAGS_NAME_EXECUTABLE@ cannot find a file or directory 811ccc98105SHiroo HAYASHI in the list, @CTAGS_NAME_EXECUTABLE@ reads a file or directory 812185906aaSHiroo HAYASHI at the specified *<pathname>*. 813ccc98105SHiroo HAYASHI 814ccc98105SHiroo HAYASHI If a file is specified, it should contain one option per line. If 815329358a8SHiroo HAYASHI a directory is specified, files suffixed with ``.ctags`` under it 816ccc98105SHiroo HAYASHI are read in alphabetical order. 817ccc98105SHiroo HAYASHI 818329358a8SHiroo HAYASHI As a special case, if ``--options=NONE`` is specified as the first 819ccc98105SHiroo HAYASHI option on the command line, preloading is disabled; the option 820ccc98105SHiroo HAYASHI will disable the automatic reading of any configuration options 82167c37950SMasatake YAMATO from a file (see "`FILES`_"). 822ccc98105SHiroo HAYASHI 823185906aaSHiroo HAYASHI``--options-maybe=<pathname>`` 824ccc98105SHiroo HAYASHI Same as ``--options`` but doesn't cause an error if file 825185906aaSHiroo HAYASHI (or directory) specified with *<pathname>* doesn't exist. 826ccc98105SHiroo HAYASHI 827185906aaSHiroo HAYASHI``--optlib-dir=[+]<directory>`` 828185906aaSHiroo HAYASHI Add an optlib *<directory>* to or reset the optlib path list. 829ccc98105SHiroo HAYASHI By default, the optlib path list is empty. 830ccc98105SHiroo HAYASHI 8310ceef997SHiroo HAYASHIoptlib Options 832ccc98105SHiroo HAYASHI~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 83355bfb323SHiroo HAYASHISee ctags-optlib(7) for details of each option. 83455bfb323SHiroo HAYASHI 835185906aaSHiroo HAYASHI``--kinddef-<LANG>=<letter>,<name>,<description>`` 836329358a8SHiroo HAYASHI Define a kind for *<LANG>*. 837329358a8SHiroo HAYASHI Don't be confused this with ``--kinds-<LANG>``. 838ccc98105SHiroo HAYASHI 839185906aaSHiroo HAYASHI``--langdef=<name>`` 840185906aaSHiroo HAYASHI Defines a new user-defined language, *<name>*, to be parsed with regular 84155bfb323SHiroo HAYASHI expressions. 84215413bacSMasatake YAMATO 843b01547bcSHiroo HAYASHI``--mline-regex-<LANG>=/<line_pattern>/<name_pattern>/<kind-spec>/[<flags>]`` 84455bfb323SHiroo HAYASHI Define multi-line regular expression for locating tags in specific language. 845edb8c7b8SMasatake YAMATO 846b01547bcSHiroo HAYASHI``--regex-<LANG>=/<line_pattern>/<name_pattern>/<kind-spec>/[<flags>]`` 84755bfb323SHiroo HAYASHI Define single-line regular expression for locating tags in specific language. 84815413bacSMasatake YAMATO 8490ceef997SHiroo HAYASHI.. _option_lang_specific: 8500ceef997SHiroo HAYASHI 8510ceef997SHiroo HAYASHILanguage Specific Options 852ccc98105SHiroo HAYASHI~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 853185906aaSHiroo HAYASHI``--if0[=(yes|no)]`` 854185906aaSHiroo HAYASHI Indicates a preference as to whether code within an "``#if 0``" branch of a 855ccc98105SHiroo HAYASHI preprocessor conditional should be examined for non-macro tags (macro 856ccc98105SHiroo HAYASHI tags are always included). Because the intent of this construct is to 85755bfb323SHiroo HAYASHI disable code, the default value of this option is ``no`` (disabled). 85855bfb323SHiroo HAYASHI 85955bfb323SHiroo HAYASHI Note that this 860ccc98105SHiroo HAYASHI indicates a preference only and does not guarantee skipping code within 861185906aaSHiroo HAYASHI an "``#if 0``" branch, since the fall-back algorithm used to generate 862ccc98105SHiroo HAYASHI tags when preprocessor conditionals are too complex follows all branches 86355bfb323SHiroo HAYASHI of a conditional. 86415413bacSMasatake YAMATO 865185906aaSHiroo HAYASHI``--line-directives[=(yes|no)]`` 866329358a8SHiroo HAYASHI Specifies whether ``#line`` directives should be recognized. These are 86755bfb323SHiroo HAYASHI present in the output of a preprocessor and contain the line number, and 86815413bacSMasatake YAMATO possibly the file name, of the original source file(s) from which the 86955bfb323SHiroo HAYASHI preprocessor output file was generated. This option is off by default. 87055bfb323SHiroo HAYASHI 87155bfb323SHiroo HAYASHI When enabled, this option will 87215413bacSMasatake YAMATO cause @CTAGS_NAME_EXECUTABLE@ to generate tag entries marked with the 87315413bacSMasatake YAMATO file names and line numbers of their locations original source file(s), 87415413bacSMasatake YAMATO instead of their actual locations in the preprocessor output. The actual 87515413bacSMasatake YAMATO file names placed into the tag file will have the same leading path 87615413bacSMasatake YAMATO components as the preprocessor output file, since it is assumed that 87715413bacSMasatake YAMATO the original source files are located relative to the preprocessor 878329358a8SHiroo HAYASHI output file (unless, of course, the ``#line`` directive specifies an 87955bfb323SHiroo HAYASHI absolute path). 88055bfb323SHiroo HAYASHI 88155bfb323SHiroo HAYASHI Note: This option is generally 8820da78f84SMasatake YAMATO only useful when used together with the ``--excmd=number`` (``-n``) option. 8830da78f84SMasatake YAMATO Also, you may have to use either the ``--langmap`` or ``--language-force`` option 88415413bacSMasatake YAMATO if the extension of the preprocessor output file is not known to 88515413bacSMasatake YAMATO @CTAGS_NAME_EXECUTABLE@. 88615413bacSMasatake YAMATO 887185906aaSHiroo HAYASHI``-D <macro>=<definition>`` 888185906aaSHiroo HAYASHI Defines a C preprocessor *<macro>*. This emulates the behavior of the 889ccc98105SHiroo HAYASHI corresponding gcc option. All types of macros are supported, 890ccc98105SHiroo HAYASHI including the ones with parameters and variable arguments. 891ccc98105SHiroo HAYASHI Stringification, token pasting and recursive macro expansion are also 892ccc98105SHiroo HAYASHI supported. 893ccc98105SHiroo HAYASHI This extends the function provided by ``-I`` option. 89415413bacSMasatake YAMATO 895185906aaSHiroo HAYASHI``-h (<list>|default)`` 896185906aaSHiroo HAYASHI Specifies a *<list>* of file extensions, separated by periods, which are 897ccc98105SHiroo HAYASHI to be interpreted as include (or header) files. To indicate files having 898ccc98105SHiroo HAYASHI no extension, use a period not followed by a non-period character 89955bfb323SHiroo HAYASHI (e.g. '``.``', ``..x``, ``.x.``). 90055bfb323SHiroo HAYASHI 90155bfb323SHiroo HAYASHI This option only affects how the scoping of 902ccc98105SHiroo HAYASHI particular kinds of tags are interpreted (i.e. whether or not they are 903ccc98105SHiroo HAYASHI considered as globally visible or visible only within the file in which 904ccc98105SHiroo HAYASHI they are defined); it does not map the extension to any particular 905ccc98105SHiroo HAYASHI language. Any tag which is located in a non-include file and cannot be 906ccc98105SHiroo HAYASHI seen (e.g. linked to) from another file is considered to have file-limited 907ccc98105SHiroo HAYASHI (e.g. static) scope. No kind of tag appearing in an include file 90855bfb323SHiroo HAYASHI will be considered to have file-limited scope. 90955bfb323SHiroo HAYASHI 91055bfb323SHiroo HAYASHI If the first character in the list is '``+``', then the extensions in the list will be 911ccc98105SHiroo HAYASHI appended to the current list; otherwise, the list will replace the 91254002562SMasatake YAMATO current list. See, also, the ``fileScope``/``F`` flag of ``--extras`` option. 91355bfb323SHiroo HAYASHI 914ccc98105SHiroo HAYASHI The default list is 915185906aaSHiroo HAYASHI ``.h.H.hh.hpp.hxx.h++.inc.def``. To restore the default list, specify "``-h 916185906aaSHiroo HAYASHI default``". 91755bfb323SHiroo HAYASHI 91855bfb323SHiroo HAYASHI Note that if an extension supplied to this option is not 919ccc98105SHiroo HAYASHI already mapped to a particular language (see "`Determining file language`_", above), 92054002562SMasatake YAMATO you will also need to use either the ``--map-<LANG>``, ``--langmap`` or 92154002562SMasatake YAMATO ``--language-force`` option. 922ccc98105SHiroo HAYASHI 923185906aaSHiroo HAYASHI``-I <identifier-list>`` 924185906aaSHiroo HAYASHI Specifies a *<identifier-list>* of identifiers which are to be specially handled while 925ccc98105SHiroo HAYASHI parsing C and C++ source files. This option is specifically provided 926ccc98105SHiroo HAYASHI to handle special cases arising through the use of preprocessor macros. 927ccc98105SHiroo HAYASHI When the identifiers listed are simple identifiers, these identifiers 92855bfb323SHiroo HAYASHI will be ignored during parsing of the source files. 92955bfb323SHiroo HAYASHI 93055bfb323SHiroo HAYASHI If an identifier is 9312b762320SHiroo HAYASHI suffixed with a '``+``' character (i.e. "``-I FOO+``"), @CTAGS_NAME_EXECUTABLE@ will also 932ccc98105SHiroo HAYASHI ignore any parenthesis-enclosed argument list which may immediately 9332b762320SHiroo HAYASHI follow the identifier in the source files. See the example of "``-I 9342b762320SHiroo HAYASHI MODULE_VERSION+``" below. 93555bfb323SHiroo HAYASHI 93655bfb323SHiroo HAYASHI If two identifiers are 9372b762320SHiroo HAYASHI separated with the '``=``' character (i.e. ``-I FOO=BAR``), the first identifiers is replaced by 938ccc98105SHiroo HAYASHI the second identifiers for parsing purposes. The list of identifiers may 939ccc98105SHiroo HAYASHI be supplied directly on the command line or read in from a separate file. 9402b762320SHiroo HAYASHI See the example of "``-I CLASS=class``" below. 94155bfb323SHiroo HAYASHI 942185906aaSHiroo HAYASHI If the first character of *<identifier-list>* is '``@``', '``.``' or a pathname 943329358a8SHiroo HAYASHI separator ('``/``' or '``\``'), or the first two characters specify a drive 944185906aaSHiroo HAYASHI letter (e.g. ``C:``), the parameter *<identifier-list>* will be interpreted as 945ccc98105SHiroo HAYASHI a filename from which to read a list of identifiers, one per input line. 94655bfb323SHiroo HAYASHI 947185906aaSHiroo HAYASHI Otherwise, *<identifier-list>* is a list of identifiers (or identifier 948ccc98105SHiroo HAYASHI pairs) to be specially handled, each delimited by either a comma or 949ccc98105SHiroo HAYASHI by white space (in which case the list should be quoted to keep the 95055bfb323SHiroo HAYASHI entire list as one command line argument). 95155bfb323SHiroo HAYASHI 95255bfb323SHiroo HAYASHI Multiple ``-I`` options may be 953ccc98105SHiroo HAYASHI supplied. To clear the list of ignore identifiers, supply a single 954185906aaSHiroo HAYASHI dash ('``-``') for *<identifier-list>*. 955ccc98105SHiroo HAYASHI 956ccc98105SHiroo HAYASHI This feature is useful when preprocessor macros are used in such a way 957ccc98105SHiroo HAYASHI that they cause syntactic confusion due to their presence. Indeed, 958ccc98105SHiroo HAYASHI this is the best way of working around a number of problems caused by 959ccc98105SHiroo HAYASHI the presence of syntax-busting macros in source files (see "`CAVEATS`_"). 960ccc98105SHiroo HAYASHI Some examples will illustrate this point. 961ccc98105SHiroo HAYASHI 962ccc98105SHiroo HAYASHI .. code-block:: C 963ccc98105SHiroo HAYASHI 964ccc98105SHiroo HAYASHI int foo ARGDECL4(void *, ptr, long int, nbytes) 965ccc98105SHiroo HAYASHI 966329358a8SHiroo HAYASHI In the above example, the macro ``ARGDECL4`` would be mistakenly 967ccc98105SHiroo HAYASHI interpreted to be the name of the function instead of the correct name 9682b762320SHiroo HAYASHI of ``foo``. Specifying "``-I ARGDECL4``" results in the correct behavior. 969ccc98105SHiroo HAYASHI 970ccc98105SHiroo HAYASHI .. code-block:: C 971ccc98105SHiroo HAYASHI 972ccc98105SHiroo HAYASHI /* creates an RCS version string in module */ 973ccc98105SHiroo HAYASHI MODULE_VERSION("$Revision$") 974ccc98105SHiroo HAYASHI 975ccc98105SHiroo HAYASHI In the above example the macro invocation looks too much like a function 976ccc98105SHiroo HAYASHI definition because it is not followed by a semicolon (indeed, it 977ccc98105SHiroo HAYASHI could even be followed by a global variable definition that would look 978ccc98105SHiroo HAYASHI much like a K&R style function parameter declaration). In fact, this 979ccc98105SHiroo HAYASHI seeming function definition could possibly even cause the rest of the 980ccc98105SHiroo HAYASHI file to be skipped over while trying to complete the definition. 9812b762320SHiroo HAYASHI Specifying "``-I MODULE_VERSION+``" would avoid such a problem. 982ccc98105SHiroo HAYASHI 983ccc98105SHiroo HAYASHI .. code-block:: C 984ccc98105SHiroo HAYASHI 985ccc98105SHiroo HAYASHI CLASS Example { 986ccc98105SHiroo HAYASHI // your content here 987ccc98105SHiroo HAYASHI }; 988ccc98105SHiroo HAYASHI 989329358a8SHiroo HAYASHI The example above uses ``CLASS`` as a preprocessor macro which expands to 990329358a8SHiroo HAYASHI something different for each platform. For instance ``CLASS`` may be 991329358a8SHiroo HAYASHI defined as ``class __declspec(dllexport)`` on Win32 platforms and simply 992329358a8SHiroo HAYASHI ``class`` on UNIX. Normally, the absence of the C++ keyword ``class`` 993ccc98105SHiroo HAYASHI would cause the source file to be incorrectly parsed. Correct behavior 9942b762320SHiroo HAYASHI can be restored by specifying "``-I CLASS=class``". 995ccc98105SHiroo HAYASHI 9968a87cfffSMasatake YAMATO``--param-<LANG>.<name>=<argument>`` 9972b762320SHiroo HAYASHI Set a *<LANG>* specific parameter, a parameter specific to the *<LANG>*. 998329358a8SHiroo HAYASHI 9992b762320SHiroo HAYASHI Available parameters can be listed with ``--list-params``. 10000ceef997SHiroo HAYASHI 1001e8dbadb2SHiroo HAYASHI.. _option_listing: 1002e8dbadb2SHiroo HAYASHI 10030ceef997SHiroo HAYASHIListing Options 1004ccc98105SHiroo HAYASHI~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1005185906aaSHiroo HAYASHI``--list-aliases[=(<language>|all)]`` 1006185906aaSHiroo HAYASHI Lists the aliases for either the specified *<language>* or ``all`` 1007574f62bdSK.Takata languages, and then exits. 1008329358a8SHiroo HAYASHI ``all`` is used as default value if the option argument is omitted. 1009574f62bdSK.Takata The aliases are used when heuristically testing a language parser for a 1010574f62bdSK.Takata source file. 1011f2caf68aSMasatake YAMATO 1012199c84cdSHadriel Kaplan``--list-excludes`` 1013199c84cdSHadriel Kaplan Lists the current exclusion patterns used to exclude files. 1014199c84cdSHadriel Kaplan 1015185906aaSHiroo HAYASHI``--list-extras[=(<language>|all)]`` 1016185906aaSHiroo HAYASHI Lists the extras recognized for either the specified *<language>* or 1017185906aaSHiroo HAYASHI ``all`` languages. See "`Extras`_" subsection to know what are extras. 1018329358a8SHiroo HAYASHI ``all`` is used as default value if the option argument is omitted. 1019e81ef08aSMasatake YAMATO 1020e81ef08aSMasatake YAMATO An extra can be enabled or disabled with ``--extras=`` for common 1021e81ef08aSMasatake YAMATO extras in all languages, or ``--extras-<LANG>=`` for the specified 1022525538b7SMasatake YAMATO language. These option takes one-letter flag or long-name flag as a parameter 1023e81ef08aSMasatake YAMATO for specifying an extra. 1024e81ef08aSMasatake YAMATO 102555bfb323SHiroo HAYASHI The meaning of columns in output are as follows: 1026e81ef08aSMasatake YAMATO 1027e81ef08aSMasatake YAMATO LETTER 1028329358a8SHiroo HAYASHI One-letter flag. '``-``' means the extra does not have one-letter flag. 1029e81ef08aSMasatake YAMATO 1030e81ef08aSMasatake YAMATO NAME 1031185906aaSHiroo HAYASHI Long-name flag. The long-name is used in ``extras`` field. 1032e81ef08aSMasatake YAMATO 1033e81ef08aSMasatake YAMATO ENABLED 1034329358a8SHiroo HAYASHI Whether the extra is enabled or not. It takes ``yes`` or ``no``. 1035e81ef08aSMasatake YAMATO 1036e81ef08aSMasatake YAMATO LANGUAGE 1037e81ef08aSMasatake YAMATO The name of language if the extra is owned by a parser. 1038329358a8SHiroo HAYASHI ``NONE`` means the extra is common in parsers. 1039e81ef08aSMasatake YAMATO 1040e81ef08aSMasatake YAMATO DESCRIPTION 1041e81ef08aSMasatake YAMATO Human readable description for the extra. 1042e81ef08aSMasatake YAMATO 1043934804d2SMasatake YAMATO``--list-features`` 1044934804d2SMasatake YAMATO Lists the compiled features. 1045934804d2SMasatake YAMATO 1046185906aaSHiroo HAYASHI``--list-fields[=(<language>|all)]`` 1047185906aaSHiroo HAYASHI Lists the fields recognized for either the specified *<language>* or 1048185906aaSHiroo HAYASHI ``all`` languages. See "`Extension fields`_" subsection to know what are fields. 1049329358a8SHiroo HAYASHI ``all`` is used as default value if the option argument is omitted. 1050a596d4e5SMasatake YAMATO 1051a596d4e5SMasatake YAMATO The meaning of columns are as follows: 1052a596d4e5SMasatake YAMATO 1053a596d4e5SMasatake YAMATO LETTER 1054329358a8SHiroo HAYASHI One-letter flag. '``-``' means the field does not have one-letter flag. 1055a596d4e5SMasatake YAMATO 1056a596d4e5SMasatake YAMATO NAME 1057525538b7SMasatake YAMATO Long-name of field. 1058a596d4e5SMasatake YAMATO 1059a596d4e5SMasatake YAMATO ENABLED 1060329358a8SHiroo HAYASHI Whether the field is enabled or not. It takes ``yes`` or ``no``. 1061a596d4e5SMasatake YAMATO 1062a596d4e5SMasatake YAMATO LANGUAGE 1063a596d4e5SMasatake YAMATO The name of language if the field is owned by a parser. 10642b762320SHiroo HAYASHI ``NONE`` means that the field is a language-independent field which is 10652b762320SHiroo HAYASHI common in all languages. 1066a596d4e5SMasatake YAMATO 1067a596d4e5SMasatake YAMATO JSTYPE 106855bfb323SHiroo HAYASHI JSON type used in printing the value of field when ``--output-format=json`` 1069d75d4cb9SMasatake YAMATO is specified. See ctags-client-tools(7). 1070a596d4e5SMasatake YAMATO 1071a596d4e5SMasatake YAMATO FIXED 1072f814dad1SHiroo HAYASHI Whether this field can be disabled or not in tags output. 107355bfb323SHiroo HAYASHI 1074f814dad1SHiroo HAYASHI Some fields are printed always in tags output. 1075f814dad1SHiroo HAYASHI They have ``yes`` as the value for this column. 1076f814dad1SHiroo HAYASHI 1077f814dad1SHiroo HAYASHI Unlike the tag output mode, JSON output mode allows disabling 1078f814dad1SHiroo HAYASHI any fields. 1079a596d4e5SMasatake YAMATO 1080ac58d7bfSMasatake YAMATO OP 1081ac58d7bfSMasatake YAMATO How this field can be accessed from optscript code. 1082ac58d7bfSMasatake YAMATO This field is for Universal Ctags developers. 1083ac58d7bfSMasatake YAMATO 1084ac58d7bfSMasatake YAMATO 1085a596d4e5SMasatake YAMATO DESCRIPTION 1086a596d4e5SMasatake YAMATO Human readable description for the field. 1087a596d4e5SMasatake YAMATO 1088185906aaSHiroo HAYASHI``--list-kinds[=(<language>|all)]`` 10890ddcf29bSMasatake YAMATO Subset of ``--list-kinds-full``. This option is kept for 1090bb84f88aSHiroo HAYASHI backward-compatibility with Exuberant Ctags. 10910ddcf29bSMasatake YAMATO 10920ddcf29bSMasatake YAMATO This option prints only LETTER, DESCRIPTION, and ENABLED fields 10930ddcf29bSMasatake YAMATO of ``--list-kinds-full`` output. However, the presentation of 10940ddcf29bSMasatake YAMATO ENABLED column is different from that of ``--list-kinds-full`` 1095329358a8SHiroo HAYASHI option; ``[off]`` follows after description if the kind is disabled, 10960ddcf29bSMasatake YAMATO and nothing follows if enabled. The most of all kinds are enabled 10970ddcf29bSMasatake YAMATO by default. 10980ddcf29bSMasatake YAMATO 10990ddcf29bSMasatake YAMATO The critical weakness of this option is that this option does not 1100dccba5efSHiroo HAYASHI print the name of kind. Universal Ctags introduces 11010ddcf29bSMasatake YAMATO ``--list-kinds-full`` because it considers that names are 11020ddcf29bSMasatake YAMATO important. 11030ddcf29bSMasatake YAMATO 11040ddcf29bSMasatake YAMATO This option does not work with ``--machinable`` nor 11050ddcf29bSMasatake YAMATO ``--with-list-header``. 11060ddcf29bSMasatake YAMATO 1107185906aaSHiroo HAYASHI``--list-kinds-full[=(<language>|all)]`` 1108185906aaSHiroo HAYASHI Lists the tag kinds recognized for either the specified *<language>* 1109185906aaSHiroo HAYASHI or ``all`` languages, and then exits. See "`Kinds`_" subsection to 11107ab22c67SHadriel Kaplan learn what kinds are. 1111329358a8SHiroo HAYASHI ``all`` is used as default value if the option argument is omitted. 11120ddcf29bSMasatake YAMATO 11130ddcf29bSMasatake YAMATO Each kind of tag recorded in the tag file is represented by a 1114525538b7SMasatake YAMATO one-letter flag, or a long-name flag. They are also used to filter the tags 11150ddcf29bSMasatake YAMATO placed into the output through use of the ``--kinds-<LANG>`` 11160ddcf29bSMasatake YAMATO option. 11170ddcf29bSMasatake YAMATO 11180ddcf29bSMasatake YAMATO The meaning of columns are as follows: 11190ddcf29bSMasatake YAMATO 11200ddcf29bSMasatake YAMATO LANGUAGE 11210ddcf29bSMasatake YAMATO The name of language having the kind. 11220ddcf29bSMasatake YAMATO 11230ddcf29bSMasatake YAMATO LETTER 11240ddcf29bSMasatake YAMATO One-letter flag. This must be unique in a language. 11250ddcf29bSMasatake YAMATO 11260ddcf29bSMasatake YAMATO NAME 1127525538b7SMasatake YAMATO The long-name flag of the kind. This can be used as the alternative 1128329358a8SHiroo HAYASHI to the one-letter flag described above. If enabling ``K`` field with 1129525538b7SMasatake YAMATO ``--fields=+K``, @CTAGS_NAME_EXECUTABLE@ uses long-names instead of 1130525538b7SMasatake YAMATO one-letters in tags output. To enable/disable a kind with 1131525538b7SMasatake YAMATO ``--kinds-<LANG>`` option, long-name surrounded by braces instead 1132525538b7SMasatake YAMATO of one-letter. See "`Letters and names`_" for details. This must be 11330ddcf29bSMasatake YAMATO unique in a language. 11340ddcf29bSMasatake YAMATO 11350ddcf29bSMasatake YAMATO ENABLED 1136329358a8SHiroo HAYASHI Whether the kind is enabled or not. It takes ``yes`` or ``no``. 11370ddcf29bSMasatake YAMATO 11380ddcf29bSMasatake YAMATO REFONLY 11390ddcf29bSMasatake YAMATO Whether the kind is specialized for reference tagging or not. 1140329358a8SHiroo HAYASHI If the column is ``yes``, the kind is for reference tagging, and 114119c65d37SK.Takata it is never used for definition tagging. See also "`TAG ENTRIES`_". 11420ddcf29bSMasatake YAMATO 11430ddcf29bSMasatake YAMATO NROLES 114419c65d37SK.Takata The number of roles this kind has. See also "`Roles`_". 11450ddcf29bSMasatake YAMATO 11460ddcf29bSMasatake YAMATO MASTER 11474711ae33SJakub Wilk The master parser controlling enablement of the kind. 1148dccba5efSHiroo HAYASHI A kind belongs to a language (owner) in Universal Ctags; 11490ddcf29bSMasatake YAMATO enabling and disabling a kind in a language has no effect on 11508fe28e49SMasatake YAMATO a kind in another language even if both kinds has the 1151525538b7SMasatake YAMATO same one-letter flag and/or the same long-name flag. In other words, 11520ddcf29bSMasatake YAMATO the namespace of kinds are separated by language. 11530ddcf29bSMasatake YAMATO 1154bb84f88aSHiroo HAYASHI However, Exuberant Ctags does not separate the kinds of C and 11550ddcf29bSMasatake YAMATO C++. Enabling/disabling kindX in C language enables/disables a 1156525538b7SMasatake YAMATO kind in C++ language having the same long-name flag with kindX. To 1157dccba5efSHiroo HAYASHI emulate this behavior in Universal Ctags, a concept named 1158329358a8SHiroo HAYASHI *master parser* is introduced. Enabling/disabling some kinds 11590ddcf29bSMasatake YAMATO are synchronized under the control of a master language. 11600ddcf29bSMasatake YAMATO 11610ddcf29bSMasatake YAMATO .. code-block:: console 11620ddcf29bSMasatake YAMATO 11630ddcf29bSMasatake YAMATO $ ctags --kinds-C=+'{local}' --list-kinds-full \ 11640ddcf29bSMasatake YAMATO | grep -E '^(#|C\+\+ .* local)' 11650ddcf29bSMasatake YAMATO #LANGUAGE LETTER NAME ENABLED REFONLY NROLES MASTER DESCRIPTION 11660ddcf29bSMasatake YAMATO C++ l local yes no 0 C local variables 11670ddcf29bSMasatake YAMATO $ ctags --kinds-C=-'{local}' --list-kinds-full \ 11680ddcf29bSMasatake YAMATO | grep -E '^(#|C\+\+ .* local)' 11690ddcf29bSMasatake YAMATO #LANGUAGE LETTER NAME ENABLED REFONLY NROLES MASTER DESCRIPTION 11700ddcf29bSMasatake YAMATO C++ l local no no 0 C local variables 11710ddcf29bSMasatake YAMATO 1172329358a8SHiroo HAYASHI You see ``ENABLED`` field of ``local`` kind of C++ language is changed 1173329358a8SHiroo HAYASHI Though ``local`` kind of C language is enabled/disabled. If you swap the languages, you 11740ddcf29bSMasatake YAMATO see the same result. 11750ddcf29bSMasatake YAMATO 117655bfb323SHiroo HAYASHI .. TODO: need a reference to "master parser" 117755bfb323SHiroo HAYASHI 11780ddcf29bSMasatake YAMATO DESCRIPTION 11790ddcf29bSMasatake YAMATO Human readable description for the kind. 118015413bacSMasatake YAMATO 1181a748ec17SMasatake YAMATO``--list-languages`` 1182a748ec17SMasatake YAMATO Lists the names of the languages understood by @CTAGS_NAME_EXECUTABLE@, 1183a748ec17SMasatake YAMATO and then exits. These language names are case insensitive and may be 11844711ae33SJakub Wilk used in many other options like ``--language-force``, 1185a748ec17SMasatake YAMATO ``--languages``, ``--kinds-<LANG>``, ``--regex-<LANG>``, and so on. 1186a748ec17SMasatake YAMATO 1187329358a8SHiroo HAYASHI Each language listed is disabled if followed by ``[disabled]``. 1188a748ec17SMasatake YAMATO To use the parser for such a language, specify the language as an 1189a748ec17SMasatake YAMATO argument of ``--languages=+`` option. 1190a748ec17SMasatake YAMATO 11912b762320SHiroo HAYASHI ``--machinable`` and ``--with-list-header`` options are ignored if they are 11922b762320SHiroo HAYASHI specified with this option. 119355bfb323SHiroo HAYASHI 1194185906aaSHiroo HAYASHI``--list-map-extensions[=(<language>|all)]`` 11954cca0f8eSMasatake YAMATO Lists the file extensions which associate a file 1196185906aaSHiroo HAYASHI name with a language for either the specified *<language>* or ``all`` 11974cca0f8eSMasatake YAMATO languages, and then exits. 1198329358a8SHiroo HAYASHI ``all`` is used as default value if the option argument is omitted. 11994cca0f8eSMasatake YAMATO 1200185906aaSHiroo HAYASHI``--list-map-patterns[=(<language>|all)]`` 12014cca0f8eSMasatake YAMATO Lists the file name patterns which associate a file 1202185906aaSHiroo HAYASHI name with a language for either the specified *<language>* or ``all`` 12034cca0f8eSMasatake YAMATO languages, and then exits. 1204329358a8SHiroo HAYASHI ``all`` is used as default value if the option argument is omitted. 12054cca0f8eSMasatake YAMATO 1206185906aaSHiroo HAYASHI``--list-maps[=(<language>|all)]`` 1207922d4048SMasatake YAMATO Lists file name patterns and the file extensions which associate a file 1208185906aaSHiroo HAYASHI name with a language for either the specified *<language>* or ``all`` 120955bfb323SHiroo HAYASHI languages, and then exits. 1210329358a8SHiroo HAYASHI ``all`` is used as default value if the option argument is omitted. 121115413bacSMasatake YAMATO 12124cca0f8eSMasatake YAMATO To list the file extensions or file name patterns individually, use 12134cca0f8eSMasatake YAMATO ``--list-map-extensions`` or ``--list-map-patterns`` option. 1214fc0d7d43SMasatake YAMATO See the ``--langmap`` option, and "`Determining file language`_", above. 12154cca0f8eSMasatake YAMATO 1216eed038c3SMasatake YAMATO This option does not work with ``--machinable`` nor 1217eed038c3SMasatake YAMATO ``--with-list-header``. 1218eed038c3SMasatake YAMATO 1219d8261476SK.Takata``--list-mline-regex-flags`` 1220d8261476SK.Takata Output list of flags which can be used in a multiline regex parser 1221d8261476SK.Takata definition. 122255bfb323SHiroo HAYASHI See ctags-optlib(7). 1223d8261476SK.Takata 1224185906aaSHiroo HAYASHI``--list-params[=(<language>|all)]`` 1225185906aaSHiroo HAYASHI Lists the parameters for either the specified *<language>* or ``all`` 1226574f62bdSK.Takata languages, and then exits. 1227329358a8SHiroo HAYASHI ``all`` is used as default value if the option argument is omitted. 1228d8261476SK.Takata 1229d8261476SK.Takata``--list-pseudo-tags`` 123000e59525SMasatake YAMATO Output list of pseudo-tags. 1231d8261476SK.Takata 1232599fcc99SMasatake YAMATO``--list-regex-flags`` 123355bfb323SHiroo HAYASHI Lists the flags that can be used in ``--regex-<LANG>`` option. 1234599fcc99SMasatake YAMATO See ctags-optlib(7). 1235599fcc99SMasatake YAMATO 1236b01547bcSHiroo HAYASHI``--list-roles[=(<language>|all)[.(<kind-specs>|*)]]`` 1237185906aaSHiroo HAYASHI List the roles for either the specified *<language>* or ``all`` languages. 1238329358a8SHiroo HAYASHI ``all`` is used as default value if the option argument is omitted. 123955bfb323SHiroo HAYASHI 1240185906aaSHiroo HAYASHI If the parameter *<kindspecs>* is given after the parameter 1241185906aaSHiroo HAYASHI *<language>* or ``all`` with concatenating with '``.``', list only roles 1242525538b7SMasatake YAMATO defined in the kinds. Both one-letter flags and long name flags surrounded 1243185906aaSHiroo HAYASHI by braces are acceptable as the parameter *<kindspecs>*. 1244bff01330SMasatake YAMATO 1245bff01330SMasatake YAMATO The meaning of columns are as follows: 1246bff01330SMasatake YAMATO 1247bff01330SMasatake YAMATO LANGUAGE 1248525538b7SMasatake YAMATO The name of language having the role. 1249bff01330SMasatake YAMATO 1250bff01330SMasatake YAMATO KIND(L/N) 1251525538b7SMasatake YAMATO The one-letter flag and the long-name flag of kind having the role. 1252bff01330SMasatake YAMATO 1253bff01330SMasatake YAMATO NAME 1254525538b7SMasatake YAMATO The long-name flag of the role. 1255bff01330SMasatake YAMATO 1256bff01330SMasatake YAMATO ENABLED 1257329358a8SHiroo HAYASHI Whether the kind is enabled or not. It takes ``yes`` or ``no``. 1258bff01330SMasatake YAMATO 1259bff01330SMasatake YAMATO DESCRIPTION 1260bff01330SMasatake YAMATO Human readable description for the role. 1261bff01330SMasatake YAMATO 1262185906aaSHiroo HAYASHI``--list-subparsers[=(<baselang>|all)]`` 1263271ea8faSK.Takata Lists the subparsers for a base language for either the specified 1264185906aaSHiroo HAYASHI *<baselang>* or ``all`` languages, and then exits. 1265329358a8SHiroo HAYASHI ``all`` is used as default value if the option argument is omitted. 1266271ea8faSK.Takata 1267185906aaSHiroo HAYASHI``--machinable[=(yes|no)]`` 126891809da0SMasatake YAMATO Use tab character as separators for ``--list-`` option output. It 126919c65d37SK.Takata may be suitable for scripting. See "`List options`_" for considered 127091809da0SMasatake YAMATO use cases. Disabled by default. 127191809da0SMasatake YAMATO 1272185906aaSHiroo HAYASHI``--with-list-header[=(yes|no)]`` 1273ccc98105SHiroo HAYASHI Print headers describing columns in ``--list-`` option output. 1274ccc98105SHiroo HAYASHI See also "`List options`_". 1275e77d8c43SMasatake YAMATO 12760ceef997SHiroo HAYASHI.. _option_misc: 12770ceef997SHiroo HAYASHI 12780ceef997SHiroo HAYASHIMiscellaneous Options 1279ccc98105SHiroo HAYASHI~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1280e77d8c43SMasatake YAMATO 1281ccc98105SHiroo HAYASHI``--help`` 1282ccc98105SHiroo HAYASHI Prints to standard output a detailed usage description, and then exits. 1283e77d8c43SMasatake YAMATO 1284ccc98105SHiroo HAYASHI``-?`` 1285ccc98105SHiroo HAYASHI Equivalent to ``--help``. 1286e77d8c43SMasatake YAMATO 1287ccc98105SHiroo HAYASHI``--help-full`` 128855bfb323SHiroo HAYASHI Prints to standard output a detailed usage description including experimental 128955bfb323SHiroo HAYASHI features, and then exits. Visit https://docs.ctags.io/ for information 1290ccc98105SHiroo HAYASHI about the latest exciting experimental features. 1291832eb8f1SMasatake YAMATO 1292ccc98105SHiroo HAYASHI``--license`` 1293ccc98105SHiroo HAYASHI Prints a summary of the software license to standard output, and then exits. 1294d8261476SK.Takata 1295a8d3861fSMasatake YAMATO``--print-language`` 12967ab22c67SHadriel Kaplan Just prints the language parsers for specified source files, and then exits. 1297a8d3861fSMasatake YAMATO 1298185906aaSHiroo HAYASHI``--quiet[=(yes|no)]`` 1299329358a8SHiroo HAYASHI Write fewer messages (default is ``no``). 130015413bacSMasatake YAMATO 1301185906aaSHiroo HAYASHI``--totals[=(yes|no|extra)]`` 130215413bacSMasatake YAMATO Prints statistics about the source files read and the tag file written 130315413bacSMasatake YAMATO during the current invocation of @CTAGS_NAME_EXECUTABLE@. This option 1304185906aaSHiroo HAYASHI is ``no`` by default. 130515413bacSMasatake YAMATO 1306329358a8SHiroo HAYASHI The ``extra`` value prints parser specific statistics for parsers 1307a9c91f4dSMasatake YAMATO gathering such information. 1308a9c91f4dSMasatake YAMATO 1309185906aaSHiroo HAYASHI``--verbose[=(yes|no)]`` 131015413bacSMasatake YAMATO Enable verbose mode. This prints out information on option processing 131115413bacSMasatake YAMATO and a brief message describing what action is being taken for each file 131215413bacSMasatake YAMATO considered by @CTAGS_NAME_EXECUTABLE@. Normally, @CTAGS_NAME_EXECUTABLE@ 131315413bacSMasatake YAMATO does not read command line arguments until after options are read 131467c37950SMasatake YAMATO from the configuration files (see "`FILES`_", below). 131567c37950SMasatake YAMATO However, if this option is the first argument on 131615413bacSMasatake YAMATO the command line, it will take effect before any options are read from 1317329358a8SHiroo HAYASHI these sources. The default is ``no``. 131815413bacSMasatake YAMATO 1319ccc98105SHiroo HAYASHI``-V`` 1320ccc98105SHiroo HAYASHI Equivalent to ``--verbose``. 1321ccc98105SHiroo HAYASHI 13220da78f84SMasatake YAMATO``--version`` 132315413bacSMasatake YAMATO Prints a version identifier for @CTAGS_NAME_EXECUTABLE@ to standard 132415413bacSMasatake YAMATO output, and then exits. This is guaranteed to always contain the string 132515413bacSMasatake YAMATO "Universal Ctags". 132615413bacSMasatake YAMATO 13270ceef997SHiroo HAYASHIObsoleted Options 1328ccc98105SHiroo HAYASHI~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 13292b762320SHiroo HAYASHIThese options are kept for backward-compatibility with Exuberant Ctags. 13302b762320SHiroo HAYASHI 1331ccc98105SHiroo HAYASHI``-w`` 1332ccc98105SHiroo HAYASHI This option is silently ignored for backward-compatibility with the 1333ccc98105SHiroo HAYASHI ctags of SVR4 Unix. 1334ccc98105SHiroo HAYASHI 1335185906aaSHiroo HAYASHI``--file-scope[=(yes|no)]`` 1336329358a8SHiroo HAYASHI This options is removed. Use ``--extras=[+|-]F`` or 1337329358a8SHiroo HAYASHI ``--extras=[+|-]{fileScope}`` instead. 133815413bacSMasatake YAMATO 13392b762320SHiroo HAYASHI``--extra=[+|-][<flags>|*]`` 13402b762320SHiroo HAYASHI Equivalent to ``--extras=[+|-][<flags>|*]``, which was introduced to make 13412b762320SHiroo HAYASHI the option naming convention align to the other options like 13422b762320SHiroo HAYASHI ``--kinds-<LANG>=`` and ``--fields=``. 13432b762320SHiroo HAYASHI 13442b762320SHiroo HAYASHI``--<LANG>-kinds=[+|-](<kinds>|*)`` 13452b762320SHiroo HAYASHI This option is obsolete. Use ``--kinds-<LANG>=...`` instead. 13462b762320SHiroo HAYASHI 134715413bacSMasatake YAMATOOPERATIONAL DETAILS 134815413bacSMasatake YAMATO------------------- 1349fc0d7d43SMasatake YAMATOAs @CTAGS_NAME_EXECUTABLE@ considers each source file name in turn, it tries to 1350fc0d7d43SMasatake YAMATOdetermine the language of the file by applying tests described in 1351fc0d7d43SMasatake YAMATO"`Determining file language`_". 13527ab22c67SHadriel Kaplan 13537ab22c67SHadriel KaplanIf a language was identified, the file is opened and then the appropriate 135415413bacSMasatake YAMATOlanguage parser is called to operate on the currently open file. The parser 135515413bacSMasatake YAMATOparses through the file and adds an entry to the tag file for each 135619c65d37SK.Takatalanguage object it is written to handle. See "`TAG FILE FORMAT`_", below, 135719c65d37SK.Takatafor details on these entries. 135815413bacSMasatake YAMATO 135955bfb323SHiroo HAYASHINotes for C/C++ Parser 136055bfb323SHiroo HAYASHI~~~~~~~~~~~~~~~~~~~~~~~~~~ 136155bfb323SHiroo HAYASHI 136255bfb323SHiroo HAYASHI.. TODO: move the following description to parser-cxx.rst. 136355bfb323SHiroo HAYASHI 136415413bacSMasatake YAMATOThis implementation of @CTAGS_NAME_EXECUTABLE@ imposes no formatting 136515413bacSMasatake YAMATOrequirements on C code as do legacy implementations. Older implementations 136615413bacSMasatake YAMATOof ctags tended to rely upon certain formatting assumptions in order to 136715413bacSMasatake YAMATOhelp it resolve coding dilemmas caused by preprocessor conditionals. 136815413bacSMasatake YAMATO 136915413bacSMasatake YAMATOIn general, @CTAGS_NAME_EXECUTABLE@ tries to be smart about conditional 137015413bacSMasatake YAMATOpreprocessor directives. If a preprocessor conditional is encountered 137115413bacSMasatake YAMATOwithin a statement which defines a tag, @CTAGS_NAME_EXECUTABLE@ follows 137215413bacSMasatake YAMATOonly the first branch of that conditional (except in the special case of 1373329358a8SHiroo HAYASHI``#if 0``, in which case it follows only the last branch). The reason for 137415413bacSMasatake YAMATOthis is that failing to pursue only one branch can result in ambiguous 137515413bacSMasatake YAMATOsyntax, as in the following example: 137615413bacSMasatake YAMATO 1377f23de544SMasatake YAMATO.. code-block:: C 137815413bacSMasatake YAMATO 137915413bacSMasatake YAMATO #ifdef TWO_ALTERNATIVES 138015413bacSMasatake YAMATO struct { 138115413bacSMasatake YAMATO #else 138215413bacSMasatake YAMATO union { 138315413bacSMasatake YAMATO #endif 138415413bacSMasatake YAMATO short a; 138515413bacSMasatake YAMATO long b; 138615413bacSMasatake YAMATO } 138715413bacSMasatake YAMATO 138815413bacSMasatake YAMATOBoth branches cannot be followed, or braces become unbalanced and 138915413bacSMasatake YAMATO@CTAGS_NAME_EXECUTABLE@ would be unable to make sense of the syntax. 139015413bacSMasatake YAMATO 139115413bacSMasatake YAMATOIf the application of this heuristic fails to properly parse a file, 139215413bacSMasatake YAMATOgenerally due to complicated and inconsistent pairing within the 139315413bacSMasatake YAMATOconditionals, @CTAGS_NAME_EXECUTABLE@ will retry the file using a 139415413bacSMasatake YAMATOdifferent heuristic which does not selectively follow conditional 139515413bacSMasatake YAMATOpreprocessor branches, but instead falls back to relying upon a closing 1396329358a8SHiroo HAYASHIbrace ('``}``') in column 1 as indicating the end of a block once any brace 1397185906aaSHiroo HAYASHIimbalance results from following a ``#if`` conditional branch. 139815413bacSMasatake YAMATO 139915413bacSMasatake YAMATO@CTAGS_NAME_EXECUTABLE@ will also try to specially handle arguments lists 140015413bacSMasatake YAMATOenclosed in double sets of parentheses in order to accept the following 1401b8a4d244SK.Takataconditional construct:: 140215413bacSMasatake YAMATO 140315413bacSMasatake YAMATO extern void foo __ARGS((int one, char two)); 140415413bacSMasatake YAMATO 1405329358a8SHiroo HAYASHIAny name immediately preceding the '``((``' will be automatically ignored and 140615413bacSMasatake YAMATOthe previous name will be used. 140715413bacSMasatake YAMATO 140815413bacSMasatake YAMATOC++ operator definitions are specially handled. In order for consistency 140915413bacSMasatake YAMATOwith all types of operators (overloaded and conversion), the operator 141015413bacSMasatake YAMATOname in the tag file will always be preceded by the string "operator " 141115413bacSMasatake YAMATO(i.e. even if the actual operator definition was written as "operator<<"). 141215413bacSMasatake YAMATO 141315413bacSMasatake YAMATOAfter creating or appending to the tag file, it is sorted by the tag name, 141415413bacSMasatake YAMATOremoving identical tag lines. 141515413bacSMasatake YAMATO 14160228fa94SHiroo HAYASHI.. _guessing: 141715413bacSMasatake YAMATO 1418fc0d7d43SMasatake YAMATODetermining file language 141955bfb323SHiroo HAYASHI~~~~~~~~~~~~~~~~~~~~~~~~~~ 1420fc0d7d43SMasatake YAMATO 1421fc0d7d43SMasatake YAMATOFile name mapping 142255bfb323SHiroo HAYASHI.......................... 1423fc0d7d43SMasatake YAMATO 1424fc0d7d43SMasatake YAMATOUnless the ``--language-force`` option is specified, the language of each source 1425329358a8SHiroo HAYASHIfile is automatically selected based upon a *mapping* of file names to 1426fc0d7d43SMasatake YAMATOlanguages. The mappings in effect for each language may be displayed using 1427fc0d7d43SMasatake YAMATOthe ``--list-maps`` option and may be changed using the ``--langmap`` or 1428fc0d7d43SMasatake YAMATO``--map-<LANG>`` options. 1429fc0d7d43SMasatake YAMATO 1430fc0d7d43SMasatake YAMATOIf the name of a file is not mapped to a language, @CTAGS_NAME_EXECUTABLE@ tries 143155bfb323SHiroo HAYASHIto heuristically guess the language for the file by inspecting its content. 1432fc0d7d43SMasatake YAMATO 1433fc0d7d43SMasatake YAMATOAll files that have no file name mapping and no guessed parser are 1434fc0d7d43SMasatake YAMATOignored. This permits running @CTAGS_NAME_EXECUTABLE@ on all files in 1435185906aaSHiroo HAYASHIeither a single directory (e.g. "``@CTAGS_NAME_EXECUTABLE@ *``"), or on 1436fc0d7d43SMasatake YAMATOall files in an entire source directory tree 1437185906aaSHiroo HAYASHI(e.g. "``@CTAGS_NAME_EXECUTABLE@ -R``"), since only those files whose 1438fc0d7d43SMasatake YAMATOnames are mapped to languages will be scanned. 1439fc0d7d43SMasatake YAMATO 144055bfb323SHiroo HAYASHIAn extension may be mapped to multiple parsers. For example, ``.h`` 1441fc0d7d43SMasatake YAMATOare mapped to C++, C and ObjectiveC. These mappings can cause 1442fc0d7d43SMasatake YAMATOissues. @CTAGS_NAME_EXECUTABLE@ tries to select the proper parser 1443fc0d7d43SMasatake YAMATOfor the source file by applying heuristics to its content, however 1444185906aaSHiroo HAYASHIit is not perfect. In case of issues one can use ``--language-force=<language>``, 1445185906aaSHiroo HAYASHI``--langmap=<map>[,<map>[...]]``, or the ``--map-<LANG>=[+|-]<extension>|<pattern>`` 1446fc0d7d43SMasatake YAMATOoptions. (Some of the heuristics are applied whether ``--guess-language-eagerly`` 1447fc0d7d43SMasatake YAMATOis given or not.) 1448fc0d7d43SMasatake YAMATO 144955bfb323SHiroo HAYASHI.. TODO: all heuristics??? To be confirmed. 145055bfb323SHiroo HAYASHI 1451fc0d7d43SMasatake YAMATOHeuristically guessing 145255bfb323SHiroo HAYASHI.......................... 1453fc0d7d43SMasatake YAMATO 1454fc0d7d43SMasatake YAMATOIf @CTAGS_NAME_EXECUTABLE@ cannot select a parser from the mapping of file names, 1455fc0d7d43SMasatake YAMATOvarious heuristic tests are conducted to determine the language: 1456fc0d7d43SMasatake YAMATO 1457fc0d7d43SMasatake YAMATOtemplate file name testing 1458329358a8SHiroo HAYASHI If the file name has an ``.in`` extension, @CTAGS_NAME_EXECUTABLE@ applies 1459fc0d7d43SMasatake YAMATO the mapping to the file name without the extension. For example, 1460329358a8SHiroo HAYASHI ``config.h`` is tested for a file named ``config.h.in``. 1461fc0d7d43SMasatake YAMATO 1462fc0d7d43SMasatake YAMATO"interpreter" testing 1463329358a8SHiroo HAYASHI The first line of the file is checked to see if the file is a ``#!`` 1464fc0d7d43SMasatake YAMATO script for a recognized language. @CTAGS_NAME_EXECUTABLE@ looks for 1465fc0d7d43SMasatake YAMATO a parser having the same name. 1466fc0d7d43SMasatake YAMATO 1467fc0d7d43SMasatake YAMATO If @CTAGS_NAME_EXECUTABLE@ finds no such parser, 1468fc0d7d43SMasatake YAMATO @CTAGS_NAME_EXECUTABLE@ looks for the name in alias lists. For 1469329358a8SHiroo HAYASHI example, consider if the first line is ``#!/bin/sh``. Though 1470fc0d7d43SMasatake YAMATO @CTAGS_NAME_EXECUTABLE@ has a "shell" parser, it doesn't have a "sh" 1471329358a8SHiroo HAYASHI parser. However, ``sh`` is listed as an alias for ``shell``, therefore 1472fc0d7d43SMasatake YAMATO @CTAGS_NAME_EXECUTABLE@ selects the "shell" parser for the file. 1473fc0d7d43SMasatake YAMATO 147455bfb323SHiroo HAYASHI An exception is ``env``. If ``env`` is specified (for example 1475185906aaSHiroo HAYASHI "``#!/usr/bin/env python``"), @CTAGS_NAME_EXECUTABLE@ 1476fc0d7d43SMasatake YAMATO reads more lines to find real interpreter specification. 1477fc0d7d43SMasatake YAMATO 1478fc0d7d43SMasatake YAMATO To display the list of aliases, use ``--list-aliases`` option. 147955bfb323SHiroo HAYASHI To add an item to the list or to remove an item from the list, use the 1480185906aaSHiroo HAYASHI ``--alias-<LANG>=+<pattern>`` or ``--alias-<LANG>=-<pattern>`` option 148155bfb323SHiroo HAYASHI respectively. 1482fc0d7d43SMasatake YAMATO 1483fc0d7d43SMasatake YAMATO"zsh autoload tag" testing 1484329358a8SHiroo HAYASHI If the first line starts with ``#compdef`` or ``#autoload``, 1485fc0d7d43SMasatake YAMATO @CTAGS_NAME_EXECUTABLE@ regards the line as "zsh". 1486fc0d7d43SMasatake YAMATO 1487fc0d7d43SMasatake YAMATO"emacs mode at the first line" testing 1488fc0d7d43SMasatake YAMATO The Emacs editor has multiple editing modes specialized for programming 1489fc0d7d43SMasatake YAMATO languages. Emacs can recognize a marker called modeline in a file 1490fc0d7d43SMasatake YAMATO and utilize the marker for the mode selection. This heuristic test does 1491fc0d7d43SMasatake YAMATO the same as what Emacs does. 1492fc0d7d43SMasatake YAMATO 1493329358a8SHiroo HAYASHI @CTAGS_NAME_EXECUTABLE@ treats ``MODE`` as a name of interpreter and applies the same 1494fc0d7d43SMasatake YAMATO rule of "interpreter" testing if the first line has one of 1495fc0d7d43SMasatake YAMATO the following patterns:: 1496fc0d7d43SMasatake YAMATO 1497fc0d7d43SMasatake YAMATO -*- mode: MODE -*- 1498fc0d7d43SMasatake YAMATO 1499fc0d7d43SMasatake YAMATO or 1500fc0d7d43SMasatake YAMATO 1501fc0d7d43SMasatake YAMATO :: 1502fc0d7d43SMasatake YAMATO 1503fc0d7d43SMasatake YAMATO -*- MODE -*- 1504fc0d7d43SMasatake YAMATO 1505fc0d7d43SMasatake YAMATO"emacs mode at the EOF" testing 1506fc0d7d43SMasatake YAMATO Emacs editor recognizes another marker at the end of file as a 1507fc0d7d43SMasatake YAMATO mode specifier. This heuristic test does the same as what Emacs does. 1508fc0d7d43SMasatake YAMATO 1509329358a8SHiroo HAYASHI @CTAGS_NAME_EXECUTABLE@ treats ``MODE`` as a name of an interpreter and applies the same 1510fc0d7d43SMasatake YAMATO rule of "interpreter" heuristic testing, if the lines at the tail of the file 1511fc0d7d43SMasatake YAMATO have the following pattern:: 1512fc0d7d43SMasatake YAMATO 1513fc0d7d43SMasatake YAMATO Local Variables: 1514fc0d7d43SMasatake YAMATO ... 1515fc0d7d43SMasatake YAMATO mode: MODE 1516fc0d7d43SMasatake YAMATO ... 1517fc0d7d43SMasatake YAMATO End: 1518fc0d7d43SMasatake YAMATO 1519fc0d7d43SMasatake YAMATO 3000 characters are sought from the end of file to find the pattern. 1520fc0d7d43SMasatake YAMATO 1521fc0d7d43SMasatake YAMATO"vim modeline" testing 1522fc0d7d43SMasatake YAMATO Like the modeline of the Emacs editor, Vim editor has the same concept. 1523329358a8SHiroo HAYASHI @CTAGS_NAME_EXECUTABLE@ treats ``TYPE`` as a name of interpreter and applies the same 1524fc0d7d43SMasatake YAMATO rule of "interpreter" heuristic testing if the last 5 lines of the file 1525fc0d7d43SMasatake YAMATO have one of the following patterns:: 1526fc0d7d43SMasatake YAMATO 1527fc0d7d43SMasatake YAMATO filetype=TYPE 1528fc0d7d43SMasatake YAMATO 1529fc0d7d43SMasatake YAMATO or 1530fc0d7d43SMasatake YAMATO 1531fc0d7d43SMasatake YAMATO :: 1532fc0d7d43SMasatake YAMATO 1533fc0d7d43SMasatake YAMATO ft=TYPE 1534fc0d7d43SMasatake YAMATO 1535fc0d7d43SMasatake YAMATO"PHP marker" testing 1536329358a8SHiroo HAYASHI If the first line is started with ``<?php``, 1537fc0d7d43SMasatake YAMATO @CTAGS_NAME_EXECUTABLE@ regards the line as "php". 1538fc0d7d43SMasatake YAMATO 1539fc0d7d43SMasatake YAMATOLooking into the file contents is a more expensive operation than file 1540fc0d7d43SMasatake YAMATOname matching. So @CTAGS_NAME_EXECUTABLE@ runs the testings in limited 1541fc0d7d43SMasatake YAMATOconditions. "interpreter" testing is enabled only when a file is an 1542fc0d7d43SMasatake YAMATOexecutable or the ``--guess-language-eagerly`` (``-G`` in short) option is 1543fc0d7d43SMasatake YAMATOgiven. The other heuristic tests are enabled only when ``-G`` option is 1544fc0d7d43SMasatake YAMATOgiven. 1545fc0d7d43SMasatake YAMATO 1546fc0d7d43SMasatake YAMATOThe ``--print-language`` option can be used just to print the results of 1547fc0d7d43SMasatake YAMATOparser selections for given files instead of generating a tags file. 1548fc0d7d43SMasatake YAMATO 1549fc0d7d43SMasatake YAMATOExamples: 1550fc0d7d43SMasatake YAMATO 1551fc0d7d43SMasatake YAMATO.. code-block:: console 1552fc0d7d43SMasatake YAMATO 1553fc0d7d43SMasatake YAMATO $ @CTAGS_NAME_EXECUTABLE@ --print-language config.h.in input.m input.unknown 1554fc0d7d43SMasatake YAMATO config.h.in: C++ 1555fc0d7d43SMasatake YAMATO input.m: MatLab 1556fc0d7d43SMasatake YAMATO input.unknown: NONE 1557fc0d7d43SMasatake YAMATO 1558fc0d7d43SMasatake YAMATO``NONE`` means that @CTAGS_NAME_EXECUTABLE@ does not select any parser for the file. 1559fc0d7d43SMasatake YAMATO 156015413bacSMasatake YAMATOTAG FILE FORMAT 156115413bacSMasatake YAMATO--------------- 156215413bacSMasatake YAMATO 156382af7a26SHiroo HAYASHIThis section describes the tag file format briefly. See tags(5) and 156482af7a26SHiroo HAYASHIctags-client-tools(7) for more details. 156582af7a26SHiroo HAYASHI 156615413bacSMasatake YAMATOWhen not running in etags mode, each entry in the tag file consists of a 156782af7a26SHiroo HAYASHIseparate line, each looking like this, called *regular tags*, in the most general case: 156815413bacSMasatake YAMATO 156955bfb323SHiroo HAYASHI:: 157055bfb323SHiroo HAYASHI 1571185906aaSHiroo HAYASHI <tag_name><TAB><file_name><TAB><ex_cmd>;"<TAB><extension_fields> 157215413bacSMasatake YAMATO 157315413bacSMasatake YAMATOThe fields and separators of these lines are specified as follows: 157415413bacSMasatake YAMATO 1575185906aaSHiroo HAYASHI 1. ``<tag_name>``: tag name 157682af7a26SHiroo HAYASHI 2. ``<TAB>``: single tab character 1577185906aaSHiroo HAYASHI 3. ``<file_name>``: name of the file in which the object associated with the tag is located 157882af7a26SHiroo HAYASHI 4. ``<TAB>``: single tab character 1579185906aaSHiroo HAYASHI 5. ``<ex_cmd>``: EX command used to locate the tag within the file; generally a 158082af7a26SHiroo HAYASHI search pattern (either ``/pattern/`` or ``?pattern?``) or line number (see 1581185906aaSHiroo HAYASHI ``--excmd=<type>`` option). 1582185906aaSHiroo HAYASHI 6. ``;"<TAB><extension_fields>``: a set of extension fields. See 158382af7a26SHiroo HAYASHI "`Extension fields`_" for more details. 158415413bacSMasatake YAMATO 158582af7a26SHiroo HAYASHI Tag file format 2 (see ``--format``) extends the EX command 158682af7a26SHiroo HAYASHI to include the extension fields embedded in an EX comment immediately appended 158782af7a26SHiroo HAYASHI to the EX command, which leaves it backward-compatible with original 158882af7a26SHiroo HAYASHI ``vi(1)`` implementations. 158982af7a26SHiroo HAYASHI 159082af7a26SHiroo HAYASHIA few special tags, called *pseudo tags*, are written into the tag file for internal purposes. 159182af7a26SHiroo HAYASHI 159282af7a26SHiroo HAYASHI:: 159382af7a26SHiroo HAYASHI 159482af7a26SHiroo HAYASHI !_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/ 159582af7a26SHiroo HAYASHI !_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/ 159682af7a26SHiroo HAYASHI ... 159782af7a26SHiroo HAYASHI 1598185906aaSHiroo HAYASHI``--pseudo-tags=[+|-](<pseudo-tag>|*)`` option enables or disables emitting pseudo-tags. 159982af7a26SHiroo HAYASHI 1600185906aaSHiroo HAYASHISee the output of "``@CTAGS_NAME_EXECUTABLE@ --list-pseudo-tags``" for the list of 160182af7a26SHiroo HAYASHIthe kinds. 160282af7a26SHiroo HAYASHISee also tags(5) and ctags-client-tools(7) for more details of the pseudo tags. 160382af7a26SHiroo HAYASHI 160415413bacSMasatake YAMATOThese tags are composed in such a way that they always sort to the top of 160515413bacSMasatake YAMATOthe file. Therefore, the first two characters of these tags are used a magic 160615413bacSMasatake YAMATOnumber to detect a tag file for purposes of determining whether a 160715413bacSMasatake YAMATOvalid tag file is being overwritten rather than a source file. 160815413bacSMasatake YAMATO 160915413bacSMasatake YAMATONote that the name of each source file will be recorded in the tag file 161015413bacSMasatake YAMATOexactly as it appears on the command line. Therefore, if the path you 161115413bacSMasatake YAMATOspecified on the command line was relative to the current directory, then 161215413bacSMasatake YAMATOit will be recorded in that same manner in the tag file. See, however, 1613185906aaSHiroo HAYASHIthe ``--tag-relative=(yes|no|always|never)`` option for how this behavior can be 161482af7a26SHiroo HAYASHImodified. 161546f789a5SHiroo HAYASHI 1616715a3003SHiroo HAYASHI.. _tag_entries: 1617715a3003SHiroo HAYASHI 161846f789a5SHiroo HAYASHITAG ENTRIES 161946f789a5SHiroo HAYASHI----------- 162046f789a5SHiroo HAYASHI 162146f789a5SHiroo HAYASHIA tag is an index for a language object. The concept of a tag and related 162246f789a5SHiroo HAYASHIitems in Exuberant Ctags are refined and extended in Universal Ctags. 162346f789a5SHiroo HAYASHI 162446f789a5SHiroo HAYASHIA tag is categorized into *definition tags* or *reference tags*. 162546f789a5SHiroo HAYASHIIn general, Exuberant Ctags only tags *definitions* of 162646f789a5SHiroo HAYASHIlanguage objects: places where newly named language objects *are introduced*. 162746f789a5SHiroo HAYASHIUniversal Ctags, on the other hand, can also tag *references* of language 162846f789a5SHiroo HAYASHIobjects: places where named language objects *are used*. However, support 162946f789a5SHiroo HAYASHIfor generating reference tags is new and limited to specific areas of 163046f789a5SHiroo HAYASHIspecific languages in the current version. 163146f789a5SHiroo HAYASHI 163282af7a26SHiroo HAYASHIExtension fields 163382af7a26SHiroo HAYASHI~~~~~~~~~~~~~~~~ 163446f789a5SHiroo HAYASHI 163582af7a26SHiroo HAYASHIA tag can record various information, called *extension fields*. 163646f789a5SHiroo HAYASHI 163715413bacSMasatake YAMATOExtension fields are tab-separated key-value pairs appended to the end of 163815413bacSMasatake YAMATOthe EX command as a comment, as described above. These key value pairs 163982af7a26SHiroo HAYASHIappear in the general form ``key:value``. 164015413bacSMasatake YAMATO 164115413bacSMasatake YAMATOIn addition, information on the scope of the tag definition may be 164215413bacSMasatake YAMATOavailable, with the key portion equal to some language-dependent construct 164315413bacSMasatake YAMATOname and its value the name declared for that construct in the program. 164415413bacSMasatake YAMATOThis scope entry indicates the scope in which the tag was found. 164515413bacSMasatake YAMATOFor example, a tag generated for a C structure member would have a scope 1646329358a8SHiroo HAYASHIlooking like ``struct:myStruct``. 164715413bacSMasatake YAMATO 1648185906aaSHiroo HAYASHI``--fields=[+|-][<flags>|*]`` and ``--fields-(<LANG>|all)=[+|-][<flags>|*]`` options specifies 164982af7a26SHiroo HAYASHIwhich available extension fields are to be included in the tag entries. 165082af7a26SHiroo HAYASHI 1651185906aaSHiroo HAYASHISee the output of "``@CTAGS_NAME_EXECUTABLE@ --list-fields``" for the list of 165282af7a26SHiroo HAYASHIextension fields. 165382af7a26SHiroo HAYASHIThe essential fields are ``name``, ``input``, ``pattern``, and ``line``. 165482af7a26SHiroo HAYASHIThe meaning of major fields is as follows (long-name flag/one-letter flag): 165546f789a5SHiroo HAYASHI 165646f789a5SHiroo HAYASHI``access``/``a`` 165746f789a5SHiroo HAYASHI Indicates the visibility of this class member, where value is specific 165846f789a5SHiroo HAYASHI to the language. 165946f789a5SHiroo HAYASHI 166046f789a5SHiroo HAYASHI``end``/``e`` 166182af7a26SHiroo HAYASHI Indicates the line number of the end lines of the language object. 166282af7a26SHiroo HAYASHI 166382af7a26SHiroo HAYASHI``extras``/``E`` 166482af7a26SHiroo HAYASHI Extra tag type information. See "`Extras`_" for details. 166546f789a5SHiroo HAYASHI 166646f789a5SHiroo HAYASHI``file``/``f`` 166746f789a5SHiroo HAYASHI Indicates that the tag has file-limited visibility. This key has no 166882af7a26SHiroo HAYASHI corresponding value. Enabled by default. 166946f789a5SHiroo HAYASHI 167046f789a5SHiroo HAYASHI``implementation``/``m`` 167146f789a5SHiroo HAYASHI When present, this indicates a limited implementation (abstract vs. 167246f789a5SHiroo HAYASHI concrete) of a routine or class, where value is specific to the 167346f789a5SHiroo HAYASHI language (``virtual`` or ``pure virtual`` for C++; ``abstract`` for Java). 167446f789a5SHiroo HAYASHI 167546f789a5SHiroo HAYASHI``inherits``/``i`` 167682af7a26SHiroo HAYASHI When present, value is a comma-separated list of classes from which 167746f789a5SHiroo HAYASHI this class is derived (i.e. inherits from). 167846f789a5SHiroo HAYASHI 167982af7a26SHiroo HAYASHI``input``/``F`` 168082af7a26SHiroo HAYASHI The name of source file where ``name`` is defined or referenced. 168182af7a26SHiroo HAYASHI 168246f789a5SHiroo HAYASHI``k`` 168382af7a26SHiroo HAYASHI `Kind <Kinds>`_ of tag as one-letter. Enabled by default. 168482af7a26SHiroo HAYASHI This field has no long-name. 168546f789a5SHiroo HAYASHI See also ``kind``/``z`` flag. 168646f789a5SHiroo HAYASHI 168746f789a5SHiroo HAYASHI``K`` 168882af7a26SHiroo HAYASHI `Kind <Kinds>`_ of tag as long-name. 168982af7a26SHiroo HAYASHI This field has no long-name. 169046f789a5SHiroo HAYASHI See also ``kind``/``z`` flag. 169146f789a5SHiroo HAYASHI 169246f789a5SHiroo HAYASHI``kind``/``z`` 169382af7a26SHiroo HAYASHI Include the ``kind:`` key in `kind field <Kinds>`_. See also ``k`` and ``K`` flags. 169446f789a5SHiroo HAYASHI 169546f789a5SHiroo HAYASHI``language``/``l`` 169646f789a5SHiroo HAYASHI Language of source file containing tag 169746f789a5SHiroo HAYASHI 169846f789a5SHiroo HAYASHI``line``/``n`` 169982af7a26SHiroo HAYASHI The line number where ``name`` is defined or referenced in ``input``. 170082af7a26SHiroo HAYASHI 170182af7a26SHiroo HAYASHI``name``/``N`` 170282af7a26SHiroo HAYASHI The name of language objects. 170382af7a26SHiroo HAYASHI 1704f0a23ab8SMasatake YAMATO``nth``/``o`` 1705f0a23ab8SMasatake YAMATO The order in the parent scope. 1706f0a23ab8SMasatake YAMATO (i.e. 4th parameter in the function). 1707f0a23ab8SMasatake YAMATO 170882af7a26SHiroo HAYASHI``pattern``/``P`` 170982af7a26SHiroo HAYASHI Can be used to search the ``name`` in ``input`` 171046f789a5SHiroo HAYASHI 171146f789a5SHiroo HAYASHI``roles``/``r`` 171282af7a26SHiroo HAYASHI Roles assigned to the tag. See "`Roles`_" for more details. 171346f789a5SHiroo HAYASHI 171446f789a5SHiroo HAYASHI``s`` 171546f789a5SHiroo HAYASHI Scope of tag definition. Enabled by default. 171682af7a26SHiroo HAYASHI This field has no long-name. 171782af7a26SHiroo HAYASHI See also ``scope``/``Z`` flag. 171846f789a5SHiroo HAYASHI 171982af7a26SHiroo HAYASHI``scope``/``Z`` 172082af7a26SHiroo HAYASHI Prepend the ``scope:`` key to scope (``s``) field. 172182af7a26SHiroo HAYASHI See also ``s`` flag. 172246f789a5SHiroo HAYASHI 172346f789a5SHiroo HAYASHI``scopeKind``/``p`` 172446f789a5SHiroo HAYASHI Kind of scope as long-name 172546f789a5SHiroo HAYASHI 172646f789a5SHiroo HAYASHI``signature``/``S`` 172746f789a5SHiroo HAYASHI When present, value is a language-dependent representation of the 172882af7a26SHiroo HAYASHI signature of a routine (e.g. prototype or parameter list). A routine signature in its complete form 172946f789a5SHiroo HAYASHI specifies the return type of a routine and its formal argument list. 173046f789a5SHiroo HAYASHI This extension field is presently supported only for C-based 173146f789a5SHiroo HAYASHI languages and does not include the return type. 173246f789a5SHiroo HAYASHI 173346f789a5SHiroo HAYASHI``typeref``/``t`` 173446f789a5SHiroo HAYASHI Type and name of a variable, typedef, or return type of 173546f789a5SHiroo HAYASHI callable like function as ``typeref:`` field. 173646f789a5SHiroo HAYASHI Enabled by default. 173746f789a5SHiroo HAYASHI 173846f789a5SHiroo HAYASHIKinds 173982af7a26SHiroo HAYASHI...... 174046f789a5SHiroo HAYASHI 174182af7a26SHiroo HAYASHI``kind`` is a field which represents the *kind* of language object 174246f789a5SHiroo HAYASHIspecified by a tag. Kinds used and defined are very different between 174346f789a5SHiroo HAYASHIparsers. For example, C language defines ``macro``, ``function``, 174482af7a26SHiroo HAYASHI``variable``, ``typedef``, etc. 174546f789a5SHiroo HAYASHI 1746185906aaSHiroo HAYASHI``--kinds-(<LANG>|all)=[+|-](<kinds>|*)`` option specifies a list of language-specific 174782af7a26SHiroo HAYASHIkinds of tags (or kinds) to include in the output file for a particular 174882af7a26SHiroo HAYASHIlanguage. 174982af7a26SHiroo HAYASHI 1750185906aaSHiroo HAYASHISee the output of "``@CTAGS_NAME_EXECUTABLE@ --list-kinds-full``" for the complete 175182af7a26SHiroo HAYASHIlist of the kinds. 175282af7a26SHiroo HAYASHI 175382af7a26SHiroo HAYASHIIts value is either one of the 175482af7a26SHiroo HAYASHIcorresponding one-letter flags or a long-name flag. It is permitted 175546f789a5SHiroo HAYASHI(and is, in fact, the default) for the key portion of this field to be 175682af7a26SHiroo HAYASHIomitted. The optional behaviors are controlled with the ``--fields`` option as follows. 175782af7a26SHiroo HAYASHI 175882af7a26SHiroo HAYASHI.. code-block:: console 175982af7a26SHiroo HAYASHI 176082af7a26SHiroo HAYASHI $ ctags -o - kinds.c 176182af7a26SHiroo HAYASHI foo kinds.c /^int foo() {$/;" f typeref:typename:int 176282af7a26SHiroo HAYASHI $ ctags --fields=+k -o - kinds.c 176382af7a26SHiroo HAYASHI foo kinds.c /^int foo() {$/;" f typeref:typename:int 176482af7a26SHiroo HAYASHI $ ctags --fields=+K -o - kinds.c 176582af7a26SHiroo HAYASHI foo kinds.c /^int foo() {$/;" function typeref:typename:int 176682af7a26SHiroo HAYASHI $ ctags --fields=+z -o - kinds.c 176782af7a26SHiroo HAYASHI foo kinds.c /^int foo() {$/;" kind:f typeref:typename:int 176882af7a26SHiroo HAYASHI $ ctags --fields=+zK -o - kinds.c 176982af7a26SHiroo HAYASHI foo kinds.c /^int foo() {$/;" kind:function typeref:typename:int 177046f789a5SHiroo HAYASHI 177146f789a5SHiroo HAYASHIRoles 177282af7a26SHiroo HAYASHI...... 177346f789a5SHiroo HAYASHI 177446f789a5SHiroo HAYASHI*Role* is a newly introduced concept in Universal Ctags. Role is a 177546f789a5SHiroo HAYASHIconcept associated with reference tags, and is not implemented widely yet. 177646f789a5SHiroo HAYASHI 177746f789a5SHiroo HAYASHIAs described previously in "`Kinds`_", the ``kind`` field represents the type 177846f789a5SHiroo HAYASHIof language object specified with a tag, such as a function vs. a variable. 177946f789a5SHiroo HAYASHISpecific kinds are defined for reference tags, such as the C++ kind ``header`` for 178046f789a5SHiroo HAYASHIheader file, or Java kind ``package`` for package statements. For such reference 178146f789a5SHiroo HAYASHIkinds, a ``roles`` field can be added to distinguish the role of the reference 178246f789a5SHiroo HAYASHIkind. In other words, the ``kind`` field identifies the *what* of the language 178346f789a5SHiroo HAYASHIobject, whereas the ``roles`` field identifies the *how* of a referenced language 178446f789a5SHiroo HAYASHIobject. Roles are only used with specific kinds. 178546f789a5SHiroo HAYASHI 178682af7a26SHiroo HAYASHIFor a definition tag, this field takes ``def`` as a value. 178746f789a5SHiroo HAYASHI 178882af7a26SHiroo HAYASHIFor example, ``Baz`` is tagged as a reference tag with kind ``package`` and with 178982af7a26SHiroo HAYASHIrole ``imported`` with the following code. 179046f789a5SHiroo HAYASHI 179182af7a26SHiroo HAYASHI.. code-block:: java 179282af7a26SHiroo HAYASHI 179382af7a26SHiroo HAYASHI package Bar; 179482af7a26SHiroo HAYASHI import Baz; 179582af7a26SHiroo HAYASHI 179682af7a26SHiroo HAYASHI class Foo { 179782af7a26SHiroo HAYASHI // ... 179882af7a26SHiroo HAYASHI } 179982af7a26SHiroo HAYASHI 180082af7a26SHiroo HAYASHI.. code-block:: console 180182af7a26SHiroo HAYASHI 180282af7a26SHiroo HAYASHI $ ctags --fields=+KEr -uo - roles.java 180382af7a26SHiroo HAYASHI Bar roles.java /^package Bar;$/;" package roles:def 180482af7a26SHiroo HAYASHI Foo roles.java /^class Foo {$/;" class roles:def 180582af7a26SHiroo HAYASHI $ ctags --fields=+EKr --extras=+r -uo - roles.java 180682af7a26SHiroo HAYASHI Bar roles.java /^package Bar;$/;" package roles:def 180782af7a26SHiroo HAYASHI Baz roles.java /^import Baz;$/;" package roles:imported extras:reference 180882af7a26SHiroo HAYASHI Foo roles.java /^class Foo {$/;" class roles:def 180982af7a26SHiroo HAYASHI 1810185906aaSHiroo HAYASHI``--roles-(<LANG>|all).(<kind>|all)=[+|-][<roles>|*]`` option specifies a list of kind-specific 181182af7a26SHiroo HAYASHIroles of tags to include in the output file for a particular language. 181282af7a26SHiroo HAYASHI 1813185906aaSHiroo HAYASHIInquire the output of "``@CTAGS_NAME_EXECUTABLE@ --list-roles``" for the list of 181482af7a26SHiroo HAYASHIroles. 181546f789a5SHiroo HAYASHI 181646f789a5SHiroo HAYASHIExtras 181746f789a5SHiroo HAYASHI~~~~~~ 181846f789a5SHiroo HAYASHI 181946f789a5SHiroo HAYASHIGenerally, @CTAGS_NAME_EXECUTABLE@ tags only language objects appearing 182046f789a5SHiroo HAYASHIin source files, as is. In other words, a value for a ``name:`` field 182146f789a5SHiroo HAYASHIshould be found on the source file associated with the ``name:``. An 182246f789a5SHiroo HAYASHI``extra`` type tag (*extra*) is for tagging a language object with a processed 182346f789a5SHiroo HAYASHIname, or for tagging something not associated with a language object. A typical 182446f789a5SHiroo HAYASHIextra tag is ``qualified``, which tags a language object with a 182546f789a5SHiroo HAYASHIclass-qualified or scope-qualified name. 182646f789a5SHiroo HAYASHI 1827185906aaSHiroo HAYASHI``--extras-(<LANG>|all)=[+|-][<flags>|*]`` option specifies 182882af7a26SHiroo HAYASHIwhether to include extra tag entries for certain kinds of information. 182946f789a5SHiroo HAYASHI 183082af7a26SHiroo HAYASHIInquire the output of ``@CTAGS_NAME_EXECUTABLE@ --list-extras`` for the list of extras. 183182af7a26SHiroo HAYASHIThe meaning of major extras is as follows (long-name flag/one-letter flag): 183246f789a5SHiroo HAYASHI 183382af7a26SHiroo HAYASHI``anonymous``/none 183446f789a5SHiroo HAYASHI Include an entry for the language object that has no name like lambda 183546f789a5SHiroo HAYASHI function. This extra has no one-letter flag and is enabled by 183682af7a26SHiroo HAYASHI default. 183782af7a26SHiroo HAYASHI 183882af7a26SHiroo HAYASHI The extra tag is useful as a placeholder to fill scope fields 183946f789a5SHiroo HAYASHI for language objects defined in a language object with no name. 184046f789a5SHiroo HAYASHI 184146f789a5SHiroo HAYASHI .. code-block:: C 184246f789a5SHiroo HAYASHI 184346f789a5SHiroo HAYASHI struct { 184446f789a5SHiroo HAYASHI double x, y; 184546f789a5SHiroo HAYASHI } p = { .x = 0.0, .y = 0.0 }; 184646f789a5SHiroo HAYASHI 184746f789a5SHiroo HAYASHI '``x``' and '``y``' are the members of a structure. When filling the scope 184846f789a5SHiroo HAYASHI fields for them, @CTAGS_NAME_EXECUTABLE@ has trouble because the struct 184946f789a5SHiroo HAYASHI where '``x``' and '``y``' belong to has no name. For overcoming the trouble, 185046f789a5SHiroo HAYASHI @CTAGS_NAME_EXECUTABLE@ generates an anonymous extra tag for the struct 185146f789a5SHiroo HAYASHI and fills the scope fields with the name of the extra tag. 185246f789a5SHiroo HAYASHI 185382af7a26SHiroo HAYASHI .. code-block:: console 185446f789a5SHiroo HAYASHI 185582af7a26SHiroo HAYASHI $ ctags --fields=-f -uo - input.c 185646f789a5SHiroo HAYASHI __anon9f26d2460108 input.c /^struct {$/;" s 185746f789a5SHiroo HAYASHI x input.c /^ double x, y;$/;" m struct:__anon9f26d2460108 185846f789a5SHiroo HAYASHI y input.c /^ double x, y;$/;" m struct:__anon9f26d2460108 185982af7a26SHiroo HAYASHI p input.c /^} p = { .x = 0.0, .y = 0.0 };$/;" v typeref:struct:__anon9f26d2460108 186046f789a5SHiroo HAYASHI 186146f789a5SHiroo HAYASHI The above tag output has ``__anon9f26d2460108`` as an anonymous extra tag. 186246f789a5SHiroo HAYASHI The typeref field of '``p``' also receives the benefit of it. 186346f789a5SHiroo HAYASHI 186446f789a5SHiroo HAYASHI``fileScope``/``F`` 186546f789a5SHiroo HAYASHI Indicates whether tags scoped only for a single file (i.e. tags which 186646f789a5SHiroo HAYASHI cannot be seen outside of the file in which they are defined, such as 186746f789a5SHiroo HAYASHI language objects with ``static`` modifier of C language) should be included 186882af7a26SHiroo HAYASHI in the output. See also the ``-h`` option. 186946f789a5SHiroo HAYASHI 187082af7a26SHiroo HAYASHI This extra tag is enabled by default. Add ``--extras=-F`` option not to 187182af7a26SHiroo HAYASHI output tags scoped only for a single-file. This is the replacement for 187282af7a26SHiroo HAYASHI ``--file-scope`` option of Exuberant Ctags. 187382af7a26SHiroo HAYASHI 187482af7a26SHiroo HAYASHI .. code-block:: c 187582af7a26SHiroo HAYASHI 187682af7a26SHiroo HAYASHI static int f() { 187782af7a26SHiroo HAYASHI return 0; 187882af7a26SHiroo HAYASHI } 187982af7a26SHiroo HAYASHI int g() { 188082af7a26SHiroo HAYASHI return 0; 188182af7a26SHiroo HAYASHI } 188282af7a26SHiroo HAYASHI 188382af7a26SHiroo HAYASHI .. code-block:: console 188482af7a26SHiroo HAYASHI 188582af7a26SHiroo HAYASHI $ ctags -uo - filescope.c 188682af7a26SHiroo HAYASHI f filescope.c /^static int f() {$/;" f typeref:typename:int file: 188782af7a26SHiroo HAYASHI g filescope.c /^int g() {$/;" f typeref:typename:int 188882af7a26SHiroo HAYASHI $ ctags --extras=-F -uo - filescope.c 188982af7a26SHiroo HAYASHI g filescope.c /^int g() {$/;" f typeref:typename:int 189046f789a5SHiroo HAYASHI 189146f789a5SHiroo HAYASHI``inputFile``/``f`` 189246f789a5SHiroo HAYASHI Include an entry for the base file name of every source file 189346f789a5SHiroo HAYASHI (e.g. ``example.c``), which addresses the first line of the file. 189446f789a5SHiroo HAYASHI This flag is the replacement for ``--file-tags`` hidden option of 189546f789a5SHiroo HAYASHI Exuberant Ctags. 189646f789a5SHiroo HAYASHI 189746f789a5SHiroo HAYASHI If the ``end:`` field is enabled, the end line number of the file can be 189846f789a5SHiroo HAYASHI attached to the tag. (However, @CTAGS_NAME_EXECUTABLE@ omits the ``end:`` field 189946f789a5SHiroo HAYASHI if no newline is in the file like an empty file.) 190046f789a5SHiroo HAYASHI 190182af7a26SHiroo HAYASHI By default, @CTAGS_NAME_EXECUTABLE@ doesn't create the ``inputFile``/``f`` extra 190246f789a5SHiroo HAYASHI tag for the source file when @CTAGS_NAME_EXECUTABLE@ doesn't find a parser 190346f789a5SHiroo HAYASHI for it. Enabling ``Unknown`` parser with ``--languages=+Unknown`` forces 190446f789a5SHiroo HAYASHI @CTAGS_NAME_EXECUTABLE@ to create the extra tags for any source files. 190546f789a5SHiroo HAYASHI 190646f789a5SHiroo HAYASHI The etags mode enables the ``Unknown`` parser implicitly. 190746f789a5SHiroo HAYASHI 190846f789a5SHiroo HAYASHI``pseudo``/``p`` 190946f789a5SHiroo HAYASHI Include pseudo-tags. Enabled by default unless the tag file is 191046f789a5SHiroo HAYASHI written to standard output. See ctags-client-tools(7) about 191146f789a5SHiroo HAYASHI the detail of pseudo-tags. 191246f789a5SHiroo HAYASHI 191346f789a5SHiroo HAYASHI``qualified``/``q`` 191446f789a5SHiroo HAYASHI Include an extra class-qualified or namespace-qualified tag entry 191546f789a5SHiroo HAYASHI for each tag which is a member of a class or a namespace. 191646f789a5SHiroo HAYASHI 191746f789a5SHiroo HAYASHI This may allow easier location of a specific tags when 191846f789a5SHiroo HAYASHI multiple occurrences of a tag name occur in the tag file. 191946f789a5SHiroo HAYASHI Note, however, that this could potentially more than double 192046f789a5SHiroo HAYASHI the size of the tag file. 192146f789a5SHiroo HAYASHI 192246f789a5SHiroo HAYASHI The actual form of the qualified tag depends upon the language 192346f789a5SHiroo HAYASHI from which the tag was derived (using a form that is most 192446f789a5SHiroo HAYASHI natural for how qualified calls are specified in the 192546f789a5SHiroo HAYASHI language). For C++ and Perl, it is in the form 192646f789a5SHiroo HAYASHI ``class::member``; for Eiffel and Java, it is in the form 192746f789a5SHiroo HAYASHI ``class.member``. 192846f789a5SHiroo HAYASHI 192946f789a5SHiroo HAYASHI Note: Using backslash characters as separators forming 193046f789a5SHiroo HAYASHI qualified name in PHP. However, in tags output of 193146f789a5SHiroo HAYASHI Universal Ctags, a backslash character in a name is escaped 193246f789a5SHiroo HAYASHI with a backslash character. See tags(5) about the escaping. 193346f789a5SHiroo HAYASHI 193446f789a5SHiroo HAYASHI The following example demonstrates the ``qualified`` extra tag. 193546f789a5SHiroo HAYASHI 193646f789a5SHiroo HAYASHI .. code-block:: Java 193746f789a5SHiroo HAYASHI 193882af7a26SHiroo HAYASHI class point { 193982af7a26SHiroo HAYASHI double x; 194082af7a26SHiroo HAYASHI }; 194146f789a5SHiroo HAYASHI 194282af7a26SHiroo HAYASHI For the above source file, @CTAGS_NAME_EXECUTABLE@ tags ``point`` and ``x`` by 194346f789a5SHiroo HAYASHI default. If the ``qualified`` extra is enabled from the command line 194482af7a26SHiroo HAYASHI (``--extras=+q``), then ``point.x`` is also tagged even though the string 194582af7a26SHiroo HAYASHI "``point.x``" is not in the source code. 194682af7a26SHiroo HAYASHI 194782af7a26SHiroo HAYASHI .. code-block:: console 194882af7a26SHiroo HAYASHI 194982af7a26SHiroo HAYASHI $ ctags --fields=+K -uo - qualified.java 195082af7a26SHiroo HAYASHI point qualified.java /^class point {$/;" class 195182af7a26SHiroo HAYASHI x qualified.java /^ double x;$/;" field class:point 195282af7a26SHiroo HAYASHI $ ctags --fields=+K --extras=+q -uo - qualified.java 195382af7a26SHiroo HAYASHI point qualified.java /^class point {$/;" class 195482af7a26SHiroo HAYASHI x qualified.java /^ double x;$/;" field class:point 195582af7a26SHiroo HAYASHI point.x qualified.java /^ double x;$/;" field class:point 195646f789a5SHiroo HAYASHI 195746f789a5SHiroo HAYASHI``reference``/``r`` 195846f789a5SHiroo HAYASHI Include reference tags. See "`TAG ENTRIES`_" about reference tags. 195946f789a5SHiroo HAYASHI 196082af7a26SHiroo HAYASHI The following example demonstrates the ``reference`` extra tag. 196182af7a26SHiroo HAYASHI 196282af7a26SHiroo HAYASHI .. code-block:: c 196382af7a26SHiroo HAYASHI 196482af7a26SHiroo HAYASHI #include <stdio.h> 196582af7a26SHiroo HAYASHI #include "utils.h" 196682af7a26SHiroo HAYASHI #define X 196782af7a26SHiroo HAYASHI #undef X 196882af7a26SHiroo HAYASHI 196982af7a26SHiroo HAYASHI The ``roles:system`` or ``roles:local`` fields will be 197082af7a26SHiroo HAYASHI added depending on whether the include file name begins with '``<``' or not. 197182af7a26SHiroo HAYASHI 1972185906aaSHiroo HAYASHI "``#define X``" emits a definition tag. On the other hand "``#undef X``" emits a 197382af7a26SHiroo HAYASHI reference tag. 197482af7a26SHiroo HAYASHI 197582af7a26SHiroo HAYASHI .. code-block:: console 197682af7a26SHiroo HAYASHI 197782af7a26SHiroo HAYASHI $ ctags --fields=+EKr -uo - inc.c 197882af7a26SHiroo HAYASHI X inc.c /^#define X$/;" macro file: roles:def extras:fileScope 197982af7a26SHiroo HAYASHI $ ctags --fields=+EKr --extras=+r -uo - inc.c 198082af7a26SHiroo HAYASHI stdio.h inc.c /^#include <stdio.h>/;" header roles:system extras:reference 198182af7a26SHiroo HAYASHI utils.h inc.c /^#include "utils.h"/;" header roles:local extras:reference 198282af7a26SHiroo HAYASHI X inc.c /^#define X$/;" macro file: roles:def extras:fileScope 198382af7a26SHiroo HAYASHI X inc.c /^#undef X$/;" macro file: roles:undef extras:fileScope,reference 198482af7a26SHiroo HAYASHI 198546f789a5SHiroo HAYASHILanguage-specific fields and extras 198646f789a5SHiroo HAYASHI~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 198746f789a5SHiroo HAYASHI 198846f789a5SHiroo HAYASHIExuberant Ctags has the concept of *fields* and *extras*. They are common 198946f789a5SHiroo HAYASHIbetween parsers of different languages. Universal Ctags extends this concept 199046f789a5SHiroo HAYASHIby providing language-specific fields and extras. 199146f789a5SHiroo HAYASHI 199282af7a26SHiroo HAYASHI.. Note: kinds are language-specific since e-ctags. roles are new to u-ctags. 199382af7a26SHiroo HAYASHI 199482af7a26SHiroo HAYASHI.. TODO: move the following "Hot to ..." sections to FAQ man page when available 199515413bacSMasatake YAMATO 199615413bacSMasatake YAMATOHOW TO USE WITH VI 199715413bacSMasatake YAMATO------------------ 199815413bacSMasatake YAMATO 1999185906aaSHiroo HAYASHI``vi(1)`` will, by default, expect a tag file by the name ``tags`` in the current 200015413bacSMasatake YAMATOdirectory. Once the tag file is built, the following commands exercise 200115413bacSMasatake YAMATOthe tag indexing feature: 200215413bacSMasatake YAMATO 2003329358a8SHiroo HAYASHI``vi -t tag`` 2004329358a8SHiroo HAYASHI Start vi and position the cursor at the file and line where ``tag`` 200515413bacSMasatake YAMATO is defined. 200615413bacSMasatake YAMATO 2007329358a8SHiroo HAYASHI``:ta tag`` 200815413bacSMasatake YAMATO Find a tag. 200915413bacSMasatake YAMATO 2010329358a8SHiroo HAYASHI``Ctrl-]`` 201115413bacSMasatake YAMATO Find the tag under the cursor. 201215413bacSMasatake YAMATO 2013329358a8SHiroo HAYASHI``Ctrl-T`` 201415413bacSMasatake YAMATO Return to previous location before jump to tag (not widely implemented). 201515413bacSMasatake YAMATO 201615413bacSMasatake YAMATO 201715413bacSMasatake YAMATOHOW TO USE WITH GNU EMACS 201815413bacSMasatake YAMATO------------------------- 201915413bacSMasatake YAMATO 2020185906aaSHiroo HAYASHI``emacs(1)`` will, by default, expect a tag file by the name ``TAGS`` in the 202115413bacSMasatake YAMATOcurrent directory. Once the tag file is built, the following commands 202215413bacSMasatake YAMATOexercise the tag indexing feature: 202315413bacSMasatake YAMATO 2024329358a8SHiroo HAYASHI``M-x visit-tags-table <RET> FILE <RET>`` 2025329358a8SHiroo HAYASHI Select the tag file, ``FILE``, to use. 202615413bacSMasatake YAMATO 2027329358a8SHiroo HAYASHI``M-. [TAG] <RET>`` 202815413bacSMasatake YAMATO Find the first definition of TAG. The default tag is the identifier 202915413bacSMasatake YAMATO under the cursor. 203015413bacSMasatake YAMATO 2031329358a8SHiroo HAYASHI``M-*`` 2032329358a8SHiroo HAYASHI Pop back to where you previously invoked ``M-.``. 203315413bacSMasatake YAMATO 2034329358a8SHiroo HAYASHI``C-u M-.`` 203515413bacSMasatake YAMATO Find the next definition for the last tag. 203615413bacSMasatake YAMATO 203715413bacSMasatake YAMATOFor more commands, see the Tags topic in the Emacs info document. 203815413bacSMasatake YAMATO 203915413bacSMasatake YAMATO 204015413bacSMasatake YAMATOHOW TO USE WITH NEDIT 204115413bacSMasatake YAMATO--------------------- 204215413bacSMasatake YAMATO 204315413bacSMasatake YAMATONEdit version 5.1 and later can handle the new extended tag file format 204455bfb323SHiroo HAYASHI(see ``--format``). 204555bfb323SHiroo HAYASHI 204655bfb323SHiroo HAYASHI* To make NEdit use the tag file, select "File->Load Tags File". 204755bfb323SHiroo HAYASHI* To jump to the definition for a tag, highlight the word, then press ``Ctrl-D``. 204855bfb323SHiroo HAYASHI 204955bfb323SHiroo HAYASHINEdit 5.1 can read multiple tag files from different 2050329358a8SHiroo HAYASHIdirectories. Setting the X resource ``nedit.tagFile`` to the name of a tag 205115413bacSMasatake YAMATOfile instructs NEdit to automatically load that tag file at startup time. 205215413bacSMasatake YAMATO 205315413bacSMasatake YAMATO 205415413bacSMasatake YAMATOCAVEATS 205515413bacSMasatake YAMATO------- 205615413bacSMasatake YAMATO 205715413bacSMasatake YAMATOBecause @CTAGS_NAME_EXECUTABLE@ is neither a preprocessor nor a compiler, 205815413bacSMasatake YAMATOuse of preprocessor macros can fool @CTAGS_NAME_EXECUTABLE@ into either 205915413bacSMasatake YAMATOmissing tags or improperly generating inappropriate tags. Although 206015413bacSMasatake YAMATO@CTAGS_NAME_EXECUTABLE@ has been designed to handle certain common cases, 206115413bacSMasatake YAMATOthis is the single biggest cause of reported problems. In particular, 206215413bacSMasatake YAMATOthe use of preprocessor constructs which alter the textual syntax of C 206315413bacSMasatake YAMATOcan fool @CTAGS_NAME_EXECUTABLE@. You can work around many such problems 20640da78f84SMasatake YAMATOby using the ``-I`` option. 206515413bacSMasatake YAMATO 206615413bacSMasatake YAMATONote that since @CTAGS_NAME_EXECUTABLE@ generates patterns for locating 20670da78f84SMasatake YAMATOtags (see the ``--excmd`` option), it is entirely possible that the wrong line 206815413bacSMasatake YAMATOmay be found by your editor if there exists another source line which is 206915413bacSMasatake YAMATOidentical to the line containing the tag. The following example 207015413bacSMasatake YAMATOdemonstrates this condition: 207115413bacSMasatake YAMATO 2072f23de544SMasatake YAMATO.. code-block:: C 207315413bacSMasatake YAMATO 207415413bacSMasatake YAMATO int variable; 207515413bacSMasatake YAMATO 207615413bacSMasatake YAMATO /* ... */ 207715413bacSMasatake YAMATO void foo(variable) 207815413bacSMasatake YAMATO int variable; 207915413bacSMasatake YAMATO { 208015413bacSMasatake YAMATO /* ... */ 208115413bacSMasatake YAMATO } 208215413bacSMasatake YAMATO 208315413bacSMasatake YAMATODepending upon which editor you use and where in the code you happen to be, 208415413bacSMasatake YAMATOit is possible that the search pattern may locate the local parameter 208582af7a26SHiroo HAYASHIdeclaration before it finds the actual global variable definition, 208682af7a26SHiroo HAYASHIsince the lines (and therefore their search patterns) are 208755bfb323SHiroo HAYASHIidentical. 208855bfb323SHiroo HAYASHI 20890da78f84SMasatake YAMATOThis can be avoided by use of the ``--excmd=n`` option. 209015413bacSMasatake YAMATO 209119c65d37SK.Takata 209215413bacSMasatake YAMATOBUGS 209315413bacSMasatake YAMATO---- 209415413bacSMasatake YAMATO 2095329358a8SHiroo HAYASHI@CTAGS_NAME_EXECUTABLE@ has more options than ``ls(1)``. 209615413bacSMasatake YAMATO 209782719cb6SHiroo HAYASHI@CTAGS_NAME_EXECUTABLE@ assumes the input file is written in the correct 209882719cb6SHiroo HAYASHIgrammar. Otherwise output of ctags is undefined. In other words it has garbage 209982719cb6SHiroo HAYASHIin, garbage out (GIGO) feature. 210082719cb6SHiroo HAYASHI 210155bfb323SHiroo HAYASHI.. TODO: move the following paragraph to parser-cxx.rst. 210255bfb323SHiroo HAYASHI 2103329358a8SHiroo HAYASHIWhen parsing a C++ member function definition (e.g. ``className::function``), 210415413bacSMasatake YAMATO@CTAGS_NAME_EXECUTABLE@ cannot determine whether the scope specifier 210515413bacSMasatake YAMATOis a class name or a namespace specifier and always lists it as a class name 210615413bacSMasatake YAMATOin the scope portion of the extension fields. Also, if a C++ function 210715413bacSMasatake YAMATOis defined outside of the class declaration (the usual case), the access 210815413bacSMasatake YAMATOspecification (i.e. public, protected, or private) and implementation 210915413bacSMasatake YAMATOinformation (e.g. virtual, pure virtual) contained in the function 211015413bacSMasatake YAMATOdeclaration are not known when the tag is generated for the function 2111329358a8SHiroo HAYASHIdefinition. It will, however be available for prototypes (e.g. ``--kinds-c++=+p``). 211215413bacSMasatake YAMATO 211315413bacSMasatake YAMATONo qualified tags are generated for language objects inherited into a class. 211415413bacSMasatake YAMATO 211515413bacSMasatake YAMATOENVIRONMENT VARIABLES 211615413bacSMasatake YAMATO--------------------- 2117329358a8SHiroo HAYASHI``TMPDIR`` 211855bfb323SHiroo HAYASHI On Unix-like hosts where ``mkstemp(3)`` is available, the value of this 211915413bacSMasatake YAMATO variable specifies the directory in which to place temporary files. 212015413bacSMasatake YAMATO This can be useful if the size of a temporary file becomes too large 212115413bacSMasatake YAMATO to fit on the partition holding the default temporary directory 212255bfb323SHiroo HAYASHI defined at compilation time. 212355bfb323SHiroo HAYASHI 212455bfb323SHiroo HAYASHI @CTAGS_NAME_EXECUTABLE@ creates temporary 212515413bacSMasatake YAMATO files only if either (1) an emacs-style tag file is being 212615413bacSMasatake YAMATO generated, (2) the tag file is being sent to standard output, or 212715413bacSMasatake YAMATO (3) the program was compiled to use an internal sort algorithm to sort 212855bfb323SHiroo HAYASHI the tag files instead of the ``sort(1)`` utility of the operating system. 212955bfb323SHiroo HAYASHI If the ``sort(1)`` utility of the operating system is being used, it will 213055bfb323SHiroo HAYASHI generally observe this variable also. 213155bfb323SHiroo HAYASHI 213255bfb323SHiroo HAYASHI Note that if @CTAGS_NAME_EXECUTABLE@ 2133329358a8SHiroo HAYASHI is setuid, the value of ``TMPDIR`` will be ignored. 213415413bacSMasatake YAMATO 213519c65d37SK.Takata 213615413bacSMasatake YAMATOFILES 213715413bacSMasatake YAMATO----- 213815413bacSMasatake YAMATO 213986bc672eSMasatake YAMATO``tags`` 214086bc672eSMasatake YAMATO The default tag file created by @CTAGS_NAME_EXECUTABLE@. 214186bc672eSMasatake YAMATO 214286bc672eSMasatake YAMATO``TAGS`` 214386bc672eSMasatake YAMATO The default tag file created by @ETAGS_NAME_EXECUTABLE@. 214486bc672eSMasatake YAMATO 2145329358a8SHiroo HAYASHI``$XDG_CONFIG_HOME/ctags/*.ctags``, or ``$HOME/.config/ctags/*.ctags`` if 2146329358a8SHiroo HAYASHI``$XDG_CONFIG_HOME`` is not defined 2147f2416dcaSitchyny(on other than MS Windows) 2148f2416dcaSitchyny 2149329358a8SHiroo HAYASHI``$HOME/.ctags.d/*.ctags`` 215015413bacSMasatake YAMATO 2151329358a8SHiroo HAYASHI``$HOMEDRIVE$HOMEPATH/ctags.d/*.ctags`` (on MS Windows only) 215215413bacSMasatake YAMATO 2153329358a8SHiroo HAYASHI``.ctags.d/*.ctags`` 215415413bacSMasatake YAMATO 2155329358a8SHiroo HAYASHI``ctags.d/*.ctags`` 215615413bacSMasatake YAMATO 215755bfb323SHiroo HAYASHI If any of these configuration files exist, each will be expected to 215855bfb323SHiroo HAYASHI contain a set of default options which are read in the order listed 215967c37950SMasatake YAMATO when @CTAGS_NAME_EXECUTABLE@ starts, but before any command line options 216067c37950SMasatake YAMATO are read. This makes it possible to set up personal or project-level defaults. 216155bfb323SHiroo HAYASHI 216255bfb323SHiroo HAYASHI It 216355bfb323SHiroo HAYASHI is possible to compile @CTAGS_NAME_EXECUTABLE@ to read an additional 216455bfb323SHiroo HAYASHI configuration file before any of those shown above, which will be 216555bfb323SHiroo HAYASHI indicated if the output produced by the ``--version`` option lists the 216655bfb323SHiroo HAYASHI ``custom-conf`` feature. 216755bfb323SHiroo HAYASHI 216867c37950SMasatake YAMATO Options appearing on the command line will override options 216967c37950SMasatake YAMATO specified in these files. Only options will be read from these 217067c37950SMasatake YAMATO files. 217155bfb323SHiroo HAYASHI 217255bfb323SHiroo HAYASHI Note that the option 217355bfb323SHiroo HAYASHI files are read in line-oriented mode in which spaces are significant 217455bfb323SHiroo HAYASHI (since shell quoting is not possible) but spaces at the beginning 217555bfb323SHiroo HAYASHI of a line are ignored. Each line of the file is read as 217655bfb323SHiroo HAYASHI one command line parameter (as if it were quoted with single quotes). 217755bfb323SHiroo HAYASHI Therefore, use new lines to indicate separate command-line arguments. 217855bfb323SHiroo HAYASHI 217955bfb323SHiroo HAYASHI A line starting with '``#``' is treated as a comment. 218055bfb323SHiroo HAYASHI 218155bfb323SHiroo HAYASHI ``*.ctags`` files in a directory are loaded in alphabetical order. 218255bfb323SHiroo HAYASHI 218315413bacSMasatake YAMATO 218415413bacSMasatake YAMATOSEE ALSO 218515413bacSMasatake YAMATO-------- 218615413bacSMasatake YAMATO 2187599fcc99SMasatake YAMATOSee ctags-optlib(7) for defining (or extending) a parser 2188599fcc99SMasatake YAMATOin a configuration file. 2189599fcc99SMasatake YAMATO 219085af85b5SMasatake YAMATOSee tags(5) for the format of tag files. 219185af85b5SMasatake YAMATO 219200e59525SMasatake YAMATOSee ctags-incompatibilities(7) about known incompatible changes 2193bb84f88aSHiroo HAYASHIwith Exuberant Ctags. 219400e59525SMasatake YAMATO 219500e59525SMasatake YAMATOSee ctags-client-tools(7) if you are interested in writing 219600e59525SMasatake YAMATOa tool for processing tags files. 219700e59525SMasatake YAMATO 2198c396dfafSMasatake YAMATOSee ctags-lang-python(7) about python input specific notes. 2199c396dfafSMasatake YAMATO 2200830ca2cbSMasatake YAMATOSee readtags(1) about a client tool for binary searching a 2201830ca2cbSMasatake YAMATOname in a sorted tags file. 2202830ca2cbSMasatake YAMATO 220355bfb323SHiroo HAYASHIThe official Universal Ctags web site at: https://ctags.io/ 220415413bacSMasatake YAMATO 2205185906aaSHiroo HAYASHIAlso ``ex(1)``, ``vi(1)``, ``elvis(1)``, or, better yet, ``vim(1)``, the official editor of ctags. 2206185906aaSHiroo HAYASHIFor more information on ``vim(1)``, see the Vim web site at: https://www.vim.org/ 220715413bacSMasatake YAMATO 220815413bacSMasatake YAMATO 220915413bacSMasatake YAMATOAUTHOR 221015413bacSMasatake YAMATO------ 221115413bacSMasatake YAMATO 2212dccba5efSHiroo HAYASHIUniversal Ctags project 22132b8661bbSK.Takatahttps://ctags.io/ 221435788c86SMasatake YAMATO 221515413bacSMasatake YAMATODarren Hiebert <dhiebert@users.sourceforge.net> 221615413bacSMasatake YAMATOhttp://DarrenHiebert.com/ 221715413bacSMasatake YAMATO 221815413bacSMasatake YAMATO 221915413bacSMasatake YAMATOMOTIVATION 222015413bacSMasatake YAMATO---------- 222115413bacSMasatake YAMATO 222215413bacSMasatake YAMATO"Think ye at all times of rendering some service to every member of the 222315413bacSMasatake YAMATOhuman race." 222415413bacSMasatake YAMATO 222515413bacSMasatake YAMATO"All effort and exertion put forth by man from the fullness of his heart is 222615413bacSMasatake YAMATOworship, if it is prompted by the highest motives and the will to do 222715413bacSMasatake YAMATOservice to humanity." 222815413bacSMasatake YAMATO 222915413bacSMasatake YAMATO-- From the Baha'i Writings 223015413bacSMasatake YAMATO 223115413bacSMasatake YAMATOCREDITS 223215413bacSMasatake YAMATO------- 2233dccba5efSHiroo HAYASHIThis version of @CTAGS_NAME_EXECUTABLE@ (Universal Ctags) derived from 2234329358a8SHiroo HAYASHIthe repository, known as fishman-ctags, started by Reza Jelveh. 223515413bacSMasatake YAMATO 223655bfb323SHiroo HAYASHIThe fishman-ctags was derived from Exuberant Ctags. 223755bfb323SHiroo HAYASHI 2238329358a8SHiroo HAYASHISome parsers are taken from ``tagmanager`` of the Geany (https://www.geany.org/) 2239cf783a45SMasatake YAMATOproject. 2240cf783a45SMasatake YAMATO 2241bb84f88aSHiroo HAYASHIExuberant Ctags was originally derived from and 224215413bacSMasatake YAMATOinspired by the ctags program by Steve Kirkendall <kirkenda@cs.pdx.edu> 224315413bacSMasatake YAMATOthat comes with the Elvis vi clone (though virtually none of the original 224415413bacSMasatake YAMATOcode remains). 224515413bacSMasatake YAMATO 224615413bacSMasatake YAMATOCredit is also due Bram Moolenaar <Bram@vim.org>, the author of vim, 224715413bacSMasatake YAMATOwho has devoted so much of his time and energy both to developing the editor 224815413bacSMasatake YAMATOas a service to others, and to helping the orphans of Uganda. 224915413bacSMasatake YAMATO 2250185906aaSHiroo HAYASHIThe section entitled "`HOW TO USE WITH GNU EMACS`_" was shamelessly stolen 225115413bacSMasatake YAMATOfrom the info page for GNU etags. 2252