---
title: Key Bindings
description: A console-based XMPP client for power users.
sidebar:
  order: 11
---

## GNU Readline

CProof uses <a href="https://tiswww.case.edu/php/chet/readline/rltop.html" target="_blank" rel="noopener noreferrer">GNU Readline</a> for handling input. GNU Readline comes with many features including customisable key bindings, and Emacs or Vi editing modes.

In addition to checking _~/.inputrc_, CProof is also reading _~/.config/profanity/inputrc_ for Readline bindings.

For more information on key bindings and customisations available in GNU Readline, see the guide. Taken from the above guide, below is a list of basic bindings that come with GNU Readline by default.

In the table below, <kbd>Ctrl</kbd> represents the Control key, and <kbd>Alt</kbd> represents the Meta key, which may vary depending on your operating system (Alt, Windows, Command, etc.). Key combinations are shown using the plus sign (+).  

| Keybinding                                   | Action                                                                                                                     |
|---------------------------------------------|----------------------------------------------------------------------------------------------------------------------------|
| <kbd>Ctrl</kbd> + <kbd>b</kbd>              | Move the cursor one character backward                                                                                     |
| <kbd>Ctrl</kbd> + <kbd>f</kbd>              | Move the cursor one character forward                                                                                      |
| <kbd>Ctrl</kbd> + <kbd>d</kbd>              | Delete the character under the cursor                                                                                      |
| <kbd>Ctrl</kbd> + <kbd>_</kbd> or <kbd>Ctrl</kbd> + <kbd>x</kbd> then <kbd>Ctrl</kbd> + <kbd>u</kbd> | Undo the last editing action                                                              |
| <kbd>Ctrl</kbd> + <kbd>a</kbd>              | Move the cursor to the start of the line                                                                                   |
| <kbd>Ctrl</kbd> + <kbd>e</kbd>              | Move the cursor to the end of the line                                                                                     |
| <kbd>Alt</kbd> + <kbd>f</kbd>               | Move the cursor forward by one word (words include letters and digits)                                                     |
| <kbd>Alt</kbd> + <kbd>b</kbd>               | Move the cursor backward by one word                                                                                        |
| <kbd>Ctrl</kbd> + <kbd>l</kbd>              | Clear the terminal or screen                                                                                                |
| <kbd>Ctrl</kbd> + <kbd>k</kbd>              | Delete text from the cursor to the end of the line                                                                         |
| <kbd>Alt</kbd> + <kbd>d</kbd>               | Delete text from the cursor to the end of the current word, or if between words, to the end of the next word. Word boundaries same as <kbd>Alt</kbd> + <kbd>f</kbd> |
| <kbd>Alt</kbd> + <kbd>DEL</kbd>             | Delete text from the cursor to the start of the current word, or if between words, to the start of the previous word. Word boundaries same as <kbd>Alt</kbd> + <kbd>b</kbd> |
| <kbd>Ctrl</kbd> + <kbd>w</kbd>              | Delete text from the cursor to the previous whitespace. Different from <kbd>Alt</kbd> + <kbd>DEL</kbd> because word boundaries differ |
| <kbd>Ctrl</kbd> + <kbd>y</kbd>              | Paste (yank) the most recently deleted text back at the cursor                                                            |
| <kbd>Alt</kbd> + <kbd>y</kbd>               | Cycle through previously deleted text entries (kill ring), only works after a <kbd>Ctrl</kbd> + <kbd>y</kbd> or <kbd>Alt</kbd> + <kbd>y</kbd> command |


## User Interface Navigation

Besides the standard GNU Readline keybindings, CProof offers extra shortcuts to help you navigate and manage the interface efficiently:

| Shortcut                                    | What It Does                                             |
|---------------------------------------------|----------------------------------------------------------|
| <kbd>Alt</kbd> + <kbd>1</kbd> to <kbd>Alt</kbd> + <kbd>0</kbd>, or <kbd>F1</kbd> to <kbd>F10</kbd> | Switch focus directly to the corresponding window         |
| <kbd>Alt</kbd> + <kbd>←</kbd> (Left Arrow)                  | Move focus to the previous window                          |
| <kbd>Alt</kbd> + <kbd>→</kbd> (Right Arrow)                 | Move focus to the next window                              |
| <kbd>Page Up</kbd>                           | Scroll up through the main window content                  |
| <kbd>Page Down</kbd>                         | Scroll down through the main window content                |
| <kbd>Alt</kbd> + <kbd>Page Up</kbd>                      | Scroll up through the occupants or roster panel            |
| <kbd>Alt</kbd> + <kbd>Page Down</kbd>                    | Scroll down through the occupants or roster panel          |
| <kbd>Alt</kbd> + <kbd>A</kbd>                            | Jump to the next unread window                              |
| <kbd>Ctrl</kbd> + <kbd>↓</kbd> (Down Arrow)                   | Save the current line to command history                    |


## Custom Readline functions

CProof also makes functions available to readline to allow customising its bindings:

|                        |                                                        |
| ---------------------- | ------------------------------------------------------ |
| `prof_win_N`           | Focus window N where N is 1,2,3,4,5,6,7,8,9 or 0       |
| `prof_win_prev`        | Focus previous window                                  |
| `prof_win_next`        | Focus next window                                      |
| `prof_win_pageup`      | Page up contents of main window                        |
| `prof_win_pagedown`    | Page down contents of main window                      |
| `prof_subwin_pageup`   | Page up contents of sub window (roster or occupants)   |
| `prof_subwin_pagedown` | Page down contents of sub window (roster or occupants) |
| `prof_win_clear`       | Clear current window contents                          |

Example usage in _inputrc_:

```bash
$if profanity
"\C-p": prof_win_prev
"\C-n": prof_win_next
"\C-j": prof_win_pageup
"\C-k": prof_win_pagedown
"\C-h": prof_subwin_pageup
"\C-l": prof_subwin_pagedown
"\C-y": prof_win_clear
$endif
```

### How it works

- `$if profanity` — Applies these bindings only when running CProof (which identifies as `profanity`)
- `"\C-x"` — Represents a keybinding, like `Ctrl + x`
- The value after the colon is the name of the internal command CProof will execute

### Notes

- You must restart CProof for changes to take effect.
- To reload `.inputrc` in an interactive shell without restarting:
  ```bash
  bind -f ~/.inputrc
  ```
- Use multiple `$if` blocks to define bindings for different applications.
