You can add a new note to a notebook using zk new --title "An interesting concept" [<directory>]
.
zk
automatically generates a filename and initial content according to rules set in your configuration file. These settings can be customized per group of notes in your notebook, as illustrated in Maintaining a daily journal.
By default, zk new
will start your editor after creating the note. You can choose instead to print the absolute path to the note with --print-path
, which is more useful for automation.
If you are not sure whether a note already exists for a particular subject, the "search or create" mode might be more appropriate than zk new
. It is inspired by Notational Velocity and enables searching for an existing note or creating a new one in a single action.
This option is available when running zk edit --interactive
, which spawns fzf
to filter selected notes. From fzf
, press Ctrl-E
to create a new note using the current search query as title.
Initial content can be fed to the template through standard input using zk new --interactive
, which will be expandable with the {{content}}
template variable.
For example, to use the content of the macOS clipboard as the initial content you can run:
$ pbpaste | zk new --interactive
Alternatively, you can use the content of a file:
$ zk new --interactive < file.txt