| << [[exporting|Exporting images]]  |  **[[geda:gschem_ug|gEDA gschem User Guide]]**  |  [[command_line|Command-line arguments]] >> |

===== Configuring gschem =====

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

  - The suite's system configuration file, called ''$PREFIX/share/gEDA/system-gafrc''
  - The suite's user configuration file, called ''$HOME/.gEDA/gafrc''
  - A ''gafrc'' in the current working directory.
  - gschem's system configuration file, called ''$PREFIX/share/gEDA/system-gschemrc''
  - gschem's user configuration file, called ''$HOME/.gEDA/gschemrc''
  - 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 [[extensions|Extending gschem]]).

<note>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.</note>

==== Setting colors ====

gschem uses three different color maps.  These are:

  - //Display color map// — this is the normal color map used for displaying schematics in gschem.
  - //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).
  - //Print color map// — used during export to PostScript.

gschem is distributed with some full [[viewing_schematics#color_maps|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:

<code>(load (build-path geda-rc-path "gschem-colormap-darkbg"))</code>

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:

<code>(display-color-map '((net "#00ffff")))</code>

Color settings should be placed in a gschem configuration file.
==== Key bindings ====

A gschem [[editing_actions|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).

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

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 <key>f</key> followed by an <key>n</key>: <code>(global-set-key "F N" 'file-new-window)</code>
  * To run the "Deselect All" command when the <key>Ctrl</key> and <key>Shift</key> keys are held down and an <key>a</key> is typed: <code>(global-set-key "<Control><Shift>A" 'edit-deselect)</code>
  * To display the "Snap Size" dialog box when <key>o</key> is typed, followed by <key>s</key> typed with the <key>Shift</key> key held down: <code>(global-set-key "O <Shift>S" 'options-snapsize)</code>

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 [[components|"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:

<code>(component-library "/path/to/mysymbols")</code>

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

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

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

<code>(component-library-search "/path/to/mysymbollibs/")</code>

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 [[hierarchy|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 [[geda:gnetlist_ug|gnetlist]]).
