-
-
Save hbjydev/d57a62d030e347760665d6d486a25439 to your computer and use it in GitHub Desktop.
zk - zettelkasten management script (requires ripgrep, neovim, bat and fzf)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
function zk_dir() { | |
if [[ ! -d $HOME/zet ]]; then | |
mkdir $HOME/zet | |
fi | |
} | |
function zk_id() { | |
date +%Y%m%d%k%M%S | |
} | |
function zk_new() { | |
id="$(zk_id)" | |
zk_dir | |
nvim $HOME/zet/$id.md | |
} | |
function zk_search() { | |
nvim $(rg -l -i "$@" $HOME/zet/*.md | fzf --preview "bat --color always --style plain {}") | |
} | |
if [[ "$1" == "new" ]]; then | |
# new zettelkasten | |
zk_new | |
elif [[ "$1" == "search" ]]; then | |
# search zettelkasten | |
zk_search "${@:2}" | |
else | |
# no subcommand | |
echo "zk -- $(tput setaf gray)manage a zettelkasten in ~/zet$(tput sgr0)" | |
echo "" | |
echo " new: create new note" | |
echo " search [keywords]: search through existing zettelkasten" | |
echo "" | |
echo "copyright (c) hayden young 2022" | |
fi |
Line 38 has a non capitalized name, very sus.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you wanna use this, chuck it somewhere in
$PATH
and make it executable, then usezk <new|search>
to search through everything. :)