Skip to content

Instantly share code, notes, and snippets.

@hdeshev
Last active May 4, 2017 17:01
Show Gist options
  • Save hdeshev/2090003513004288c86d to your computer and use it in GitHub Desktop.
Save hdeshev/2090003513004288c86d to your computer and use it in GitHub Desktop.
ctags extras
--langdef=css
--langmap=css:.css
--langmap=css:+.scss
--langmap=css:+.sass
--langmap=css:+.styl
--langmap=css:+.less
--regex-css=/^[ \t]*(([A-Za-z0-9_-]+[ \t\n,]+)+)\{/\1/t,tag,tags/
--regex-css=/^[ \t]*#([A-Za-z0-9_-]+)/#\1/i,id,ids/
--regex-css=/^[ \t]*\.([A-Za-z0-9_-]+)/\1/c,class,classes/
--langdef=typescript
--langmap=typescript:.ts
--langmap=typescript:+.es6
--langmap=typescript:+.js
--regex-typescript=/^[ \t]*(export|declare)?.*class[ \t]+([a-zA-Z0-9_]+)/\2/c,classes/
--regex-typescript=/^[ \t]*(export)?[ \t]*module[ \t]+([a-zA-Z0-9_]+)/\2/n,modules/
--regex-typescript=/^[ \t]*(export|declare)?.*function[ \t]+([a-zA-Z0-9_]+)[ \t]*\(/\2/f,functions/
--regex-typescript=/^[ \t]*(export|declare).*[ \t]+var[ \t]+([a-zA-Z0-9_]+)/\2/v,variables/
--regex-typescript=/^[ \t]*(export|declare).*[ \t]+const[ \t]+([a-zA-Z0-9_]+)/\2/v,variables/
--regex-typescript=/^[ \t]*var[ \t]+([a-zA-Z0-9_]+)[ \t]*=[ \t]*function[ \t]*\(\)/\1/v,varlambdas/
--regex-typescript=/^[ \t]*(export)?[ \t]*(public|private)[ \t]+(static)?[ \t]*([a-zA-Z0-9_]+)/\4/m,members/
--regex-typescript=/^[ \t]*(static|abstract)?[ \t]*([a-zA-Z0-9_]+)[ \t]*\(/\2/m,members/
--regex-typescript=/^[ \t]*(static|abstract)?[ \t]*([gs]et)[ \t]+([a-zA-Z0-9_]+)/\3/m,members/
--regex-typescript=/^[ \t]*(export|declare)?.*interface[ \t]+([a-zA-Z0-9_]+)/\2/i,interfaces/
--regex-typescript=/^[ \t]*(export|declare)?.*enum[ \t]+([a-zA-Z0-9_]+)/\2/e,enums/
#!/bin/sh
ctags -R \
--exclude=node_modules \
--exclude=platforms \
--exclude='*.js'
add_ctags() {
LOCATION=$1
PATTERN=${2:-*.d.ts}
find "$LOCATION" -iname "$PATTERN" -exec ctags -a \{\} \;
}
add_ctags "node_modules/angular2"
add_ctags "node_modules/tns-core-modules"
sed -r -i '/^(if|for|forEach|while|switch|super|function|return)\b/d' tags
#!/bin/sh
# filter out certain tags added by imperfect regexes
ctags $@ | egrep -v '^(if|for|while|switch|super|function|return)\b'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment