# TmCodeBrowser Manual

Version: 1.11

## Introduction

TmCodeBrowser is a TextMate plugin designed to help navigating source files. It will parse any language known to the underlying Exuberant Ctags program (enhanced by a small script to also support Objective-C). It will present classes, subroutines etc. in a TreeView. Clicking on any entry will jump to the corresponding location in the source code.

TmCodeBrowser requires OS X 10.3.9 or later and TextMate v1.1b17 REVISION 687 or later.

Note: When you edit your source code, it will become out of sync with TmCodeBrowser as line numbers shift.

## Sort

If the Sort checkbox at the top of the TmCodeBrowser panel is checked, all entries will be sorted within their categories. When unchecked, entries will be presented in the order they appear in the source file. The sort setting is remembered for each TextMate language setting.

## Configuration

You can bring up the configuration panel by clicking on the small Config button at the top of the TmCodeBrowser panel. This dialog then appears:

You can click on the TmCodeBrowser icon to get to the TmCodeBrowser homepage. Clicking on the Manual button will bring up this manual.

The panel can be set to operate in three different modes:

### Floating Panel

In this mode the TmCodeBrowser panel will always be on top of all other TextMate windows. This is handy when you like to always have the panel visible.

### Normal Panel

When this option is selected the TmCodeBrowser panel will behave like standard panels and can become obscured by other windows. To bring it to the front click on it, or use the Menu entry Window/Show CodeBrowser or it's keyboard shortcut ⌃⌘T (in case your browser does not detect this as a UTF-8 document, the previous is supposed to read Ctrl-Cmd-T).

### Hide after selection

In this mode the TmCodeBrowser panel will hide after a selection was made. In this mode it will behave much like TextMate's Go to file... panel.

### Visible at launch

If this option is selected, the TmCodeBrowser panel will automatically appear each time TextMate is launched.

TmCodeBrowser tries to be friendly to users who prefer to use the keyboard as much as possible. To make use of this set the Panel mode to your liking (probably Hide after selection). Bring the TmCodeBrowser panel up by pressing ⌃⌘T (in case your browser does not detect this as a UTF-8 document, the previous is supposed to read Ctrl-Cmd-T). Enter some characters to select the desired item, the search will behave similar to TextMate's Go to file.... use the Up and Down arrow keys to move the selection, and press the Return or Enter key to make your selection.

## Customization

TmCodeBrowser uses the Exuberant Ctags program to parse all files. Exuberant Ctags can be customized and even enhanced to parse other languages by adding some lines to the ctags configuration file. To not conflict with other ctags uses, TmCodeBrowser uses the file ~/.ctags.tmcodebrowser (clicking on this link will open the file in TextMate). If that does not exist, TmCodeBrowser will use an internal file with this default content.

The sources for the Exuberant Ctags are public, and allow anyone to add support for additional languages. However it is also possible to add rudimentary language support by simply adding a few lines to the configuration file.

Here is a brief example for latex, courtesy of Jeroen van der Ham:

	--langdef=latex
--langmap=latex:.tex
--regex-latex=/\\label\{*([^} \t]+)[ \t]*\}/\1/l,label/
--regex-latex=/^\\(sub)*section{([^}]*)}/\2/s,section/


The example above (courtesy of Jeroen van der Ham) shows how to add support for languages not supported by the Exuberant Ctags: The --langdef line gives the language a name, the --langmap line tells ctags which extensions files of this language have, and the --regex-latex lines define some regular expressions that ctags uses to parse language elements. See the Exuberant Ctags manual page for details.

The default content that TmCodeBrowser provides also adds very basic support for:

• Old style dictionary files
• Ant
• XML
• CSS
• xsb_prolog
• Latex
• Actionscript

TmCodeBrowser is free for personal use. If however you use it frequently or if you would like to support development of quality OS X software, please consider a donation. Start by clicking on the button below. Payment is handled via PayPal, no PayPal account needed and no registration required. Or better yet, if you know of any contract work for an individual who knows the Appkit inside and out (NeXT/OPENSTEP/OS X developer since 1989) please contact me!

## Change Log

• Version 1.10:
• Deal with unexpected ctags output encodings (seems language dependent)
• Add simple Applescript script support to default .ctags.tmcodebrowser file (provided by Guillaume Cerquant)
• Version 1.10:
• Updated to ctags 5.7
• Sort is now a per-language setting
• Version 1.09:
• Fixed incompatibility with Leopard
• Version 1.08:
• Added ctags regular expression for LaTex \begin{section}{Your Section Title} type sections
• TextMate took over ⌃⌘T shortcut for Select Bundle Item, so shortcut is now ⌃⌘B
• Version 1.07:
• Fix incompatibility with TextMate 1.5.1 and later.
• Version 1.06:
• Run ctags in background, terminate ctags in case it hangs.
• Version 1.05:
• If the panel is set to Hide after selection, do not hide it when the user clicks on a group
• Universal binary
• Version 1.04:
• Corrected a link in the manual
• Added Known Problems section to manual, explaining the ctags SQL parse bug
• Version 1.03:
• Possible freeze while moving the selection, fixed
• Added some quotes in Objc-C postprocessing script to avoid problems with spaces in paths
• Added line for HTML <div> sections to the default .ctags.tmcodebrowser
• Changed handling of .ctags.tmcodebrowser: If ~/.ctags.tmcodebrowser does not exist, fall back to internal default. That way users without a customized ~/.ctags.tmcodebrowser will benefit from updates to the internal default file
• Changed CFBundleVersion to a growing integer in preparation for automatic version checks by TextMate
• Fixed tabbing through the CodeBrowser panel
• Version 1.02:
• Manual button was not working in some instances, fixed
• Version 1.01: Minor bug fixes:
• Fixed a memory leak
• Use UTF-8 encoding to read back results from ctags
• Added Actionscript definition to the default .ctags.tmcodebrowser
• Version 1.0: First Release using TextMate's .tmplugin support