A zsh language definition for Ctags wrapped in tags Make target#332
A zsh language definition for Ctags wrapped in tags Make target#332vladdoster merged 5 commits intozdharma-continuum:mainfrom
tags Make target#332Conversation
Run `make tags` (or more specific targets: tags-vim, tags-emacs) to obtain a dictionary of all functions and variables.
Universal Ctags – 1500…1700!
|
Here is a presentation of the tags usage in my mcedit fork There are 1700 symbols in the index 😄 |
| tags: tags-emacs tags-vim | ||
|
|
||
| # Build only the Emacs-style `TAGS` file. | ||
| tags-emacs: | ||
| @if type ctags >/dev/null 2>&1; then \ | ||
| if ctags --version | grep >/dev/null 2>&1 "Universal Ctags"; then \ | ||
| ctags -e -R --options=share/zsh.ctags --languages=zsh \ | ||
| --pattern-length-limit=250 --maxdepth=1; \ | ||
| else \ | ||
| ctags -e -R --languages=sh --langmap=sh:.zsh; \ | ||
| fi; \ | ||
| printf "Created the Emacs \`TAGS\` file.\\n"; \ | ||
| else \ | ||
| printf 'Error: Please install a Ctags (e.g.: either the Exuberant or Universal %b' \ | ||
| 'version) utility first.\n'; \ | ||
| fi | ||
|
|
||
| # Build only the Vim-style `tags` file. | ||
| tags-vim: | ||
| @if type ctags >/dev/null 2>&1; then \ | ||
| if ctags --version | grep >/dev/null 2>&1 "Universal Ctags"; then \ | ||
| ctags -R --options=share/zsh.ctags --languages=zsh \ | ||
| --pattern-length-limit=250 --maxdepth=1; \ | ||
| else \ | ||
| ctags -R --languages=sh --langmap=sh:.zsh; \ | ||
| fi; \ | ||
| printf "Created the Vim's style \`tags\` file.\\n"; \ | ||
| else \ | ||
| printf 'Error: Please install a Ctags (e.g.: either the Exuberant or Universal %b' \ | ||
| 'version) utility first.\n'; \ | ||
| fi | ||
|
|
There was a problem hiding this comment.
I feel this would be more appropriate under a zi sub-command.
zi tags (--all|--vim|--emacs)
This lets us utilize zi output formatting and doesn't clutter the Makefile.
There was a problem hiding this comment.
this is a misuse of Make, IMHO
There was a problem hiding this comment.
There already is tags target in the Makefile that tries to use etags command so I would tell that it's ok to use Makefile for this (hence the duplication probably). But I can change to zi if you want.
There was a problem hiding this comment.
Ups, no previous tags target in existing Makefile – what I meant is that Automake projects have such targets (tags, ctags and other) created automatically for C,C++ and Fortran projects, see this page for details. is this a sufficient reassurance that Makefile is the correct place for ctags invocations?
There was a problem hiding this comment.
@vladdoster: What do you think, should the zi subcommand be created, or can it be in Makefile?
|
@vladdoster: Check this out – a browsable/searchable TAGS popup-menu, allowing quick jumping to a specific function or variable definition: https://asciinema.org/a/4zNRsZo6saHDu2ImCC5Cziiqq |
|
I've now got time to work on the pr so I reopened it. |
|
I've solved the incorrect highlighting, everything works OK (see a cast: https://asciinema.org/a/JaVB2yqHn8RC7nalwYXQu0L1B). I wonder if such feature, making zinit a part of programmers' stack, have chance of merging? That's the obstacle – do we want to add a subtle, general programming appearance to zinit? |
bc85b33 to
d9e149c
Compare
|
Hi guys @vladdoster @pschmitt @alichtman. Here is current state of it: https://asciinema.org/a/4WPnH3shbu7tQoVehpCVNAwid |
6b31d35 to
0354db0
Compare
|
A new sub-feature: ability to switch to a function-only kind listing of the symbols, see: https://asciinema.org/a/Zffgvk1yEevU5GhRzXp8Ig6fg |
0354db0 to
abdd91e
Compare
…OR on enter It's possible to jump directly from the shell to a specific function or variable definition, for example. TAGS from current $PWD is being read. It can hold any symbols for any programming language supported by Exuberant Ctags or Universal Ctags (recommended).
abdd91e to
098442b
Compare
|
@vladdoster, @pschmitt, @alichtman, @jankatins Check this out – a basic synatx highlighting in the symbol popup menu: https://asciinema.org/a/4lG1v1wYMRG8wmA3GMtWZfewY Does this PR have a chance of merging? |
|
thanks! zinit is now also a software engineering aid tool :) I wonder if there are some other such features. |
|
🎉 This PR is included in version 3.8.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Just run
make tags(or more specific targets: tags-vim, tags-emacs) toobtain a dictionary of all functions and variables.
This can be very handy, especially with a good editor. Features of
Universal Ctagsare very heavily utilized, although oldExuberant Ctagsis also supported. I've created a Zsh language definition with use ofpcreregexps, so be sure to compile this feature intouniversal ctags.PS. UPDATE: A recipe to install
universal ctags🤣 zinit has the best support and delivery 😄:Update 2: Also a recipe for
pcre2-8which can be used withuni-ctags– easy dizzy – only changed the repo ID 😄:Update 3: Turns out that the regexes are compatible with regular
{extended}regex engine that's almost certainly built withctags, so no need forpcrer2to utilize the1700symbols that this setup digs out from zinit sources 😆 .Description
Motivation and Context
Related Issue(s)
Usage examples
How Has This Been Tested?
Types of changes
Checklist: