Skip to content

Instantly share code, notes, and snippets.

@guychouk
Last active May 9, 2023 23:25
Show Gist options
  • Save guychouk/de2c0e624477efce920904125f0fb7b0 to your computer and use it in GitHub Desktop.
Save guychouk/de2c0e624477efce920904125f0fb7b0 to your computer and use it in GitHub Desktop.
⚡️ Zetz: simple note taking
#!/usr/bin/env bash
#
# _______| |_ ____
# |_ / _ \ __|_ /
# / / __/ |_ / /
# /___\___|\__/___|
#
# A note taking app for the terminal.
#
# Just set the $ZETZ_PATH environment variable
# to the path of your notes directory.
#
# Dependencies:
# - fzf
# - bat
#
# Assumptions:
# - Notes are written in Markdown
#
# Key Bindings:
# - ctrl-r: reload list
# - ctrl-x: delete note
# - ctrl-i: add a new note with the current date as the name (date format: %Y%m%d%H%M%S)
pushd $ZETZ_PATH
FZF_DEFAULT_COMMAND="find *.md -type f" \
fzf --height=100% --preview-window=right:45%:wrap \
--preview 'bat --language=md --style=plain --color=always {}' \
--bind 'enter:execute($EDITOR {})' \
--bind 'ctrl-r:reload($SHELL -c "${FZF_DEFAULT_COMMAND}")' \
--bind 'ctrl-x:execute-silent(rm -f {})+reload($SHELL -c "${FZF_DEFAULT_COMMAND}")' \
--bind 'ctrl-i:execute($EDITOR `date +"%Y%m%d%H%M%S"`.md")'
popd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment