Skip to content

Instantly share code, notes, and snippets.

@milanglacier
Last active November 12, 2022 22:14
Show Gist options
  • Save milanglacier/72a3ca7b9fb55ab18e23aee1b33cf480 to your computer and use it in GitHub Desktop.
Save milanglacier/72a3ca7b9fb55ab18e23aee1b33cf480 to your computer and use it in GitHub Desktop.
Customized Ctags syntax for parsing R and Pandas data frame columns
# put the following under ~/.ctags.d/options.ctags, don't include this line into ~/.ctags.d/options.ctags
--langdef=Rext{base=R}
--kinddef-Rext=v,variable,a variable with named attr
--kinddef-Rext=n,nameattr,the named attributes of a variable
--_roledef-Rext.v=nondefinition,this is not a definition
--regex-Rext=/([[:alnum:]_.]+)\$[[:alnum:]_.]+\s*(<-|=)[^=]/\1/v/{scope=push}{_role=nondefinition}
--regex-Rext=/[[:alnum:]_.]+\$([[:alnum:]_.]+)\s*(<-|=)[^=]/\1/n/{scope=ref}
--regex-Rext=/[[:alnum:]_.]+\$[[:alnum:]_.]+\s*(<-|=)[^=].*///{scope=pop}{placeholder}
--regex-Rext=/([[:alnum:]_.]+)\$`.+`\s*(<-|=)[^=]/\1/v/{scope=push}{_role=nondefinition}
--regex-Rext=/[[:alnum:]_.]+\$(`.+`)\s*(<-|=)[^=]/\1/n/{scope=ref}
--regex-Rext=/[[:alnum:]_.]+\$`.+`\s*(<-|=)[^=].*///{scope=pop}{placeholder}
--regex-Rext=/([[:alnum:]_.]+)\[\[["'].+["']\]\]\s*(<-|=)[^=]/\1/v/{scope=push}{_role=nondefinition}
--regex-Rext=/[[:alnum:]_.]+\[\[["'](.+)["']\]\]\s*(<-|=)[^=]/\1/n/{scope=ref}
--regex-Rext=/[[:alnum:]_.]+\[\[["'].+["']\]\]\s*(<-|=)[^=].*///{scope=pop}{placeholder}
--langdef=Pyext{base=python}
--kinddef-Pyext=v,variable,a variable with named attr
--kinddef-Pyext=n,nameattr,the named attributes of a variable
--_roledef-Pyext.v=nondefinition,this is not a definition
--regex-Pyext=/([[:alnum:]_]+)\[["'].+["']\]\s*=[^=]/\1/v/{scope=push}{_role=nondefinition}
--regex-Pyext=/[[:alnum:]_]+\[["'](.+)["']\]\s*=[^=]/\1/n/{scope=ref}
--regex-Pyext=/[[:alnum:]_]+\[["'].+["']\]\s*=[^=].*///{scope=pop}{placeholder}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment