Command line tool to manage a personal wiki, written in zig.
wk
is a command line tool to manage a personal wiki. By design, the wiki is
minimal and made up of simple plain text files. It is designed to be used
solely in the terminal (it has no GUI or web interface) and to be synchronized
using external tools (e.g. version control or a syncing service such as
Nextcloud or Syncthing).
New wiki pages are given a .md
extension, although there is nothing enforcing
that they be written in Markdown syntax. New pages are also given a YAML
metadata template, which is used by wk
to extract the wiki page title and
tags, which is used by various subcommands.
Example:
---
title: Some wiki page
date: July 26, 2020
tags: example
---
This is an example of a wiki page.
All new pages are given a unique ID, which is prepended to its filename. This
ID is displayed in the various wk
commands. Pages can be linked together
using these IDs.
See examples here.
Download and extract a release to the location of your choosing.
If you use macOS and Homebrew you can use
brew install --HEAD gpanders/tap/wk
Install zig. After cloning this repository, build wk
with
make
This will build wk
under zig-cache/bin/
. You can install wk
using
make install
By default, this installs to /usr/local/bin/
. To install to a different
location, set the prefix
variable. For example, to install under
$HOME/.local/bin/
use
make prefix=$HOME/.local install
Notes are stored in the directory represented by the environment variable
$WIKI_DIR
. If $WIKI_DIR
is unset, it defaults to $HOME/.local/share/wk/
.
Notes are created with
wk new TITLE
The file name of the new note will be the given title prepended with a unique
ID and a .md
extension. The title can contain spaces, but be sure to wrap it
in quotes so your shell doesn't split it.
To list all of your existing notes, use
wk list
This will print the title of each existing note along with its ID.
For a full list of available commands, use wk help
. For more information on
a specific command, use wk help COMMAND
.
For commands that take arguments, the argument can be a note ID, title, or file
name (with or without the extension) of an existing note. The output of any
wk
command can be used with other commands, allowing commands to be
composed. For example, to open all notes containing the tag "foo", use
wk tag foo | wk open
Most commands can be abbreviated. Use wk help CMD
for more information.
This repo includes a Vim plugin in the contrib/vim/
directory. This plugin adds
some useful features to Vim that makes working in your personal wiki a bit
easier. Notably, it sets the include
and includeexpr
options, allowing you
to use Vim's gf
and include-search
features (use :h gf
and :h include-search
in Vim for more info). The plugin also enables autocompletion
of tags and wiki IDs through the completefunc
option.