@ -11,6 +11,10 @@ All notable changes to this project will be documented in this file.
* This is the same format as a notebook [configuration file](docs/config.md).
* Shared templates can be stored in `~/.config/zk/templates/`.
* `XDG_CONFIG_HOME` is taken into account.
* Use `--notebook-dir` or set `ZK_NOTEBOOK_DIR` to run `zk` as if it was started from this path instead of the current working directory.
* This allows running `zk` without being in a notebook.
* By setting `ZK_NOTEBOOK_DIR` in your shell configuration file (e.g. `~/.profile`), you are declaring a default global notebook which will be used when `zk` is not in a notebook.
* When the notebook directory is set explicitly, any path given as argument will be relative to it instead of the actual working directory.
@ -20,10 +20,10 @@ An alias can call other aliases but cannot call itself. This enables you to over
edit = "zk edit --interactive $@"
```
When running an alias, the `ZK_PATH` environment variable is set to the absolute path of the current notebook. You can use it to run commands working no matter the location of the working directory.
When running an alias, the `ZK_NOTEBOOK_DIR` environment variable is set to the absolute path of the current notebook. You can use it to run commands working no matter the location of the working directory.
```toml
journal = 'zk new "$ZK_PATH/journal"'
journal = 'zk new "$ZK_NOTEBOOK_DIR/journal"'
```
If you need to surround the path with quotes, make sure you use double quotes, otherwise environment variables will not be expanded.
@ -34,12 +34,12 @@ That is a bit of a mouthful for a command called every day. Would it not be bett
```toml
[alias]
daily = 'zk new --no-input "$ZK_PATH/journal/daily"'
daily = 'zk new --no-input "$ZK_NOTEBOOK_DIR/journal/daily"'
```
Let's unpack this alias:
* `zk new` will refuse to overwrite notes. If you already created today's note, it will instead ask you if you wish to edit it. Using `--no-input` skips the prompt and edit the existing note right away.
* `$ZK_PATH` is set to the absolute path of the current [notebook](notebook.md) when running an alias. Using it allows you to run `zk daily` no matter where you are in the notebook folder hierarchy.
* We need to use double quotes around `$ZK_PATH`, otherwise it will not be expanded.
* `$ZK_NOTEBOOK_DIR` is set to the absolute path of the current [notebook](notebook.md) when running an alias. Using it allows you to run `zk daily` no matter where you are in the notebook folder hierarchy.
* We need to use double quotes around `$ZK_NOTEBOOK_DIR`, otherwise it will not be expanded.
@ -4,7 +4,7 @@ A *notebook* is a directory containing a collection of notes managed by `zk`. No
To create a new notebook, simply run `zk init [<directory>]`.
Most `zk` commands are operating "Git-style" on the notebook containing the current working directory (or one of its parents).
Most `zk` commands are operating "Git-style" on the notebook containing the current working directory (or one of its parents). However, you can explicitly set which notebook to use with `--notebook-dir` or the `ZK_NOTEBOOK_DIR` environment variable. Setting `ZK_NOTEBOOK_DIR` in your shell configuration (e.g. `~/.profile`) can be used to define a default notebook which `zk` commands will use when the working directory is not in another notebook.