# `keys.srf` reference

`keys.srf` rebinds the interactive TUI's keys. zfin reads it from
`~/.config/zfin/keys.srf`. When the file is absent, built-in defaults
apply; when present, it is the **sole** source of bindings.

Generate a fully-commented starting file from the current defaults:

```bash
zfin interactive --default-keys > ~/.config/zfin/keys.srf
```

## File format

One binding per line:

```srf
action::ACTION_NAME,key::KEY_STRING[,scope::SCOPE]
```

- **Modifiers:** `ctrl+`, `alt+`, `shift+` (e.g. `ctrl+c`).
- **Special keys:** `tab`, `enter`, `escape`, `space`, `backspace`,
  `left`, `right`, `up`, `down`, `page_up`, `page_down`, `home`,
  `end`, `F1`-`F12`, `insert`, `delete`.
- **Multiple bindings:** repeat the action on several lines to bind
  more than one key to it.
- **`scope`** (optional): omitted or `scope::global` is a global
  binding; `scope::<tab>` (e.g. `scope::options`) is a tab-local
  binding whose `action::` then names that tab's local action.

A tab-local binding may not reuse a globally-bound key; zfin refuses
to start if you create that conflict.

## Default global bindings

```srf
action::quit,key::q
action::quit,key::ctrl+c
action::refresh,key::r
action::refresh,key::F5
action::prev_tab,key::h
action::prev_tab,key::left
action::prev_tab,key::shift+tab
action::next_tab,key::l
action::next_tab,key::right
action::next_tab,key::tab
action::tab_1,key::1
action::tab_2,key::2
...
action::scroll_down,key::ctrl+d
action::scroll_up,key::ctrl+u
action::scroll_top,key::g
action::scroll_bottom,key::G
action::page_down,key::page_down
action::page_up,key::page_up
action::select_next,key::j
action::select_next,key::down
action::select_prev,key::k
```

Run `zfin interactive --default-keys` for the complete, current list
(including tab-scoped actions), each line ready to edit.

## See also

- [Customize the TUI](../../guides/customize-the-tui.md) -- the walkthrough.
- [The interactive TUI](../tui.md) -- tabs, actions, and the help overlay.
- [`theme.srf`](theme-srf.md) -- recolor the interface.

---

[Documentation home](../../README.md#reference)
