Skip to content

Instantly share code, notes, and snippets.

@kmARC
Created May 5, 2020 11:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kmARC/d1fa29506ef3fc088ab1a73274632cb6 to your computer and use it in GitHub Desktop.
Save kmARC/d1fa29506ef3fc088ab1a73274632cb6 to your computer and use it in GitHub Desktop.
config.ctags
# Yaml
--langmap=yaml:.yml.yaml
--regex-yaml=/^\s*([A-Za-z0-9_-]+):/\1/k,key,keys/
# Shell
--langmap=sh:+.env.envrc
--regex-sh=/(^|\s)([A-Za-z0-9_]+)=[^\s]/\2/v,var,vars/
--regex-sh=/for\s+([A-Za-z0-9_]+)\s+in/ \2/v,var,vars/
--langdef=typescript
--langmap=typescript:.ts,typescript:+.tsx
# TypeScript
--_fielddef-typescript=access,access scope
--_fielddef-typescript=signature,function signature
--fields-typescript=*
--regex-typescript=/^[ \t]*(if|do|while|for|switch|try|catch)[ \t]+///{scope=push}{placeholder}{exclusive}
--regex-typescript=/^[ \t]*return[ \t]*;?///{placeholder}{exclusive}
--regex-typescript=/^[ \t]*\}///{scope=pop}{placeholder}{exclusive}
--regex-typescript=/^[ \t]*(export)?[ \t]*(default)?[ \t]*class[ \t]+([a-zA-Z0-9_]+)/\3/c,class/{scope=push}{exclusive}
--regex-typescript=/^[ \t]*(export)?[ \t]*(default)?[ \t]*module[ \t]+([a-zA-Z0-9_]+)/\3/n,module/
--regex-typescript=/^[ \t]*(export)?[ \t]*(default)?[ \t]*(async)?[ \t]*function[ \t]+([a-zA-Z0-9_]+)(\([^)]*\))/\4/f,function/{scope=push}{_field=signature:\5}{exclusive}
--regex-typescript=/^[ \t]*(export)?[ \t]*(default)?[ \t]*(var|const|let)[ \t]+([^=;:]+)([: a-zA-Z0-9_]*)[ \t]*[=;]/\4/v,variable/{scope=ref}{_field=signature: \5}
--regex-typescript=/^[ \t]*(export)?[ \t]*(default)?[ \t]+(var|const|let)[ \t]+([a-zA-Z0-9_]+)[ \t]*=[ \t]*(async)?[ \t]+\([^)]*\)[ \t]*=>/\4/l,lambda/
--regex-typescript=/^[ \t]*(export)?[ \t]*(default)?[ \t]*interface[ \t]+([a-zA-Z0-9_]+)/\3/i,interface/
--regex-typescript=/^[ \t]*(export)?[ \t]*(default)?[ \t]*type[ \t]+([a-zA-Z0-9_]+)/\3/i,interface/
--regex-typescript=/^[ \t]*(export)?[ \t]*(default)?[ \t]*enum[ \t]+([a-zA-Z0-9_]+)/\3/e,enum/
--regex-typescript=/^[ \t]*import.*(from)?[ \t]+['"]([^'"]+)['"]/\2/I,import/{exclusive}
# Class functions and members
--regex-typescript=/^[ \t]*(async[ \t]*)?(constructor)[ \t]*(\([^)]*\))[ \t]*\{/\2/f,function/{scope=push}{_field=access:public}{_field=signature:\3}{exclusive}
--regex-typescript=/^[ \t]*(async[ \t]*)?([a-zA-Z0-9_]+)[ \t]*(\([^)]*\))[ \t]*\{/\2/f,function/{scope=push}{_field=access:public}{_field=signature:\3}{exclusive}
--regex-typescript=/^[ \t]*private[ \t]*(async[ \t]*)?([a-zA-Z0-9_]+)[ \t]*(\([^)]*\))[ \t]*\{/\2/f,function/{scope=push}{_field=access:private}{_field=signature:\3}{exclusive}
--regex-typescript=/^[ \t]*private[ \t]*([a-zA-Z0-9_]+)([ \t]*=[ \t]*[^;]*)?/\1/m,member/{scope=ref}{_field=access:private}
--regex-typescript=/^[ \t]*([a-zA-Z0-9_]+)([: a-zA-Z0-9_]*)[ \t]*[=;]/\1/m,member/{scope=ref}{_field=signature:\2}{_field=access:public}
--regex-typescript=/^[ \t]*([^ \t{]*)[\t]*\{[ \t]*$/\1//{scope=push}
--regex-typescript=/^[^{]*\{$///{scope=push}{placeholder}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment