start => gschem_ug

« Exporting images | gEDA gschem User Guide | Command-line arguments »

## Configuring gschem

gschem loads a series of configuration files at start-up, if they exist:

1. The suite's system configuration file, called `$PREFIX/share/gEDA/system-gafrc`
2. The suite's user configuration file, called `$HOME/.gEDA/gafrc`
3. A `gafrc` in the current working directory.
4. gschem's system configuration file, called `$PREFIX/share/gEDA/system-gschemrc`
5. gschem's user configuration file, called `$HOME/.gEDA/gschemrc`
6. A `gschemrc` in the current working directory.

`$PREFIX` denotes the base installation directory for gschem (`/usr` on most systems), and `$HOME` denotes your home directory.

These files are scripts written in Scheme, and they are executed using a Scheme interpreter. This means that you can use the configuration files as a way of customising and extending gschem (see also Extending gschem).

There are a very large number of options that affect the way gschem works, and only the most commonly-used are listed here. For a full list, see the `system-gschemrc` installed with gEDA.

### Setting colors

gschem uses three different color maps. These are:

1. Display color map — this is the normal color map used for displaying schematics in gschem.
2. Display outline color map — this color map is used for objects that are being modified (e.g. during movement or during placement of objects pasted from the clipboard).
3. Print color map — used during export to PostScript.

gschem is distributed with some full color maps, which are supplied as Scheme scripts. They can be loaded with `load`; for example, to load the default dark background color map, add the following to a configuration file:

    (load (build-path geda-rc-path "gschem-colormap-darkbg"))

You can also set individual colors using the `display-color-map`, `display-outline-color-map` and `print-color-map` functions. For example, to set the display color for nets to a light blue, you could add the following to a configuration file:

    (display-color-map '((net "#00ffff")))

Color settings should be placed in a gschem configuration file.

### Key bindings

A gschem editing action can be bound to a keystroke or a sequence of keystrokes (a key sequence). The `global-set-key` function is used to modify keybindings.

Each keystroke is defined using a string consisting of a non-modifier key name, prefixed by zero or more modifiers surrounded by angle brackets (“`<`” and “`>`”). The supported modifiers are `<Control>`, `<Shift>`, `<Alt>`, `<Super>`, `<Hyper>` and `<Meta>` (these are not available on all keyboards).

Although key bindings will be displayed in gschem using internationalised key names, you must use the English names in the configuration files.

A key sequence is a string containing two or more keystrokes separated by spaces.

Some examples:

- To bind the “New Window” command to a typed `F` followed by an `N`:

      (global-set-key "F N" 'file-new-window)

- To run the “Deselect All” command when the `Ctrl` and `Shift` keys are held down and an `A` is typed:

      (global-set-key "<Control><Shift>A" 'edit-deselect)

- To display the “Snap Size” dialog box when `O` is typed, followed by `S` typed with the `Shift` key held down:

      (global-set-key "O <Shift>S" 'options-snapsize)

Key settings should be placed in a gschem configuration file.

### Symbol and source libraries

The `component-library` function is used to add symbol libraries to the "Select Component..." window. A symbol library is a directory that contains symbol (“`.sym`”) files. To add a directory as a symbol library, add the following to your configuration file:

    (component-library "/path/to/mysymbols")

You can optionally set a different name for the library as an additional argument to `component-library`:

    (component-library "/path/to/mysymbols" "My Symbols")

To add all subdirectories of a particular directory as symbol libraries, use `component-library-search`:

    (component-library-search "/path/to/mysymbollibs/")

This will (recursively) look for directories that contain symbols below the specified path, and add them to the “Select Component…” window.

To add a directory to be searched for subcircuit schematics, use the `source-library` function. This is similar to the `component-library` function, except that it does not accept an optional name argument.

Library settings should be placed in a gEDA/gaf suite configuration file, so that the symbol libraries are available to other gEDA tools (especially gnetlist).