Skip to content

Instantly share code, notes, and snippets.

@sogaiu
Last active February 28, 2024 09:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save sogaiu/1542a94b626c70c034477f08fb670322 to your computer and use it in GitHub Desktop.
Save sogaiu/1542a94b626c70c034477f08fb670322 to your computer and use it in GitHub Desktop.
~/.ctags.d/janet.ctags -- for indexing top-level things in janet code -- usage: `ctags -R <dir>` or for emacs, `ctags -e -R <dir>` -- sorry, no destructuring support
--exclude=.git
--langdef=Janet
--langmap=Janet:.janet
--regex-janet=/^\([ \t]*def[ \t]+([^0-9:#][^ \t\[{(]+)/\1/D/
--regex-janet=/^\([ \t]*def-[ \t]+([^0-9:#][^ \t\[{(]+)/\1/d/
--regex-janet=/^\([ \t]*defglobal[ \t]+([^0-9:#][^ \t\[{(]+)/\1/g/
--regex-janet=/^\([ \t]*defmacro[ \t]+([^0-9:#][^ \t\[{(]+)/\1/M/
--regex-janet=/^\([ \t]*defmacro-[ \t]+([^0-9:#][^ \t\[{(]+)/\1/m/
--regex-janet=/^\([ \t]*defn[ \t]+([^0-9:#][^ \t\[{(]+)/\1/N/
--regex-janet=/^\([ \t]*defn-[ \t]+([^0-9:#][^ \t\[{(]+)/\1/n/
--regex-janet=/^\([ \t]*var[ \t]+([^0-9:#][^ \t\[{(]+)/\1/V/
--regex-janet=/^\([ \t]*var-[ \t]+([^0-9:#][^ \t\[{(]+)/\1/v/
--regex-janet=/^\([ \t]*varfn[ \t]+([^0-9:#][^ \t\[{(]+)/\1/R/
--regex-janet=/^\([ \t]*varglobal[ \t]+([^0-9:#][^ \t\[{(]+)/\1/G/
@MaxGyver83
Copy link

Perhaps you'll find the following to be of interest though they are specific to the case of indexing Janet's source code:

Thank you for sharing! This looks interesting. Actually, I use ludovicchabant/vim-gutentags: A Vim plugin that manages your tag files which calls ctags for me. That's why I'm happy with your ctags configuration for now. But maybe it's even possible to configure vim-gutentags to call idk-janet instead of ctags.

So my take is that removing the bits that look like ,private def might be
a better approach and have updated the gist content.

Thanks for investigating. This approach sounds reasonable!

@sogaiu
Copy link
Author

sogaiu commented Feb 28, 2024

Thanks for mentioning vim-gutentags. I'd seen it before but not set it up.

FWIW, idk-janet currently works only with Janet's source code (so only this repository). It's not likely to be useful for any other repository.

I tried but didn't make much progress on something that works for typical janet projects (like those that are meant to be installed with jpm). There are limits to what one can pull off statically with a reasonable amount of effort when there is stuff like this. The flexibility of Janet doesn't make creating tooling for it any easier (^^;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment