ctags with .ctags option file

This commit is contained in:
Jason Tian 2023-03-23 13:44:02 +08:00
parent 96f7951b72
commit 8fda8a0d62
3 changed files with 186 additions and 5 deletions

176
.ctags Normal file
View file

@ -0,0 +1,176 @@
--c++-kinds=+p
--fields=+iaS
--extras=+q
--exclude=*/.hg/*
--exclude=.hg/*
--exclude=*/.cvs/*
--exclude=.cvs/*
--exclude=*/.svn/*
--exclude=.svn/*
--exclude=*/.git/*
--exclude=.git/*
--exclude=*/compiled/*
--exclude=compiled/*
--exclude=*/public_html/*
--exclude=public_html/*
--exclude=*/.idea/*
--exclude=.idea/*
--exclude=*/bower_components/*
--exclude=bower_components/*
--exclude=*/images/*
--exclude=images/*
--exclude=*/.DS_Store/*
--exclude=.DS_Store/*
--exclude=*/log/*
--exclude=log/*
--exclude=*/target/*
--exclude=target/*
--exclude=*/deployment/*
--exclude=deployment/*
--exclude=*/vender/*
--exclude=vender/*
--exclude=*/bin-packages/*
--exclude=bin-packages/*
--exclude=*/node_modules/*
--exclude=node_modules/*
--exclude=*/doc/*
--exclude=doc/*
--exclude=*.war
--exclude=*.jar
--exclude=*.class
--exclude=*flymake*
--exclude=*.min.js
--exclude=*.test.js
--exclude=*.mock.js
--exclude=*.min.css
--exclude=*.bundle.*.js
--exclude=bundle.*.js
--exclude=*.pack.js
--exclude=*.log
--exclude=*.sql
--exclude=*.sass
--exclude=*.ftl
--exclude=tags
--exclude=TAGS
--exclude=GTAGS
--exclude=GPATH
--exclude=GRTAGS
--exclude=.#*
--tag-relative=yes
--recurse=yes
--c-kinds=+defgpstux
--langmap=java:+.aj
--langmap=markdown:.md
--regex-markdown=/^(#[^#].*)/\1/f,function/
--regex-markdown=/^(##[^#].*)/\1/f,function/
--regex-markdown=/^(###[^#].{0,19})/\1/f,function/
--regex-markdown=/^(=[^=].*)/\1/v,variable/
--regex-markdown=/^(==[^=].*)/\1/v,variable/
--regex-markdown=/^(===[^=].{0,19})/\1/v,variable/
--langmap=Rust:.rs
--regex-Rust=/^[ \t]*(#\[[^\]]\][ \t]*)*(pub[ \t]+)?(extern[ \t]+)?("[^"]+"[ \t]+)?(unsafe[ \t]+)?fn[ \t]+([[:alnum:]_]+)/\6/f,function/
--regex-Rust=/^[ \t]*(pub[ \t]+)?(type|enum|struct|mod)[ \t]+([[:alnum:]_]+)/\3/v,variable/
--regex-Rust=/^[ \t]*macro_rules![ \t]+([[:alnum:]_]+)/\1/f,function/
--regex-Rust=/^[ \t]*(pub[ \t]+)?(static|const)[ \t]+(mut[ \t]+)?([[:alnum:]_]+)/\4/v,variable/
--regex-Rust=/^[ \t]*(pub[ \t]+)?(unsafe[ \t]+)?trait[ \t]+([[:alnum:]_]+)/\3/f,function/
--regex-Rust=/^[ \t]*(pub[ \t]+)?(unsafe[ \t]+)?impl([ \t\n]*<[^>]*>)?[ \t]+(([[:alnum:]_:]+)[ \t]*(<[^>]*>)?[ \t]+(for)[ \t]+)?([[:alnum:]_]+)/\5 \7 \8/f,function/
--regex-Lua=/^.*[ \t]*function[ \t]*([:alnum:]+):([:alnum:]+)/\2/f,function/
--regex-Lua=/^[ \t]*local[ \t]+([:alnum:]+)/\1/v,variable/
--regex-Lua=/^.*[ \t]*function[ \t]*([:alnum:]+)\.([:alnum:]+).*$/\2/f,function/
--regex-Lua=/^.*[ \t]*function[ \t]*([:alnum:]+)[ \t]*\(/\1/f,function/
--regex-Lua=/^[ \t]*([:alnum:]+)[ \t]*=[ \t]*\{/\1/f,function/
--regex-Lua=/^[ \t]*module[ \t]+([:alnum:]+)\/\1/f,function/
--regex-Lua=/^[ \t]*module[ \t]+[[:alnum:]._]+\.([:alnum:]+)\/\1/f,function/
--langmap=html:.htm.html.erb.cmp.page.component
--regex-html=/[ \t]+ng-(controller|click|change|show|if|blur|focus|disabled|repeat)[ \t]*=[ \t]*['"][^[:alnum:]$]*([[:alnum:]$]{4,})/\2/a/
--regex-html=/[ \t]+<(app-[[:alnum:]$-_]{3,})/\1/a/
--langmap=javascript:.js.ts
--regex-javascript=/^[ \t]*([A-Z]+_[A-Z0-9_]+)[ \t]*[:=]/\1/v,variable/
--regex-javascript=/^[ \t]*(var|let|const)[ \t]+([[:alnum:]_$]+)[ \t]*=[ \t]*\[/\2/v,variable/
--regex-javascript=/^[ \t]*(var|let|const)[ \t]+([:upper:][[:alnum:]_$]+)[ \t]*=[ \t]*function/\2/f,function/
--regex-javascript=/^[ \t]*(export)?[ \t]*class[ \t]+([[:alnum:]_$]+)/\2/f,function/
--regex-javascript=/^[ \t]*export[ \t]+(\{[ \t]*)*([[:alnum:]_\*]*[ \t]as[ \t])([[:alnum:]_]+)/\3/f,function/
--regex-javascript=/^[ \t]*export[ \t]+(\{[ \t]*)*([[:alnum:]_\*]*[ \t]as[ \t])*([[:alnum:]_]+),[ \t]*([[:alnum:]_\*]*[ \t]as[ \t])([[:alnum:]_]+)/\5/f,function/
--regex-javascript=/^[ \t]*export[ \t]+(\{[ \t]*)*([[:alnum:]_\*]*[ \t]as[ \t])*([[:alnum:]_]+),[ \t]*([[:alnum:]_\*]*[ \t]as[ \t])*([[:alnum:]_]+),[ \t]*([[:alnum:]_\*]*[ \t]as[ \t])([[:alnum:]_]+)/\7/f,function/
--regex-javascript=/^[ \t]*export[ \t]+(var|let|const)[ \t]+([[:alnum:]_$]+)/\2/v,variable/
--regex-javascript=/^[ \t]*export[ \t]+function[ \t]+([[:alnum:]_$]+)/\1/f,function/
--regex-javascript=/^[ \t]*export[ \t]+(var|let|const)[ \t]+([[:alnum:]_$]+)[ \t]*[^,]+,[ \t]*([[:alnum:]_$]+)/\3/f,function/
--regex-javascript=/^[ \t]*export[ \t]+(var|let|const)[ \t]+([[:alnum:]_$]+)[ \t]*[^,]+,[ \t]*([[:alnum:]_$]+)[ \t]*,[ \t]*([[:alnum:]_$]+)/\4/v,variable/
--regex-javascript=/^[ \t]*export[ \t]+default[ \t]+(\{[ \t]*)*([[:alnum:]_\*]*[ \t]as[ \t])([[:alnum:]_]+)/\3/f,function/
--regex-javascript=/^[ \t]*export[ \t]+default[ \t]+(\{[ \t]*)*([[:alnum:]_\*]*[ \t]as[ \t])*([[:alnum:]_]+),[ \t]*([[:alnum:]_\*]*[ \t]as[ \t])([[:alnum:]_]+)/\5/f,function/
--regex-javascript=/^[ \t]*export[ \t]+default[ \t]+(\{[ \t]*)*([[:alnum:]_\*]*[ \t]as[ \t])*([[:alnum:]_]+),[ \t]*([[:alnum:]_\*]*[ \t]as[ \t])*([[:alnum:]_]+),[ \t]*([[:alnum:]_\*]*[ \t]as[ \t])([[:alnum:]_]+)/\7/f,function/
--regex-javascript=/^[ \t]*export[ \t]+default[ \t]+(var|let|const)[ \t]+([[:alnum:]_$]+)/\2/v,variable/
--regex-javascript=/^[ \t]*export[ \t]+default[ \t]+function[ \t]+([[:alnum:]_$]+)/\1/f,function/
--regex-javascript=/^[ \t]*export[ \t]+default[ \t]+(var|let|const)[ \t]+([[:alnum:]_$]+)[ \t]*[^,]+,[ \t]*([[:alnum:]_$]+)/\3/v,variable/
--regex-javascript=/^[ \t]*export[ \t]+default[ \t]+(var|let|const)[ \t]+([[:alnum:]_$]+)[ \t]*[^,]+,[ \t]*([[:alnum:]_$]+)[ \t]*,[ \t]*([[:alnum:]_$]+)/\4/v,variable/
--regex-javascript=/^[ \t]*\(?async[ \t]function[ \t]*([[:alnum:]_$]+)[ \t(]/\1/f,function/
--regex-javascript=/^[ \t]*(var|let|const)[ \t]+([_[:lower:]][[:alnum:]_$]+)[ \t]*=[ \t]*(async[ \t]+)?function[^\*][^\*]/\2/f,function/
--regex-javascript=/^[ \t]*(var|let|const)[ \t]+([_[:lower:]][[:alnum:]_$]+)[ \t]*=[ \t]*\([^\)]*$/\2/f,function/
--regex-javascript=/^[ \t]*(var|let|const)[ \t]+([_[:lower:]][[:alnum:]_$]+)[ \t]*=[^=]*=>/\2/f,function/
--regex-javascript=/^[ \t]*function[ \t]*\*[ \t]*([[:alnum:]_$]+)/\1/f,function/
--regex-javascript=/^[ \t]*(\*[ \t])([[:alnum:]_$]+)[ \t]*(.*)[ \t]*\{/\2/f,function/
--regex-javascript=/^[ \t]*([[:alnum:]_$]+)\.([[:alnum:]_$]+)[ \t]*=[ \t]*\(/\2/f,function/
--regex-javascript=/^[ \t]*([[:alnum:]_$]+)\.([[:alnum:]_$]+)\.([[:alnum:]_$]+)[ \t]*=[ \t]*function/\3/f,function/
--regex-javascript=/^[ \t]*([[:alnum:]_$]+)\.([[:alnum:]_$]+)\.([[:alnum:]_$]+)[ \t]*=[ \t]*\(/\3/f,function/
--regex-javascript=/^[ \t]*([[:alnum:]_$]+)[ \t]*[:=][ \t]*[\(]*function[ \t]*\(/\1/f,function/
--regex-javascript=/^[ \t]*([[:alnum:]_$]+)[ \t]*[:=][ \t]\(/\1/f,function/
--regex-javascript=/^[ \t]*([[:alnum:]_$]+)[ \t]*[:=][ \t]+async[ \t]\(+/\1/f,function/
--regex-javascript=/^[ \t]*(static|async)[ \t]+([[:alnum:]_$]+)[ \t]*\(/\2/f,function/
--regex-javascript=/^[ \t]*get[ \t]+([[:alnum:]_$]+)[ \t]*\(/\1/f,function/
--regex-javascript=/^[ \t]*set[ \t]+([[:alnum:]_$]+)[ \t]*\(/\1/f,function/
--regex-javascript=/^[ \t]*([[:alnum:]_$]+)\.([[:alnum:]_$]+)[ \t]*=[ \t]*\{/\2/v,variable/
--regex-javascript=/^[ \t]*([[:alnum:]_$]+)[ \t]*:[ \t]*[{"\/\[]/\1/v,variable/
--regex-javascript=/^[ \t]*([[:alnum:]_$]+)[ \t]*:[ \t]*([[:alnum:]_$]+)[ \t,]*$/\1/v,variable/
--regex-javascript=/^[ \t]*(var|let|const)[ \t]+([[:alnum:]_$]+)[ \t]*[=:][ \t]*['"0-9]/\2/v,variable/
--regex-javascript=/^[ \t]*(var|let|const)[ \t]+([[:alnum:]_$]+)[ \t]*[,;]/\2/v,variable/
--regex-javascript=/^[ \t]*(var|let|const)[ \t]+([[:alnum:]_$]+)[ \t]*,[ \t]*([[:alnum:]_$]+)/\3/v,variable/
--regex-javascript=/^[ \t]*(var|let|const)[ \t]+([[:alnum:]_$]+)[ \t]*,[ \t]*([[:alnum:]_$]+)[ \t]*,[ \t]*([[:alnum:]_$]+)/\4/v,variable/
--regex-javascript=/^[ \t]*keystone\.set\([ \t]*['"]([^'"]+)['"]/\1/v,variable/
--regex-javascript=/(,|^|\.)[ \t]*(public *|private *|async *)?([[:alpha:]_$][[:alnum:]_$]+)[ \t]*[:=][ \t]*(function\*?[ \t]*\(|\([^\)]*\)[\t ]+=>)/\3/f,function/
--regex-javascript=/^[ \t]*(public |async |private |static )?([[:alpha:]_$][[:alnum:]_$]{3,})[ \t]*\([[:alnum:]_$,: ]*\)[ \t]*\{/\2/f,function/
--regex-javascript=/^[ \t]*case[ \t]+'([^']+)/\1/v,variable/
--regex-javascript=/^[ \t]*@Input\(\)[ \t]+([[:alnum:]_$]+)/\1/v,variable/
--regex-javascript=/^[ \t]*(constructor)[ \t]*\(/\1/f,function/
--regex-javascript=/^[ \t]*([[:alpha:]_$][[:alnum:]_$]*):[ \t]*storeState\./\1/v,variable/
--regex-c=/[ \t]*DEFUN[ \t]*\([ \t]*"([^"]+)",.*/\1/f,function/
--langdef=less
--langmap=less:.less
--regex-less=/^[ \t]*[\.#]([[:alnum:]_-]+)/\1/v,variable/
--regex-less=/^[ \t]*\(([[:alnum:]_-]+[ \t,]+)\{/\1/v,variable/
--regex-less=/^[ \t]*@media[ \t]+([[:alnum:]_-]+)/\1/v,variable/
--langmap=ruby:+.rake
--regex-ruby=/(^|[:;])[ \t]*([:upper:][[:alnum:]_]+) *=/\2/v,variable/
--regex-ruby=/(^|;)[ \t]*(has_many|belongs_to|has_one|has_and_belongs_to_many)\(? *:([[:alnum:]_]+)/\3/f,function/
--regex-ruby=/(^|;)[ \t]*(named_)?scope\(? *:([[:alnum:]_]+)/\3/f,function/
--regex-ruby=/(^|;)[ \t]*expose\(? *:([[:alnum:]_]+)/\2/f,function/
--regex-ruby=/(^|;)[ \t]*event\(? *:([[:alnum:]_]+)/\2/f,function/
--regex-ruby=/(^|;)[ \t]*event\(? *:([[:alnum:]_]+)/\2!/f,function/
--regex-ruby=/(^|;)[ \t]*event\(? *:([[:alnum:]_]+)/\2?/f,function/
--langdef=ini
--langmap=ini:.ini
--regex-ini=/^[ \t]*\[(.*)\]/\1/v,variable/
--regex-ini=/^[ \t]*([^=]+)=(.*)/\1/v,variable/
--langmap=Go:.go
--regex-Go=/func([ \t]+([^)]+))?[ \t]+([[:alnum:]_]+)/\2/f,function/
--regex-Go=/(var|type)[ \t]+([[:alpha:]_][[:alnum:]_]+)/\2/v,variable/
--regex-fortran=/^[ \t]*MODULE[ \t]+(PROCEDURE|SUBROUTINE)[ \t]+([[:alnum:]_]+)/\2/f,function/
--langdef=orgmode
--langmap=orgmode:.org
--regex-orgmode=/<<([^>]+)>>/\1/v,variable/

View file

@ -85,10 +85,12 @@ to HTML files."
(interactive "P\nDDirectory: ")
(if sudo
(shell-command
(format "sudo ctags -e -R --tag-relative=never %s"
(format "sudo ctags --options=%s -e -R --tag-relative=never %s"
(expand-file-name ".ctags" user-emacs-directory)
(directory-file-name dir-name)))
(shell-command
(format "ctags -e -R --tag-relative=never %s"
(format "ctags --options=%s -e -R --tag-relative=never %s"
(expand-file-name ".ctags" user-emacs-directory)
(directory-file-name dir-name)))
))
@ -97,10 +99,12 @@ to HTML files."
(interactive "P\nDDirectory: ")
(if sudo
(shell-command
(format "sudo ctags -e -R --tag-relative=yes %s"
(format "sudo ctags --options=%s -e -R --tag-relative=yes %s"
(expand-file-name ".ctags" user-emacs-directory)
(directory-file-name dir-name)))
(shell-command
(format "ctags -e -R --tag-relative=yes %s"
(format "ctags --options=%s -e -R --tag-relative=yes %s"
(expand-file-name ".ctags" user-emacs-directory)
(directory-file-name dir-name)))
))

View file

@ -243,7 +243,8 @@ The installation result can be checked later manually with ctags command. Contin
;; relative path is more portable and uses less memory (this package
;; reads the tags file's content into memory)
;; https://github.com/redguardtoo/counsel-etags/pull/88
(format "ctags -e -R"))))
(format "ctags --options=%s -e -R"
(expand-file-name ".ctags" user-emacs-directory)))))
;; my config -> [[./init-misc.el::config-ce-cc]]
)
(when (or (eq system-type 'darwin) (eq system-type 'windows-nt))