Appearance
Custom keyboards
The iOS keyboard is made for prose. Braces, brackets, pipes and tildes are two layers down. HachiCode adds an accessory bar above the soft keyboard, and every key on it is yours to define.
This page is about that bar. With a hardware keyboard attached, the soft keyboard and its bar are out of the way and the shortcuts in Editor basics take over. The bar itself stays hidden while a hardware keyboard is attached; turn off Settings › Keyboard › External Keyboard › Hide keyboard accessory to keep it up if you want its keys under your fingers as well.
Keys and swipes
A keyboard is a row of up to 10 keys. Each key has a centre action and up to four more on the diagonal swipes: up-left, up-right, down-left, down-right. So a keyboard holds up to 50 actions per language.
An action can insert text, move the cursor by character, word, line or bracket, select, indent, reindent, comment, undo and redo, cut, copy and paste, pick from recent copies, cuts and pastes, move or duplicate lines, add cursors, fold, trim trailing whitespace, format or lint the file, insert a snippet, open the snippet picker or the file structure, toggle full screen, hide the keyboard, run a hardware shortcut, or chain several of these as a macro. The Keys screen under Settings → Keyboard lists every available key.
Two keyboards ship for each device type. They are read-only — a lock stands where the drag handle would be — so duplicate one as a starting point, or build your own.
The key picker that assigns a key to a slot has a search field that matches as every list does, the sections and their rows kept in order; see Searching lists.
A key whose action is refused says why on the status line — a cut in a read-only file, a format the formatter rejects (its own message, with the line), a paste with nothing to paste is simply nothing. With vim on the words go on vim's message line instead. When there is more than the line shows — a second line, or a line too long for the bar — a small speech-bubble glyph sits beside it: tap the message while it shows, or the glyph after it clears, for the whole of it. A formatter's refusal in a file a linter covers offers Open Problems there, which lints the file and lists where.
Define a keyboard
- Settings → Keyboard → Keyboards.
- Tap +, give it a name, and choose what to start from.
- On the Slots list, tap a slot to choose its centre and swipe actions; drag to reorder.
A key bound to a snippet slot shows the snippet's mnemonic as its label; see Snippets.
Assign keyboards to file types
Settings → Keyboard → File type mappings decides which keyboard appears for which file type. Each file type can have two keyboards, a primary and a secondary. Anything without a mapping uses the default pair.
While editing, a dot strip at the bar's trailing edge shows which of the two is active; tap it to switch. The choice is per file and resets when the file is reopened.
The cheatsheet
Long-press the dot strip to enter cheatsheet mode. While it is on, tapping a key shows everything bound to it, centre and swipes, instead of running it. Long-press again to leave.
Snippet slots
Snippet keys bind by slot, not by snippet, so one keyboard serves every language:
- Define snippets under Settings → Snippets.
- Under Settings → Keyboard → Key bindings, give each of the ten slots,
s0tos9, a default snippet and, if you like, an override per file type. - Put the slot keys on a keyboard.
Then slot 3 is your for loop in TypeScript and your def in Python, from the same key on the same keyboard.
Script keys
Each script under Settings → Scripts is a key too, listed under Scripts in the key library and the key picker. A tap runs the script on the file you are editing, with vim on or off; what it prints, or its error, shows on the status line. A script on a keyboard cannot be deleted until its key is removed; you are told where it is.
A key fits two characters, so a script key shows a mnemonic, as a snippet key does: the first letters of the script's name, OI for OrganizeImports, Jo for Join. To choose your own, tap the key at the start of the script's row in Settings → Scripts, or set Mnemonic on the script's screen; leave it empty to go back to the one from the name. If another script or snippet already shows the same characters, you are told, and you can keep them anyway. See Scripting with Lua for what a script can do.
Common setups
- One keyboard per language, chosen by the file type mapping.
- Two per language: the primary holds punctuation and structure, the secondary holds snippet keys, and the dot strip flips between them.
- One keyboard for everything, with slot keys whose snippets change per file type through the bindings.
The Playground section under Settings → Keyboard has a practice screen per action category.
