Code Monkey home page Code Monkey logo

zk's Introduction

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.

zk's People

Contributors

ryanwilldev avatar sirupsen avatar sleeping-barber avatar varunkashyap4dg avatar ziyi-yan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

zk's Issues

A toolset inspired by zk

I've developed a set of UNIX-philosophy CLI utilities for managing your zettelkasten, a C++ library (used by the utilities) and a set of shell scripts that makes the whole thing easy to use for the terminal-savvy.
It's divided into a set of CLI utilities with consistent, UNIX-like interfaces, and a set of scripts that implement the fzf-based picker functionality.
It's all heavily inspired by this project, just faster, more consistent, more docs. Feel free to check it out, maybe also link (I link to this page).

utilities + lib: https://gitlab.com/andrejr/zetk
shell wrappers: https://gitlab.com/andrejr/zetk_fzf

OS platform detection

request for OS platform detection method for specific tools like grep and sort. since in darwin, bsd, and linux has different param and binary name. could i contribute to this?

Lack of documentation

I think it would be great to make documentation as to how to use "zk". The readme.md is not sufficient enough, as I still get trouble to start using this. Yes, I can just read the code, but i will be grateful if you could provide practical use of it. Thanks.

Error when using zksim, example usage would be helpful in Readme

I am trying to setup zk for personal use and I am not able to figure out the example usage of zksim

I am getting error when executing the command (p.s I am confused about the input arguments to zksim) but I doubt it matters.

~ zksim dummy
Traceback (most recent call last):
  File "/home/imran/zk/bin/zksim", line 118, in <module>
    TfidfSearch().run()
  File "/home/imran/zk/bin/zksim", line 114, in run
    self.application_logic(args.filename)
  File "/home/imran/zk/bin/zksim", line 101, in application_logic
    for file in relevant_titles(df, filename, title_col="title", text_col="body")[:self.num_files_to_show]:
  File "/home/imran/zk/bin/zksim", line 70, in relevant_titles
    sim_index = similarity_index(searching_index, vectors)
  File "/home/imran/zk/bin/zksim", line 55, in similarity_index
    cosine_similarities = linear_kernel(vectors[search_index], vectors).flatten()
  File "/home/imran/.local/lib/python3.8/site-packages/sklearn/metrics/pairwise.py", line 1002, in linear_kernel
    X, Y = check_pairwise_arrays(X, Y)
  File "/home/imran/.local/lib/python3.8/site-packages/sklearn/utils/validation.py", line 73, in inner_f
    return f(**kwargs)
  File "/home/imran/.local/lib/python3.8/site-packages/sklearn/metrics/pairwise.py", line 144, in check_pairwise_arrays
    X = check_array(X, accept_sparse=accept_sparse, dtype=dtype,
  File "/home/imran/.local/lib/python3.8/site-packages/sklearn/utils/validation.py", line 73, in inner_f
    return f(**kwargs)
  File "/home/imran/.local/lib/python3.8/site-packages/sklearn/utils/validation.py", line 651, in check_array
    raise ValueError("Found array with %d sample(s) (shape=%s) while a"
ValueError: Found array with 0 sample(s) (shape=(0, 4)) while a minimum of 1 is required by check_pairwise_arrays.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.