• Stars
    star
    542
  • Rank 81,982 (Top 2 %)
  • Language
    Ruby
  • Created over 4 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Zettelkasten on the command-line ๐Ÿ“š ๐Ÿ”

zk

Stupid-fast plain-text Zettelkasten (zk) built for (terminal) nerds. Heavily featuring fzf, ripgrep, bat, and sqlite.

The goal of the zk repository is to collect scripts and configurations for other plain-text Zettelkasten users.

Note: This is an on-going extraction from my local environment, but has the utilities I use by far the most often. I can almost guarantee you you're going to run into a stacktrace somewhere because of some utility that isn't installed, etc. Please open PRs/issues if it's not working, or you have questions, concerns, comments. I'd also love contributions of scripts to bin/, such as showing related notes, polish to search, Vim configs, etc.

If you are looking for something slightly more complete that retains the Markdown-nature, you should take a look at Obsidian. After switching note-taking system every year for years, I am no longer interested in custom software and will stick to time-tested utilities.

In this screenshot, we have zks running in the top-right, zkt in the bottom-right, and vim in the left pane. zk can be used without tmux, but it's recommended to use tmux.

Usage

The scripts assumes $ZK_PATH is set to your Zettelkasten directory. Your Zettelkasten are markdown files in this directory. Nesting is presently not supported. Each note must have a 12-number prefix (date note was created), e.g. 202005050837 Monkey Ladder.md. It's recommended to do some kind of backup, e.g. Dropbox/iCloud/...

Your zk Zettelkasten is designed to be edited with your favourite editor. Currently zk only supports Vim natively. zk augments your editor with various scripts to help extract further value.

zk. Open vim in the left pane, and zks in the right pane. Your launch-point!

zks. fzf-enabled full-text search (top-right pane in screenshot above) over all your notes, using sqlite. The index updates automatically based on file modification. See the FZF_DEFAULT_OPTS below for various key-bindings you can use to open splits in Vim, copy to clipboard, etc. directly from here. Alt-S will find similar notes with zksim.

zksim. Finds similar notes to the note passed as an argument. See #1 for more.

zkt. fzf-enabled tag browser. Pressing enter on a tag will show you notes with that tag. notes, using sqlite. See the FZF_DEFAULT_OPTS below for various key-bindings you can use to open splits, copy to clipboard, etc. directly from here.

zkt-raw. Raw list of tags sorted by totals. Useful for other analysis. Used by zkt.

zkn. Create a new note, with an appropriate prefix.

zk-assets-localize. Given a file, downloads/copies the markdown images to media/.

zk-backlinks. Adds back-links to each note. I.e., if A links to B, but B doesn't link to A, then it'll append Backlink: [[A]] to B.

zkrt/zk-related-tags. Finds tags related to the ones in the passed file. You can pass -t to see a tree of tags.

Installation

Clone zk and add bin/ to your $PATH:

$ git clone https://github.com/sirupsen/zk.git ~/zk
$ echo 'export PATH=$PATH:$HOME/zk/bin' >> ~/.bashrc
$ echo 'export ZK_PATH="$HOME/Zettelkasten"' >> ~/.bashrc

Install the dependencies with your package manager.

MacOS:

# brew install ripgrep fzf sqlite3 bat
# gem install sqlite3

Linux:

build-essential,libsqlite3-dev and ruby-dev are needed to install the sqlite3 gem. For exampleโ€”on Debian/Ubuntu, run:

# apt install ripgrep fzf sqlite3 bat build-essential libsqlite3-dev ruby ruby-dev
# gem install sqlite3

