Monday, November 28, 2011

Exuberant Ctags and notpad++(or your preferred text editor) perfect together.

Working in a large code base? 
Want to know the usage of a variable or a function, its location, its definition and a list of the locations of created instances? 
Want it done quickly?

Exuberant Ctags and notpad++ (or your preferred text editor ) perfect together.

end of ad....

Much of the web work I've been doing at my day job I haven't really needed all the weight of a heavier IDE like Visual Studio 2010. Consequently, I've been using Notepad++ (and because I'm posturing to eventually jump on the emacs and/or vim train and wanted to use some of the unix environments tools )

Programmers from the days of old used the original ctags to mitigate the daunting task of maintaining large c code base of some pretty epic software predating the super powered (and at times super bloated) IDEs. It was written by the guy who wrote Rogue, curses, and contributed to the book The Art of Unix ProgrammingKen Arnold. Now sporting over 40 (so thats 40 +1 really lol) supported languages.

I know I'm late to the party but, better late than never. In particular I have found ctags to be amazingly useful when dealing with php, vbscript, classic asp and javascript. Languages that, by their very procedural nature, can cause a lot of spaghetti code, headaches and confusion. Maintainers of these types of projects I highly recommend it.

Exuberant Ctags Quick start (Windows)

The following directions are for the simplest of ctags configuration. You can most certainly dive more deeply into ctags to gain a grasp of all its raw power. (Mwwwaa!) But this certainly does the job if your wanting simple indexing.
  1. Download the executable from
  2. Add it to global path
  3. Open up the command line
  4. Navigate to the folder root and run
    C:\sourcecodefolder\ctags.exe -R *
    When executing that line ctags will search all code in the current directory and recursively search all sub directories for supported files and add them to its index (tag) file. From there you can use ctags to directly search the code or you could go the way of whatever text editor you are using. (See the links at the bottom for more resources)

Useful Links for Exuberant Ctags

Note* For Mac Devs, If you dont have Macports, Homebrew, Fink or  some package management solution, I would highly recommend one.