2021-02-26 22:18:47 +00:00
# Configuration file
Each [notebook ](notebook.md ) contains a configuration file used to customize your experience with `zk` . This file is located at `.zk/config.toml` and uses the [TOML format ](https://github.com/toml-lang/toml ). It is composed of several optional sections:
2023-04-11 15:22:06 +00:00
* `[notebook]` configures the [default notebook ](config-notebook.md )
2021-02-26 22:18:47 +00:00
* `[note]` sets the [note creation rules ](config-note.md )
* `[extra]` contains free [user variables ](config-extra.md ) which can be expanded in templates
* `[group]` defines [note groups ](config-group.md ) with custom rules
2021-05-16 20:11:31 +00:00
* `[format]` configures the [note format settings ](note-format.md ), such as Markdown options
2021-02-26 22:18:47 +00:00
* `[tool]` customizes interaction with external programs such as:
* [your default editor ](tool-editor.md )
2023-03-28 19:29:18 +00:00
* [your default shell ](tool-shell.md )
2021-02-26 22:18:47 +00:00
* [your default pager ](tool-pager.md )
* [`fzf` ](tool-fzf.md )
2021-05-16 20:11:31 +00:00
* `[lsp]` setups the [Language Server Protocol settings ](config-lsp.md ) for [editors integration ](editors-integration.md )
2021-03-24 20:06:32 +00:00
* `[filter]` declares your [named filters ](config-filter.md )
2021-02-26 22:18:47 +00:00
* `[alias]` holds your [command aliases ](config-alias.md )
2021-03-17 17:04:27 +00:00
## Global configuration file
You can also create a global configuration file to share aliases and settings across several notebooks. The global configuration is by default located at `~/.config/zk/config.toml` , but you can customize its location with the [`XDG_CONFIG_HOME` ](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html ) environment variable.
Notebook configuration files will inherit the settings defined in the global configuration file. You can also share templates by storing them under `~/.config/zk/templates/` .
2021-02-26 22:18:47 +00:00
## Complete example
Here's an example of a complete configuration file:
```toml
2023-04-11 15:22:06 +00:00
# NOTEBOOK SETTINGS
[notebook]
dir = "~/notebook"
2021-02-26 22:18:47 +00:00
# NOTE SETTINGS
[note]
# Language used when writing notes.
# This is used to generate slugs or with date formats.
language = "en"
# The default title used for new note, if no `--title` flag is provided.
default-title = "Untitled"
# Template used to generate a note's filename, without extension.
filename = "{{id}}-{{slug title}}"
# The file extension used for the notes.
extension = "md"
# Template used to generate a note's content.
# If not an absolute path, it is relative to .zk/templates/
template = "default.md"
# Configure random ID generation.
# The charset used for random IDs.
id-charset = "alphanum"
# Length of the generated IDs.
id-length = 4
# Letter case for the random IDs.
id-case = "lower"
# EXTRA VARIABLES
[extra]
author = "Mickaël"
# GROUP OVERRIDES
2023-03-28 19:29:18 +00:00
[group.journal]
2021-02-26 22:18:47 +00:00
paths = ["journal/weekly", "journal/daily"]
2023-03-28 19:29:18 +00:00
[group.journal.note]
2022-12-04 09:11:06 +00:00
filename = "{{format-date now}}"
2021-02-26 22:18:47 +00:00
2021-03-11 19:59:53 +00:00
# MARKDOWN SETTINGS
[format.markdown]
# Enable support for #hashtags
hashtags = true
# Enable support for :colon:separated:tags:
colon-tags = true
2021-02-26 22:18:47 +00:00
# EXTERNAL TOOLS
[tool]
# Default editor used to open notes.
editor = "nvim"
2023-03-28 19:29:18 +00:00
# Default shell used by aliases and commands.
shell = "/bin/bash"
2021-02-26 22:18:47 +00:00
# Pager used to scroll through long output.
pager = "less -FIRX"
# Command used to preview a note during interactive fzf mode.
fzf-preview = "bat -p --color always {-1}"
2021-03-24 20:06:32 +00:00
# NAMED FILTERS
[filter]
recents = "--sort created- --created-after 'last two weeks'"
2021-02-26 22:18:47 +00:00
# COMMAND ALIASES
[alias]
# Edit the last modified note.
edlast = "zk edit --limit 1 --sort modified- $@"
# Edit the notes selected interactively among the notes created the last two weeks.
recent = "zk edit --sort created- --created-after 'last two weeks' --interactive"
# Show a random note.
lucky = "zk list --quiet --format full --sort random --limit 1"
2021-05-16 20:11:31 +00:00
# LSP (EDITOR INTEGRATION)
[lsp]
[lsp.diagnostics]
# Report titles of wiki-links as hints.
wiki-title = "hint"
# Warn for dead links between notes.
dead-link = "error"
2022-12-04 09:11:06 +00:00
```