Tags
Prev | Chapter 3. Usage | Next

## Tags

### Workspace tags

Tags for each document are parsed whenever a file is loaded or saved. These are shown in the Symbol list in the Sidebar. These tags are also used for autocompletion and calltips in other documents open in the current session.

The Go to Tag commands can be used with all workspace tags. See the section called “Go to tag definition”.

### Global tags

Global tags are used to provide autocompletion and calltips without having to open the corresponding source files. This is intended for library APIs, as the tags file only has to be updated when you upgrade the library.

You can load a custom global tags file in two ways:

- Using the Load Tags command in the File menu.

- By creating a directory `~/.geany/tags`, and moving or symlinking the tags files there before starting Geany.

You can either download these files or generate your own. They have the format:

`libraryname.lang_ext.tags`

lang_ext is one of the extensions set for the filetype associated with the tags. See the section called “Filetype extensions” for more information.

#### Default global tags files

For some languages, a list of global tags is loaded when the corresponding filetype is first used. Currently these are for:

- C - GTK+ and GLib

- Pascal

- PHP

- HTML - `&symbol;` completion, e.g. for ampersand, copyright, etc.

- LaTeX

#### Generating a global tags file

### Filetypes support

Currently this is not yet supported for Pascal, PHP and LaTeX filetypes.

You can generate your own global tags files by parsing a list of source files. The command is:

geany -g <Tag File> <File list>

- Tag File should be in the format described earlier - see the section called “Global tags”.

- File list is a list of filenames, each with a full path (unless you are generating C/C++ tags and have set the CFLAGS environment variable appropriately).

Example for the wxD library for the D programming language:

    geany -g wxd.d.tags /home/username/wxd/wx/*.d

##### Generating C/C++ tag files

For C/C++ tag files, `gcc` and `grep` are required, so that header files can be preprocessed to include any other headers they depend upon.

For C/C++ files, the environment variable CFLAGS should be set with appropriate `-I/path` include paths. The following example works with the `bash` shell, generating tags for the GnomeUI library:

    CFLAGS=`pkg-config --cflags libgnomeui-2.0` geany -g gnomeui.c.tags
    /usr/include/libgnomeui-2.0/gnome.h

You can adapt this command to use CFLAGS and header files appropriate for whichever libraries you want.

### Replacing the default C/C++ tags file

Geany currently uses a default global tags file `global.tags` for C and C++, commonly installed in `/usr/share/geany`. This file can be replaced with one containing tags parsed from a different set of header files. When Geany is next started, your custom tags file will be loaded instead of the default `global.tags`. You should keep a copy of the generated tags file because it will get overwritten when upgrading Geany.

This is a temporary solution - in later versions this will be unnecessary.

Prev | Up | Next
Search, replace and go to | Home | Preferences