Skip to content

Instantly share code, notes, and snippets.

@goerz
Forked from Evizero/.ctags
Created February 3, 2018 20:20
Show Gist options
  • Save goerz/4235572a3bc6adfaead06dc8b3c1826f to your computer and use it in GitHub Desktop.
Save goerz/4235572a3bc6adfaead06dc8b3c1826f to your computer and use it in GitHub Desktop.
more comprehensive ctags definitions for the julia language based on the one in the official julia repository (inclusive vim tagbar)
--langdef=julia
--langmap=julia:.jl
--regex-julia=/^[ \t]*(@with_kw[ \t]+)?(abstract type|primitive type|struct|mutable struct|typealias)[ \t]+([^ \t({[]+).*$/\3/t,type/
--regex-julia=/^[ \t]*(macro)[ \t]+([^ \t({[]+).*$/\2/m,macro/
--regex-julia=/^[ \t]*(@inline[ \t]+|@noinline[ \t]+)?(function)[ \t]+([^ \t({[]+)[^(]*\([ \t]*([^ \t;,=)({]+).*$/\3 (\4, …)/f,function/
--regex-julia=/^[ \t]*(@inline[ \t]+|@noinline[ \t]+)?(function)[ \t]+([^ \t({[]+)[^(]*(\([ \t]*\).*|\([ \t]*)$/\3/f,function/
--regex-julia=/^[ \t]*(@inline[ \t]+|@noinline[ \t]+)?(([^@#$ \t({[]+)|\(([^@#$ \t({[]+)\)|\((\$)\))[ \t]*(\{.*\})?[ \t]*\([ \t]*\)[ \t]*=([^=].*$|$)/\3\4\5/f,function/
--regex-julia=/^[ \t]*(@inline[ \t]+|@noinline[ \t]+)?(([^@#$ \t({[]+)|\(([^@#$ \t({[]+)\)|\((\$)\))[ \t]*(\{.*\})?[ \t]*\([ \t]*([^ \t;,=)({]+).*\)[ \t]*=([^=].*$|$)/\3\4\5 (\7, …)/f,function/
--regex-julia=/^(const)[ \t]+([^ \t({[]+).*[ ]*=.*$/\2/c,const/
let g:tagbar_type_julia = {
\ 'ctagstype' : 'julia',
\ 'kinds' : [
\ 't:struct', 'f:function', 'm:macro', 'c:const']
\ }
@goerz
Copy link
Author

goerz commented Feb 4, 2018

Note that these rules are specifically for use with the tagbar plugin.

They are not suitable for running ctags manually, as e.g. function arguments are included in the tag name. This works well for tagbar, but it doesn't allow you to jump to tags with ctrl+]

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