Skip to content

Instantly share code, notes, and snippets.

@renfredxh
Last active August 7, 2020 14:16
Show Gist options
  • Save renfredxh/60f2cc6a6e45f75ad71cb920caa127e5 to your computer and use it in GitHub Desktop.
Save renfredxh/60f2cc6a6e45f75ad71cb920caa127e5 to your computer and use it in GitHub Desktop.
Typescript ctags config
--langdef=typescript
--langmap=typescript:.ts.tsx
--regex-typescript=/^[ \t]*(export)?[ \t]*class[ \t]+([a-zA-Z0-9_]+)/\2/c,classes/
--regex-typescript=/^[ \t]*(declare)?[ \t]*namespace[ \t]+([a-zA-Z0-9_]+)/\2/c,modules/
--regex-typescript=/^[ \t]*(export)?[ \t]*module[ \t]+([a-zA-Z0-9_]+)/\2/n,modules/
--regex-typescript=/^[ \t]*(export)?[ \t]*function[ \t]+([a-zA-Z0-9_]+)/\2/f,functions/
--regex-typescript=/^[ \t]*export[ \t]+var[ \t]+([a-zA-Z0-9_]+)/\1/v,variables/
--regex-typescript=/^[ \t]*var[ \t]+([a-zA-Z0-9_]+)[ \t]*=[ \t]*function[ \t]*\(\)/\1/v,varlambdas/
--regex-typescript=/^[ \t]*(export)?[ \t]*(public|protected|private)[ \t]+(static)?[ \t]*([a-zA-Z0-9_]+)/\4/m,members/
--regex-typescript=/^[ \t]*(export)?[ \t]*interface[ \t]+([a-zA-Z0-9_]+)/\2/i,interfaces/
--regex-typescript=/^[ \t]*(export)?[ \t]*type[ \t]+([a-zA-Z0-9_]+)/\2/i,types/
--regex-typescript=/^[ \t]*(export)?[ \t]*enum[ \t]+([a-zA-Z0-9_]+)/\2/e,enums/
--regex-typescript=/^[ \t]*import[ \t]+([a-zA-Z0-9_]+)/\1/I,imports/
@brandon-rhodes
Copy link

Thanks very much for sharing this! For other interested visitors — it looks like an improved and slightly expanded version of this set of regular expressions is available inside of this README:

https://github.com/c0r73x/neotags.nvim/blob/master/README.md

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