Keybindings
A keybinding connects a key combination to an action. Each one is
a keybind line in your config file:
keybind = Ctrl+M=minimize_windowLeft of the second = is the key, right of it the action. Changes apply as soon as you
save the file.
The examples on this page use Ctrl. On macOS you will usually want Command instead.
Change or add a key
Section titled “Change or add a key”Find the action’s name in All actions and write a line for it:
keybind = Ctrl+Alt+D=split_rightYour lines are added to the defaults, so you only list what you change. Two rules decide what happens on a conflict:
- One key per action. The last line that names an action sets its key. The line above
moves
split_righttoCtrl+Alt+D; its default key stops working. - One action per key. If two actions end up on the same key, the later line wins.
There is no way to remove a binding without replacing it. To free a key, bind its action to a different key.
A combination is any number of modifiers and one key, joined with +. It must not
contain spaces.
Modifiers — case and order do not matter:
| Modifier | Also written as |
|---|---|
Ctrl | Control |
Shift | |
Alt | Option, Opt |
Command | Cmd, Meta, Super, Win |
Keys — these are case-sensitive:
| Keys | Written as |
|---|---|
| Letters | uppercase: A … Z |
| Digits | 0 … 9 |
| Function keys | F1, F2, … |
| Arrows | Left, Right, Up, Down |
| Navigation | Home, End, PageUp, PageDown, Insert, Delete |
| Other named keys | Enter, Escape, Tab, Space, Backspace |
| Punctuation | the character itself: , . / ; ' [ ] - ` \ |
The characters =, > and : are part of the syntax and cannot be used as keys.
Key sequences
Section titled “Key sequences”Chain combinations with > to require several key presses in a row:
keybind = Ctrl+B>Ctrl+S=open_configPress Ctrl+B, release, then Ctrl+S.
Actions with an argument
Section titled “Actions with an argument”Some actions take an argument after a :. new_tab takes the name of a
shell profile:
keybind = Ctrl+Alt+B=new_tab:bashAn argument runs to the end of the line and may contain any character, including spaces,
: and =.
The same action with different arguments can have several keys. new_tab:bash and
new_tab:zsh each get their own, next to the key of plain new_tab.
Triggers
Section titled “Triggers”A trigger in front of the key changes when the binding fires and whether the terminal still receives the key. Without a trigger, the action runs and the key is not passed on to the terminal.
keybind = always:performable:Ctrl+C=copy| Trigger | Effect |
|---|---|
always | The binding also works while a full-screen program such as vim or htop is running. Without it, the key goes to that program instead. |
performable | The key is only taken if the action actually did something. Otherwise it goes to the terminal. This is how Ctrl+C copies when text is selected and interrupts the command when nothing is. |
unconsumed | The action runs and the key is passed on to the terminal. |
broadcast | The action runs in every terminal of the window, in all workspaces, not only the focused one — for example to clear the input line in all panes at once. |
workspace | The action runs in every terminal of the workspace you are looking at. |
Triggers can be combined, each followed by a :.
Send text to the terminal
Section titled “Send text to the terminal”send_text types its argument into the terminal for you. It has no default key:
keybind = Ctrl+Alt+T=send_text:npm test\rThe \r at the end presses Enter. Without it the text is only typed and waits for you.
The text goes to whatever is running in the terminal — your shell at the prompt, or a program that is waiting for input.
Write these escapes for keys that have no character of their own:
| Escape | Sends |
|---|---|
\r | Enter |
\e | Escape |
\t | Tab |
\n | Line feed |
\xHH | The character with hex code HH, from 00 to 7F |
\\ | A backslash |
Ctrl with a letter is a \xHH code: Ctrl+A is \x01, Ctrl+B is \x02, and so on
up to Ctrl+Z, which is \x1a. So \x03 is Ctrl+C and \x04 is Ctrl+D.
Any other backslash is sent as written. Spaces at the end of the line are dropped; write
\x20 for a space the text has to end with.
End running processes
Section titled “End running processes”terminate_processes ends the program that is running in a terminal, together with
everything that program started. The shell stays open at its prompt. It has no default
key.
Use it where Ctrl+C is not enough: the program is first asked to end and, if it is still
running after two seconds, killed. This also works for programs that ignore Ctrl+C and
for full-screen programs such as vim.
Programs you sent to the background with & keep running. On Windows this distinction
does not exist: everything started from the terminal is ended, immediately.
One key for many terminals
Section titled “One key for many terminals”With the workspace or broadcast trigger an action runs in many terminals
at once. Together with the two actions above, one key ends everything that is running:
# End every running program in the current workspacekeybind = always:workspace:Ctrl+Alt+K=terminate_processes
# End every running program in all workspaceskeybind = always:broadcast:Ctrl+Alt+Shift+K=terminate_processes
# Press Ctrl+C in every terminal of the current workspacekeybind = always:workspace:Ctrl+Alt+C=send_text:\x03The always trigger keeps the key working while the terminal you are in runs a
full-screen program.
Examples
Section titled “Examples”# Give an action without a default key onekeybind = Ctrl+Alt+I=open_process_info
# Keep a shortcut working inside vim, htop and other full-screen programskeybind = always:Ctrl+Shift+P=open_command_palette
# Clear the screen of every terminal at oncekeybind = broadcast:Ctrl+Alt+L=clear_buffer
# A two-step sequencekeybind = Ctrl+B>Ctrl+W=close_all_tabsIf a line names an action that does not exist, Cogno shows a warning and ignores the line.