The .spyrc File
A .spyrc file in your home directory allows you to customize spy with a list of key-mappings. Each entry assigns a commonly used command to a single keystroke. For example, the default .spyrc file assigns hview to the 1 key, and launch Houdini is assigned to the 2 key.
Edit the .spyrc file with a text editor ( vi or jot) to add
your own commonly used commands. Do this with the map command. For
example:
map 9 unix jot % Open selected file with jot when you type the
9 key. map 8 jump =$HFS Jump to directory held by variable
“$HD”. map > jump :? Show jump history. map ? unix_cmd :? Show
unix command history.
Be sure to map only those keys which spy does not already use, or you will have trouble executing certain spy commands.
Use Ctrl R to reload the .spyrc file after you have saved your changes.
Note
Keywords (i.e. jump, unix_cmd) must be in lowercase, and must have a space after them in order to function.
relaxprompt
Including the command:
relaxprompt
in your .spyrc file stops the Press Enter to Continue messages from appearing. It also lets the spy “Continue:” prompt accept any spy command immediately after the previous command finishes without having to type Enter first.
relaxSearch
There is a .spyrc command to determine the behavior of directory searches performed with the / key. By including the command:
relaxsearch
in your .spyrc file, spy will find patterns in the middle of
filenames as well as at the beginning of the filenames. For
example, if you search for “12” and the directory contains:
123.rc flame123.pic flame212.pic
then each of these files would be found in turn.
Without relaxsearch, you would have to search for “*12” to get the same behavior.
If you set the relaxsearch mode and want to find only filenames beginning with “12” then search for “^12”. This works because the leading '^' is a standard search pattern character meaning “the beginning of a line”.
color
You can customize the display of the file listings such that files are displayed in different colors. This only works if the terminal you are running spy from is an ansi terminal. To check if your terminal is an ansi terminal, use the following unix command:
echo $TERM
To customize display of colors with your .spyrc file, use this
command:
color filenamePattern color
where filenamePattern is the string to match (you can use
standard *, [] and ? as wild-card characters), and color is one
of the colors in the list below.
For filenamePattern , you can also specify certain file types: -dir for directory, -x for executable, -tagged for selected files.
Allowable Color Names
The color parameter must be one of :
white reverse_white
red reverse_red
yellow reverse_yellow
green reverse_green
cyan reverse_cyan
blue reverse_blue
purple reverse_purple
black reverse_black
Example
If you added something like:
color *.hip purple
color -dir yellow
color core reverse_red
color -tagged reverse_blue
color -x green
to your .spyrc file, it would color all .hip files purple,
all directories yellow; all “core” files in reverse red; all
tagged (selected) files in blue; and all executable files
(as in unix permissions) green.
ColorToggle
There is also a command colortoggle which toggles the display of color. You can map this to another key, such as uppercase “C”, in your .spyrc file by using:
map C colortoggle
in your .spyrc file. The ⇧ Shift + C key combination is the
default for turning the display of color on and off.
Ignore Masks
ignoremask
Sometimes it is desirable to exclude the display of certain file
types. This can be accomplished using ignore masks. To set up an
ignore mask, use the .spyrc command ignoremask. The syntax
for this command is:
ignoremask [mask] [group]
The mask is a pattern string which follows the same rules that
spy uses when searching for files within a directory (See
Searching Within a Directory ). The group
number is optional. If no group number is specified, group 0 is
used.
Examples
Here is an example of an ignore mask that tells spy not to display all files starting with a period ( “ . ” ).
ignoremask .*
A maximum of 256 ignore masks can be specified in the
.spyrc file. Each ignore mask command only accepts a
single mask string. However, masks can be accumulated by
using the same group number. For example:
ignoremask Makedepend 1 ignoremask *.o 1
This means that when group 1 is in use, all files matching
the patterns *.o and Makedepend will not be shown. spy has a
limit of 64 groups numbered from 0 to 63.
ignoretoggle
The use of the ignore groups can be toggled using the key command ignoretoggle. The syntax for this command is:
ignoretoggle [group]
It is possible to map a key to toggle the display of a
particular group by adding the following to the .spyrc file.
map [key] ignoretoggle =[group]
Here is an example which maps the O key to toggle the
display of all .o files in a directory:
ignoremask *.o 1
map o ignoretoggle =1
ignoredefault
Finally, it is possible to specify whether a group will be in use on starting spy.
ignoredefault [group] [use]
If this command is not present in the .spyrc file, all groups
will be used. The use parameter should be set to 0 if this
group should not be used on startup and 1 otherwise.
Remapping spy Key Functions
In general, you should never need to remap the spy key functions, but if for some reason you would like to, you can use the map command to reassign the keys spy uses with the following list of Key Functions.
For example, if you were using a Dvorak keyboard layout, but wanted to maintain the six directory navigation keys in the same physical location, you could add the following mappings to your .spyrc file:
map d left map h down map t up map n right map g climb map e
display
List of Special Key Names
| ((left)) |
| ((right)) |
| ((down)) |
| ((down)) |
| ⇧ Shift ((left)) |
| ⇧ Shift ((right)) |
| Home |
| End |
| ((PageDown)) |
| ((PageUp)) |
| Ins |
| !-+ |
Example
To get spy to use the arrow keys instead of J K H L, add this into your .spyrc:
map <left> left
map <right> right
map <up> up
map <down> down
map <enter> display
map <s-left> climb
List of Spy Key Functions (Assign to a Key)
| Function | Description |
|---|---|
| climb | Move to parent directory |
| colortoggle | toggles the display of color |
| command | Execute spy command |
| copy | Copy file(s) |
| date | Show current date and time |
| display | Show file or enter directory |
| down | Move cursor down |
| drop | Drop taken file(s) (Paste) |
| empty | Empty taken files(s) |
| enter | Edit file or enter directory |
| experience | Toggle user experience |
| file | Determine type of file(s) |
| help | Shows Help. List commands mapped in .spyrc |
| helpdir | Toggle help directory |
| home | Go to home directory |
| ignoredefault | default mask to use |
| ignoremask | Set mask for filename patterns to ignore |
| ignoretoggle | Toggle ignore mask group |
| invalid | Undefined key |
| inventory | List taken file(s) (show Clipboard) |
| jump | Jump to file or directory |
| keys | List key assignments |
| left | Move cursor left |
| loadrc | Re-load .spyrc file |
| longlist | Long listing of file(s) |
| move | Move file(s) |
| next | Repeat previous name search |
| nextfile | Move cursor to next file |
| pagedown | Go to next page |
| pageup | Go to previous page |
| patternpick | Select (pick) files by pattern match |
| pick | Select (pick) or unselect file (toggle) |
| previous | Move cursor to previous file |
| quit | Exit spy |
| redraw | Re-draw the screen |
| remove | Remove selected file(s) |
| right | Move cursor right |
| search | Search directory for name |
| setenv | Add a new Environment variable |
| showdetail | Toggle directory detail |
| showmemory | Show memory usage |
| startshell | Start another shell |
| take | Take file(s) (Copy) |
| unix_cmd | Execute unix command |
| unpick | Turn all selection (pick) flags off |
| up | Move cursor up |
| version | Display spy Version Number |
| visibility | Toggle visibility |
| who | Lists users that are currently logged in |