Skip to content

Instantly share code, notes, and snippets.

@Evizero
Last active September 22, 2022 00:49
Show Gist options
  • Save Evizero/e1595c35611c15ebf8f9 to your computer and use it in GitHub Desktop.
Save Evizero/e1595c35611c15ebf8f9 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]*(abstract)[ \t]+([^ \t({[]+).*$/\2/a,abstract/
--regex-julia=/^[ \t]*(@with_kw[ \t]+)?(immutable)[ \t]+([^ \t({[]+).*$/\3/i,immutable/
--regex-julia=/^[ \t]*(@with_kw[ \t]+)?(type|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=/^[ \t]*(@defstruct)[ \t]+([^ \t({[]+).*$/\2/t,type/
--regex-julia=/^[ \t]*(@defimmutable)[ \t]+([^ \t({[]+).*$/\2/i,immutable/
let g:tagbar_type_julia = {
\ 'ctagstype' : 'julia',
\ 'kinds' : ['a:abstract', 'i:immutable', 't:type', 'f:function', 'm:macro']
\ }
@Evizero
Copy link
Author

Evizero commented Mar 13, 2016

line 12+ in .ctags is for the SimpleStructs.jl package

@Evizero
Copy link
Author

Evizero commented Mar 13, 2016

@Evizero
Copy link
Author

Evizero commented Mar 13, 2016

A little example using the great Images.jl library

screen shot 2016-03-13 at 23 39 39

@DanielArndt
Copy link

Thanks a lot for this. I managed to get "jump to tag" working in vim again by removing the (\7, ...) and (\4, ...) in the definitions above. It doesn't seem to like the parameters. Unfortunately, then tagbar doesn't look as nice. Hopefully there is a simple way to have the best of both worlds.

@jayvn
Copy link

jayvn commented Apr 6, 2016

Thanks for this!

@nico202
Copy link

nico202 commented May 27, 2016

Hi, can you get this working if the module is prepended? (like mymodule.myfunction())
I don't know if it's my emacs setup wrong
However, thanks for this :)

@goerz
Copy link

goerz commented Feb 3, 2018

I updated this a little bit for Julia 0.6: https://gist.github.com/goerz/4235572a3bc6adfaead06dc8b3c1826f

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