Skip to content

Instantly share code, notes, and snippets.

@isao
Created October 30, 2018 23:50
Show Gist options
  • Select an option

  • Save isao/1d05fe1c41bcd1e966407c0b56a08dce to your computer and use it in GitHub Desktop.

Select an option

Save isao/1d05fe1c41bcd1e966407c0b56a08dce to your computer and use it in GitHub Desktop.
~/.ctags/TypeScript.ctags to index Typescript code
--langdef=TypeScript
--langmap=typescript:.ts
--langmap=typescript:+.tsx
--regex-typescript=/^[ \t]*(export([ \t]+)?)?[ \t]*class[ \t]+([a-zA-Z0-9_]+)/\3/c,classes/
--regex-typescript=/^[ \t]*(declare)?[ \t]*namespace[ \t]+([a-zA-Z0-9_]+)/\2/n,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|let|const)[ \t]+([a-zA-Z0-9_]+)/\2/v,variables/
--regex-typescript=/^[ \t]*(export)?[ \t]*(public|protected|private)[ \t]+(static)?[ \t]*([a-zA-Z0-9_]+)/\4/m,members/
--regex-typescript=/^[ \t]+([a-zA-Z$_][a-zA-Z0-9$_]*)(<[^>]+>)?\([^\)]*\): .+ \{/\1/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/t,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/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment