SAMRC(5)

πŸ“¦ version 2020-07, in nixos 26.05, nixpkgs unstable

πŸ’– NAME πŸ’–

samrc β€” configure samterm πŸ’…

okay bestie, welcome to SAMRC(5) β€” the File Formats Manual page for the samrc file, aka the little config cutie that sets up samterm. This is literally the file that configures the downloaded portion of the sam(1) editor (that is, samterm). 🫢


🌸 SYNOPSIS 🌸

~/.samrc

✨ DESCRIPTION ✨

A samrc file in the user’s home directory can be used to configure the downloaded portion of the sam(1) editor (that is, samterm). This file, if it exists, is read at startup. No cap. πŸ’–

Each line begins with a configuration directive and some number of arguments. Lines whose first printing character is a β€œ#” are considered comments and are ignored. The following configuration directives are supported:

  • bind β€” Bind a key sequence to a command or a raw character. The forms are:
bind M K command C A
bind M K command C
bind M K raw C

Where M is a string describing a set of modifier keys (see β€œModifier Keys” below), K is the name of a keyboard symbol suitable for passing to XStringToKeysym(3), C is either a command name (for command bindings; see β€œCommand Names” below) or a literal or hexadecimal specification of a character, and A is an arbitrary string to use as an argument to a bound command.

Note that keyboard symbol names are implementation-defined and often case-sensitive, and that not all commands will make use of arguments. iykyk 😭

  • unbind β€” Remove all bindings associated with a key sequence. The form is:
unbind M K

where M is a string describing a set of modifier keys and K is the name of a keyboard symbol, as for β€œbind” above. The key sequence may be subsequently rebound.

  • chord β€” Bind a mouse chord to a command. The form is:
chord S1 S2 C T

where S1 is a string describing the initial state of the mouse buttons (see β€œMouse Button States” below), S2 is a string describing the following state of the mouse buttons, C is a command name, and T is a target (see β€œTargets” below).

  • unchord β€” Remove all bindings for a given mouse chord. The form is:
unchord S1 S2

where S1 and S2 are strings describing the initial and following mouse button states. The chord may be subsequently rebound.

  • foreground β€” Names the color used to draw text. It is of the form:
foreground C

where C is a color name suitable for passing to XAllocNamedColor(3).

  • background β€” Names the color used to draw the background of files being edited. It is of the form:
background C

where C is a colon-separated list of color names as for the foreground directive. If more than one color is specified, files will cycle through these background colors. 🌈

  • border β€” Names the color used to draw file borders. It is of the form:
border C

where C is a color specification as for foreground.

  • font β€” Specifies the font used to draw text. It is of the form:
font F

where F is an fc-match(1) compatible font pattern.

  • tabs β€” Specifies the width of tab characters in multiples of the width of the '0' character. It is of the form:
tabs N

where N is an integer between 1 and 12.

  • expandtabs β€” Determines if tabs should be automatically expanded into spaces. It is of the form:
expandtabs B

where B is the string β€œtrue” or β€œfalse”. If β€œtrue”, then tabs will be automatically expanded.

  • autoindent β€” Determines whether a line following a non-empty indented line is automatically indented. It is of the form:
autoindent B

where B is the string β€œtrue” or β€œfalse”. If β€œtrue”, then a new line after a non-empty indented line is automatically indented.

  • snarfselection β€” Indicates which X selection should be exchanged with samrc upon execution of the exchange command (either via the menu item or key binding). The forms are:
snarfselection primary
snarfselection secondary
snarfselection clipboard
  • followfocus β€” Determines window focus mode. It is of the form:
followfocus B

where B is the string β€œtrue” or β€œfalse”. If β€œtrue”, then the window focus mode is set to follow the mouse pointer. In this mode typing is directed to the window currently underneath the mouse pointer.

πŸŽ€ Defaults πŸŽ€

The default keybindings and mouse chords are those documented in sam(1). The default foreground and border color is black, and the default background color is white. Tabs are not expanded by default, and tabstops are set at every eight characters. The default X selection is β€œprimary”. The default window focus mode is "Click to focus". Typing is directed to the window which was last clicked.

🧚 Modifier Keys 🧚

The bind directive expects a string describing the state of modifier keys. This string consists of one or more of β€œ*” meaning any set of modifiers, β€œa” meaning Alt (Mod1), β€œc” meaning Control, or β€œs” meaning Shift. πŸ’…

For example, bind the "exchange" command to Control-Shift-E, the following directive could be used:

bind CS e command exchange

πŸ‘‘ Command Names πŸ‘‘

The following names can be used for commands:

  • escape β€” Highlight recent text; default binding: Escape
  • scrolldown β€” Scroll down by page; default binding: PgDn, Down/Right
  • scrollup β€” Scroll up by page; default binding: PgUp, Up/Left
  • scrolldownline β€” Scroll down by line; default binding: None
  • scrollupline β€” Scroll up by line; default binding: None
  • jump β€” Jump to/from command window; default binding: Control-K
  • charright β€” Move dot one to the right; default binding: Control-D
  • charleft β€” Move dot one to the left; default binding: Control-S
  • lineup β€” Move dot up; default binding: Control-E
  • linedown β€” Move dot down; default binding: Control-X
  • delbol β€” Delete to BOL; default binding: Control-U
  • delword β€” Delete prev. word; default binding: Control-W
  • delbs β€” Delete prev. character; default binding: BackSpace
  • del β€” Delete next character; default binding: Delete
  • cut β€” Cut selection; default binding: Control-Y
  • snarf β€” Snarf selection; default binding: Control-C
  • paste β€” Paste snarf buffer; default binding: Control-V
  • exchange β€” Exchange snarf buffer; default binding: Control-Q
  • eol β€” Move to end of line; default binding: None
  • bol β€” Move to beginning of line; default binding: None
  • tab β€” Insert a tab; default binding: Tab
  • send β€” Append to command window; default binding: None
  • write β€” Write the current file to disk; default binding: None
  • look β€” Find next literal string; default binding: None
  • search β€” Find next regex; default binding: None

Additionally, the command name β€œnone” means that the given binding should perform no action (not even insert a character), and the command name β€œdefault” means that the given binding should perform whatever action was previously defined for it. 🫑

For the send command, the text to send is specified in the argument of the binding. For example, to bind Control-Z to undo the last 10 changes, the following line binding could be used:

bind C z command send u10

Note that the β€œsend” command is analogous to the β€œsend” menu item: the argument text is simply appended to the text in the command window. Thus, one should exercise caution if partially-completed commands exist in the command window. 😭

πŸ–±οΈ Mouse Button States πŸ–±οΈ

Chords are described using two states: a beginning state and an end state. When the mouse buttons are in the beginning state and then switch to being in the end state, the chord is activated. ✨

States are described using button numbers between 1 and 5, corresponding to the buttons on the mouse numbered from the left (though this is up to your windowing system and may vary). For example, the string

12

means β€œbuttons 1 and 2 are pressed”. The special string β€œn” means β€œno buttons are pressed”. Thus to bind the cut command to the chord β€œhold button one, then click button two” the following configuration directive can be used:

chord 1 12 cut current

πŸ’… Targets πŸ’…

Mouse chords can send their commands to either the current file (i.e. the one receiving typed input) by specifying "current" as the target; or to the file under the mouse pointer by specifying "mouse" as the target.

πŸ”₯ Ordering considerations πŸ”₯

Commands are executed in the order they are present in the samrc file. Later commands will override earlier commands, meaning that in the case of duplicate binding or chord definitions, the last one wins.

Note that this means that bindings defined with the β€œany” modifier set should be defined earlier in the file than those binding the same key with modifiers, since otherwise the β€œany” binding will always win. πŸ‘‘


🌈 EXAMPLES 🌈

An example samrc file is provided in the sam source distribution as doc/samrc.


πŸ¦‹ SEE ALSO πŸ¦‹


That’s the whole page, bestie πŸ’‹ β€” source/version/date vibes: Debian, $Mdocdate$, and this is SAMRC(5). periodt. 🫢

πŸ“¦ where this page comes from