Key bindings
Any command can be put on another key, given a second key, or left with none — everywhere it works, or in one place only. You change keys on the Key bindings screen, and the ones you changed are kept in a file you can hand to someone else.
The screen
Key bindings… opens it — from the application menu, the Options menu, the Key bindings page of the settings screen, or by name in ⌘K.
Every command is listed under each place it works, since its key can differ between them: The panes, Reading a file (the text viewer), Looking at a file (a viewer made for a kind of file, such as a table or a picture), Editing a file and The terminal.
- A key you changed is red; a key as it ships is gray. Two keys on one command are separated by a
comma, and
—is no key. - A dot, •, before a command says you changed its key here and have not yet applied it.
- Under the list, the command chosen: its id — the name
key-bindings.jsonuses — and, once you have changed it, what its key was. The second line says what a second quick press of its key reaches, if anything: Delete pressed twice is Delete permanently.
- Find
- Commands whose name, or key, holds what you type. ↑ and ↓ move in the list while you
type. Typing a key —
F8— shows what it already does before you take it. - By key
- ⌘ ⌥ ⇧ ⌃ — only keys holding every modifier ticked.
- Key
- Only keys on that cap, by its exact name:
F1is notF10. - Only customized
- Only the keys you changed.
Changing a key
The buttons under the list act on the command chosen.
- Set…
- Puts the command on the next key you press, in place of its keys here. Enter on a command does the same.
- Add…
- Gives it another key and keeps the ones it has — for a second habit, or a keyboard without the first.
- Clear
- Takes its keys away. It is still there by name, in ⌘K and the menus.
- Reset
- Puts this command’s keys back as they ship.
- Reset All
- Puts every command’s keys back, after asking.
Nothing you change is in force until you choose OK or Apply, which put every change in force
together and write it to key-bindings.json:
- OK
- Puts what you changed in force, and closes the screen. ⌥O does the same.
- Apply
- Puts what you changed in force, and keeps the screen open, so you can try the key with the screen still up. ⌥Y does the same.
- Cancel
- Closes the screen with nothing changed since the last Apply. Esc does the same, and with changes not applied both ask first.
Pressing the key
Set… and Add… wait for a key, and whatever you press is the answer — Enter, Tab and the function keys included. Esc cancels. Then Use this key, or Enter, keeps it; Press again waits for another.
- Said in yellow, and taken all the same: that another command already has the key here, or, in the terminal, that a key with nothing held will no longer reach the program running there.
- Refused in red: a letter, a digit or a symbol, alone or with ⇧, which is typing; and an arrow, alone or with ⇧, which moves the cursor. Hold ⌘, ⌥ or ⌃ with it.
Where the new key works
A command that works in more than one place asks whether the change is for all of them, Everywhere, or for the one you chose it under, Only here. Everywhere is ready while the command has the same keys everywhere; Only here, once they differ. Clear and Reset ask the same.
One key, several commands
Nothing stops two commands sharing a key. Where a key reaches more than one command that could act, pressing it asks which you meant.
What cannot be rebound
Only what the screen lists has a key to change. These are not on it:
- The keys that move the cursor, and typing: a letter typed to find a name, a menu’s letters, the keys inside a dialog.
- A second quick press, which reaches a command’s stronger reading — it follows whatever key the command is on.
- ⌘, for the settings, and the keys macOS gives its own menu, such as ⌘Q.
- In the terminal, every key without ⌘ goes to the program running there, unless you put a command on it.
The file
The keys you changed are in ~/.northern-commander/key-bindings.json — only those, so a new version’s
keys still arrive for everything else. It is the file to hand someone who wants your keys.
{
"rename": "F12",
"go-to-folder": ["Cmd+G", "Cmd+Shift+G"],
"menu-bar": [
{ "key": "F9", "on": ["panes", "viewer", "formats", "editor"] },
{ "key": "Ctrl+F9", "on": ["terminal"] }
],
"delete-permanently": []
}
A command is named by its id, which the screen shows under the list. A
favorite or a command of your own
is on the list too, as Favorite: or User menu: and its name, with an id of its own that stays with it
when it moves or is renamed: favourite:3f9a1c2e.
- A word
- One key, wherever the command works.
- A list of words
- Several keys for the command.
- A list of
keyandon - A key that reaches it only in some places:
panes,viewer(reading a file),formats(looking at a file),editor,terminal. - An empty list
- No key. The command is still there by name.
A key is written with its modifiers in words and + between: Cmd, Opt, Shift and Ctrl —
Command, Option and Alt, and the symbols ⇧⌘C, are read too. The key is the name on its cap:
a letter, a digit, F1 to F20, Enter, Esc, Tab, Space, Backspace, Delete, Insert,
Home, End, PgUp, PgDn, the arrows ↑ ↓ ← →, or a symbol such as [ or /. Case does
not matter.
- The file is read when the application starts, so a change made by hand counts from the next start. The screen writes it as each change is made, and writes only the command you changed: the rest of the file stays as you left it, even edited while the application is open.
- A key that cannot be read is left out, and the log says so. A command left with none it can read keeps the keys it ships with, and nothing else is affected. What could not be read stays in the file as you wrote it.
- A file that is not JSON at all leaves every key as it ships and is never written over: the next
start moves it beside itself as
key-bindings.unreadable-<date>-<time>.jsonand tells you where. - An id this version does not know is kept, and written back as it was.
Its schema, https://northerncommander.com/schemas/key-bindings.schema.json, lists every command’s
id; add it as $schema for an editor to complete them as you type. A
backup can hold the file.
This site shows the keys as they ship.