Skip to content

Instantly share code, notes, and snippets.

@davewongillies
Forked from trlinkin/ctags
Last active May 18, 2017 04:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davewongillies/cdb55b6476d5ecf184759648c82965d5 to your computer and use it in GitHub Desktop.
Save davewongillies/cdb55b6476d5ecf184759648c82965d5 to your computer and use it in GitHub Desktop.
Ctags and vim-tagbar matching for Puppet Manifests - Based on http://comments.gmane.org/gmane.comp.sysutils.puppet.user/6152
# In your ~/.ctags
-h pp
--langdef=puppet
--langmap=puppet:.pp
--regex-puppet=/^[[:space:]]*class[[:space:]]*([a-z][a-zA-Z0-9_:\-]+)/\1/c,class/
--regex-puppet=/^[[:space:]]*stage[[:space:]]*([a-zA-Z0-9_:\-]+)/\1/t,stage/
--regex-puppet=/^[[:space:]]*site[[:space:]]*([a-zA-Z0-9_\-]+)/\1/s,site/
--regex-puppet=/^[[:space:]]*node[[:space:]]*[\'|\"]*([a-zA-Z0-9_\.\-]+)[\'|\"]*/\1/n,node/
--regex-puppet=/^[[:space:]]*define[[:space]]*([a-z][a-zA-Z0-9_:\-]+)/\1/d,definition/
--regex-puppet=/^[[:space:]]*(include|require)[[:space:]]*([a-zA-Z0-9_:]+)/\2/i,include/
--regex-puppet=/^[[:space:]]*\$([a-z][a-zA-Z0-9_:]+)[[:space]]*=/\1/v,variable/
--regex-puppet=/^[[:space:]]*([a-zA-Z0-9_:]+)[[:space:]]*\{ *[\'|\"]*([^\'\"]+)[\'|\"]*:/\1[\2]/r,resource/
--regex-puppet=/([A-Z][a-zA-Z0-9_:]+)[[:space:]]*\{/\1/f,default/
" In your ~/.vimrc
let g:tagbar_type_puppet = {
\ 'ctagstype': 'puppet',
\ 'kinds': [
\'c:class',
\'t:stage',
\'s:site',
\'n:node',
\'d:definition',
\'i:include',
\'v:variable',
\'r:resource',
\'f:default'
\]
\}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment