Skip to content

Configuration

Quikrun supports two levels of configuration, merged in this priority order (highest wins).
A key defined at a higher-priority level overrides the same key at lower levels.

PriorityFileScope
1 (highest)quikrun.toml in project directoryProject
2[tool.quikrun] in pyproject.tomlProject
3[package.metadata.quikrun] in Cargo.tomlProject
4"quikrun" key in package.jsonProject
5$XDG_CONFIG_HOME/quikrun/config.toml (default: ~/.config/quikrun/config.toml)User
6 (lowest)Built-in defaultsGlobal

Flow:

json5
built-in: { py: "python3 {file}", js: "node {file}", rs: (...) }
user:     { py: "pypy {file}",    nim: "nim compile --run {file}" }
project:  { py: "python3 -O {file}" }

result: { py: "python3 -O {file}",           project wins
          js: "node {file}",                 inherited from built-in
          rs: (...),                         inherited from built-in
          nim: "nim compile --run {file}" } ← from user

User Config

Location: ~/.config/quikrun/config.toml (or $XDG_CONFIG_HOME/quikrun/config.toml if XDG_CONFIG_HOME is set)

Use this to set personal preferences that apply across all your projects.

toml
clear_terminal = true
...

[commands]
# Always run Python files with pypy instead of python3
py = "pypy {file}"
...

Project Config

You can configure quikrun at the project level using one of the following files:

quikrun.toml

Place a quikrun.toml in your project root:

toml
clear_terminal = true
...

[commands]
py = "python3 -O {file}"
..

pyproject.toml

Add a [tool.quikrun] section to your pyproject.toml:

toml

[tool.quikrun]
clear_terminal = true
...

[tool.quikrun.commands]
py = "python3 -O {file}"

Cargo.toml

Add a [package.metadata.quikrun.commands] section to your Cargo.toml:

toml
[package.metadata.quikrun]
clear_terminal = true

[package.metadata.quikrun.commands]
rs = "cargo run --bin {file_stem}"

package.json

Add a "quikrun" key containing a "commands" block to your package.json:

json
{
  "quikrun": {
    "clear_terminal": true,
    "commands": {
      "js": "node --harmony {file}"
    }
  }
}

Configuration Reference

The following root-level settings are supported in all configuration files:

SettingTypeDefaultDescription
clear_terminalbooltrueClears the terminal before executing the code file.
auto_closestr/num"never"- "always" closes immediately after execution
- "never" waits for Enter keypress
- "on_success" closes only when exit code is 0
- Any non-negative number (e.g. 2.5) to auto-close after that many seconds.
show_time_tookbooltrueShows the execution duration of the command after it exits.
show_commandbooltrueShows the command being executed.
show_shellbooltrueShows the shell command/path.
show_dividerbooltrueDraws a horizontal execution divider line before the footer.
temp_dirstrnullAbsolute/Relative path to a custom directory where binaries are compiled. Supports env vars (like $HOME) & tilde (~) expansions.
cd_to_file_dirboolfalseChanges the working directory (cwd) to the directory containing the source file before running.
keep_artifactsboolfalse- true, keeps the compiled binaries and output directories after execution.
- false, these are automatically cleaned up.
shellstr/tablenullAllows overriding the shell used to run the commands. More info below

Supported Shells

Only certain shells are supported:

  • POSIX: sh, bash, zsh, dash, ash
  • Windows: cmd.exe, pwsh (powershell core)

If anything other than these are given, quikrun will use default shell as per the platform:

  • sh on linux/macos
  • %COMSPEC% on windows, which is usually cmd.exe

The value of the config key can be a string (e.g. "pwsh") or a table specifying different shells for different platforms (linux, darwin, win).
If not set, uses default.

toml
# Custom shell configuration example
shell = { linux = "/usr/bin/zsh", win = "pwsh.exe" }  # will use default `sh` in macos

# Or simply a string, will use pwsh for all platforms
shell = "pwsh"