Advanced Topics

Configuration

By default, kalk will try to load a configuration file from <HOME>/.kalk/config.kalk.

This configuration file can contain any multi-line kalk code.

For example, the following configuration will always import all modules when launching kalk:

# .kalk/config.kalk 
import All # We always import all modules

Depending on your OS, the HOME might be a different folder. For example, on Windows the configuration can be loaded from %USERPROFILE%\.kalk\config.kalk.

Keyboard

You can configure new keyboard shortcuts directly within kalk with the shortcut command.

To expressions

The following will create a shortcut between CTRL+R and the result of the expression 1 + 2

>>> shortcut(myshortcut, "CTRL+R", 1 + 2)

If you then press CTRL+R while editing, you will get 3:

>>> # Below we press CTRL+R 4 times
>>> 3333

You can list all the shortcuts available with the command shortcuts.

For example, the following shortcut is defined by default:

shortcut(pi, "CTRL+G P", "Π", "CTRL+G p", "π")               # CTRL+G P => "Π", CTRL+G p => "π"

For example, by default, pressing CTRL+G p will display the symbol π.

To actions

It is also possible with kalk to map a shortcut to an action that can influence the cursor/editing experience (e.g move cursor to left, cut selection)

For example, in kalk, the action for moving the cursor to the left or right are defined like this:

shortcut(cursor_left, "left, ctrl+b", action("cursor_left"))
shortcut(cursor_right, "right, ctrl+f", action("cursor_right"))

For the full list of available actions, you can consult the action function.

For the full list of all the shortcuts defined, you can consult core.kalk that is loaded by default by kalk.