For Vim, browse through my Vim config this to add a :Note, shortcut for tags, auto-completing other notes after typing [[, etc. Another function to look at is :GPT, which will take your range and send it to GPT3 for completion. Very cool for a perspective! One day this'll be a plugin that's easier to install.

If you're using fzf with vim, it's recommended to add this to your bash configuration. It adds super useful key-bindings to open files in splits (Ctrl-X/Ctrl-V) from zkt and zks directly. It also adds Ctrl-O to insert the file-name of whatever you're hovering into Vim, which is handy for links!:

export FZF_DEFAULT_OPTS="--height=40% --multi --tiebreak=begin \
  --bind 'ctrl-y:execute-silent(echo {} | pbcopy)' \
  --bind 'alt-down:preview-down,alt-up:preview-up' \
  --bind \"ctrl-v:execute-silent[ \
    tmux send-keys -t \{left\} Escape :vs Space && \
    tmux send-keys -t \{left\} -l {} && \
    tmux send-keys -t \{left\} Enter \
  ]\"
  --bind \"ctrl-x:execute-silent[ \
    tmux send-keys -t \{left\} Escape :sp Space && \
    tmux send-keys -t \{left\} -l {} && \
    tmux send-keys -t \{left\} Enter \
  ]\"
  --bind \"ctrl-o:execute-silent[ \
    tmux send-keys -t \{left\} Escape :read Space ! Space echo Space && \
    tmux send-keys -t \{left\} -l \\\"{}\\\" && \
    tmux send-keys -t \{left\} Enter \
  ]\""

Syncing

I recommend storing the notes in iCloud/Google Drive/Dropbox or whatever you use to normally sync files. Nice and simple. Some people store them in Git.

More Repositories

1

logrus

Structured, pluggable logging for Go.
Go
24,587
star
2

napkin-math

Techniques and numbers for estimating system's performance from first-principles
Rust
2,754
star
3

airrecord

Ruby wrapper for Airtable, your personal database
Ruby
295
star
4

dotfiles

Personal UNIX toolbox
Shell
188
star
5

anki-airtable

Sync Anki with Airtable!
Python
170
star
6

localjob

Simple, self-contained background queue built on top of SysV message queues.
Ruby
145
star
7

posix-mqueue

Ruby wrapper for POSIX IPC message queues.
C
102
star
8

sysvmq

Ruby wrapper for SysV IPC message queues.
C
50
star
9

initcwnd

Script to analyze the initial congestion window of any https server
Ruby
47
star
10

contestrus

An open source algorithmic contest platform
Ruby
31
star
11

Mongui

A simple GUI (web interface) for Mongo using Sinatra.
Ruby
24
star
12

progressrus

Monitor the progress of remote, long-running jobs.
Ruby
23
star
13

cachedis

Cachedis caches expensive (database) queries in Redis
Ruby
21
star
14

flying-cat

A modular, Lua-based operating system project.
C
15
star
15

tivitybalancer

Chrome extension that sends you to a random productive site from a list
JavaScript
14
star
16

airtable-rs

Rust wrapper for the Airtable API
Rust
12
star
17

vim-execrus

Framework for context dependent execution of commands in Vim
Vim Script
10
star
18

informatics

Solutions to various Informatics tasks from different judges.
Roff
8
star
19

can-has-lolcat

Fetches a random lolcat, and returns the appropriate output format.
Ruby
8
star
20

toxiproxy-rails-example

Example Rails application that uses Toxiproxy for resiliency testing.
Ruby
7
star
21

Flimpl

Simple and lightweight PHP MVC framework.
PHP
4
star
22

SteakMachine

Javascript state machine for those who like their states medium rare.
JavaScript
3
star
23

skypelogs

Ruby wrapper for your Skype logs.
Ruby
3
star
24

everdown

Sync Markdown files with Evernote
Ruby
3
star
25

instapaper-rs

Rust Instapaper API wrapper.
Rust
3
star
26

tomb

Tomb mirror from launchpad.net/tomb
Go
3
star
27

godis

Go
3
star
28

kafka

Apache Kafka Ruby client built as a wrapper for librdkafka
C
2
star
29

CCPL

Different tasks, solved in various languages.
Java
2
star
30

zooconf

Manage templated configuration files from Zookeeper
2
star
31

applog

Mirror og tideland.biz' applog for Go
Go
2
star
32

h

programming language
Ruby
2
star
33

Ruby-Introduciton-course

Slides for Ruby introduction course
Ruby
2
star
34

truffle-grater

http://trufflegrater.com
CSS
1
star
35

Lurker

Irc bot for Lurking project.
Ruby
1
star
36

Mongoground

A little something I threw together in Sinatra and Mongo for testing/show off purposes.
JavaScript
1
star
37

babushka-deps

Ruby
1
star
38

Shouldnt-you-be-doing-something-Awesome

Shouldn't you be doing something Awesome?
Ruby
1
star