On this page:
10.1 Unicode Support
10.2 Dr  Racket
10.3 Vim/  Emacs
10.3.1 Keybindings
10.3.2 Indentation
8.11.1

10 Input Methods

If your code flows but you don’t, then we’re only halfway there. This section will cover some UX considerations related to programming in Qi, so that expressing flows in code is just a thought away.

The main thing is, you want to ensure that these forms have convenient keybindings:

~>

-<

Now, it isn’t just about being able to enter them, but being able to enter them without effort. This makes a difference, because having convenient keybindings for Qi is less about entering unicode conveniently than it is about expressing ideas economically, just as having evocative symbols in Qi is less about brevity and more about appealing to the intuition. After all, as the old writer’s adage goes, "show, don’t tell."

Some specific suggestions are included below for commonly used editors and operating systems.

10.1 Unicode Support

Some of the following sections cover entering unicode characters in various editors, but if the font you’re using doesn’t have full unicode support (e.g. on Linux), these characters may render only as nondescript boxes. In this case, consult the documentation for your operating system to discover fonts with unicode support (for instance, if your OS happens to be Arch Linux, the font documentation for that system). One widely available collection of such fonts is Noto.

10.2 DrRacket

Stephen De Gabrielle created a quickscript for convenient entry of Qi forms: Qi Quickscripts. This option is based on using keyboard shortcuts to enter exactly the form you need.

Laurent Orseau’s Quickscript Extra library includes the complete-word script that allows you to define shorthands that expand into pre-written templates (e.g. ( \|), with \| indicating the cursor position), and includes some Qi templates with defaults that you could customize further. This option is based on short textual aliases with a common keyboard shortcut.

There are also a few general unicode entry options, including a quickscript for unicode entry in DrRacket, and The Unicoder by William Hatch for system-wide unicode entry. While these options are useful and recommended, they are not a substitute for the Qi-specific options above but a complement to them.

Use any combination of the above that would help you express yourself economically and fluently.

10.3 Vim/Emacs

10.3.1 Keybindings

For Vim and Emacs Evil users, here are suggested keybindings for use in insert mode:

Form

 

Keybinding

 

C-;

~>

 

C->

-<

 

C-<

 

C-v

 

C-V

 

C-=

For vanilla Emacs users, I don’t have specific suggestions since usage patterns vary so widely. But you may want to define a custom input method for use with Qi (i.e. don’t rely on the LaTeX input method, which is too general, and therefore isn’t fast), or possibly use a Hydra.

10.3.2 Indentation

In Racket Mode for Emacs, use the following config to indent Qi forms correctly:

(put 'switch 'racket-indent-function 1)
(put 'switch-lambda 'racket-indent-function 1)
(put 'on 'racket-indent-function 1)
(put 'π 'racket-indent-function 1)
(put 'try 'racket-indent-function 1)