Skip to content

Instantly share code, notes, and snippets.

@takaokouji
Created April 23, 2011 07:27
Show Gist options
  • Save takaokouji/938446 to your computer and use it in GitHub Desktop.
Save takaokouji/938446 to your computer and use it in GitHub Desktop.
global using rtags
#
# Copyright (c) 1998, 1999, 2000, 2001, 2002, 2003
# Tama Communications Corporation
#
# This file is part of GNU GLOBAL.
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# *
# Configuration file for GNU GLOBAL source code tag system.
#
# GLOBAL doesn't need 'gtags.conf' because it has the default values in it.
# But if you have this file as '/etc/gtags.conf' or "$HOME/.globalrc"
# then GLOBAL system overwrite default values with the values from the file.
#
# 'gtags.conf' is termcap style file.
# 'default' is default target.
# You can specify target with GTAGSLABEL environment variable.
#
# Variable 'suffixes' is obsoleted but is acceptable because it is needed
# for plugged-in parser. If you use gtags-parser(1) then you should use
# variable 'langmap' instead.
#
default:\
:tc=gtags:tc=htags:
#---------------------------------------------------------------------
# Configuration for gtags(1)
# See gtags(1).
#---------------------------------------------------------------------
common:\
:skip=GPATH,GTAGS,GRTAGS,GSYMS,HTML/,HTML.pub/,html/,tags,TAGS,ID,y.tab.c,y.tab.h,.notfunction,cscope.out,cscope.po.out,cscope.in.out,.gdbinit,SCCS/,RCS/,CVS/,CVSROOT/,{arch}/,.svn/,.git/,.cvsrc,.cvsignore,.gitignore,.cvspass,.cvswrappers,.deps/,autom4te.cache/,.snprj/:\
:langmap=c\:.c.h,yacc\:.y,asm\:.s.S,java\:.java,cpp\:.c++.cc.cpp.cxx.hxx.hpp.C.H,php\:.php.php3.phtml:
#
# [gtags-parser]
#
# This command is distributed as part of GLOBAL.
# The %s is replaced with the path of source file.
# You need not use --langmap=xxx option. Gtags-parser(1) get the value
# from environment variable.
#
gtags:\
:tc=common:\
:GTAGS=gtags-parser %s:\
:GRTAGS=gtags-parser -r %s:\
:GSYMS=gtags-parser -s %s:
#
# [Exuberant Ctags]
#
# This ctags is distributed as a part of Vim editor.
#
# [Installation]
# % cd <Vim source directory>/src/ctags
# % make
# # cp ctags /usr/local/bin/ctags-exuberant
#
ctags-exuberant|Exuberant Ctags|ctags by Darren Hiebert:\
:tc=common:\
:suffixes=s,a,sa,asm,C,H,cpp,cxx,hxx,hpp,cc,c,h,y:\
:extractmethod:\
:GTAGS=/usr/local/bin/ctags-exuberant -xu %s | perl -ne '\
if (/^operator \\S+\\s+function\\s/) { s/^operator //; }\
($name, $type, $no, $path, $line) = split(/[ \\t]+/, $_, 5);\
printf(STDOUT "%-16s %4d %-16s %s", $name, $no, $path, $line);':
#---------------------------------------------------------------------
# Configuration for htags(1)
# Let's paint hypertext with your favorite colors!
# See htags(1).
#---------------------------------------------------------------------
htags:\
:body_begin=<body text='#191970' bgcolor='#f5f5dc' vlink='gray'>:body_end=</body>:\
:table_begin=<table>:table_end=</table>:\
:title_begin=<h1><font color='#cc0000'>:title_end=</font></h1>:\
:comment_begin=<i><font color='green'>:comment_end=</font></i>:\
:sharp_begin=<font color='darkred'>:sharp_end=</font>:\
:brace_begin=<font color='red'>:brace_end=</font>:\
:warned_line_begin=<span style='background-color\:yellow'>:warned_line_end=</span>:\
:reserved_begin=<b>:reserved_end=</b>:script_alias=/cgi-bin/:\
:ncol#4:tabs#8:normal_suffix=html:gzipped_suffix=ghtml:\
:definition_header=no:
#
# Use rtags for extracting Ruby sources info
# I am using a modified rtags file that supports '-x' parameter to
# dump a cross reference file format
#
# We need to change some of the output that rtags dumps
#
# Module::Submodule is NOT found by global (don't know why)
# Module:Submodule IS found
# So we replace :: with :
#
# Also, dotnames are not allowed in tags
# So, when rtag parses this
# class User ; def self.validate ; end ; end
# as:
# User.validate line_no file_name line
# global doesn't find it with `global -c User`
# So we need to replace any dots in the firts column with #
# User#validate line_no file_name line
#
# So we need to to this:
# rtags -x %s | awk '{ sub(/^::/, "") ; sub(/::/, ":"); sub(/\\./, "#", $1); print}'
#
rtags:\
:tc=common:\
:suffixes=s,a,sa,asm,C,H,cpp,cxx,hxx,hpp,cc,c,h,y,rb:\
:extractmethod:\
:GTAGS=rtags -x %s | awk '{ sub(/^\:\:/, "") ; sub(/\:\:/, "\:"); sub(/\\./, "#", $1); print}':\
:GRTAGS=gtags-parser --langmap=java\:.rb -dtr %s:\
:GSYMS=gtags-parser --langmap=java\:.rb -dts %s:
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment