#!/bin/sh -e
#
# spnotes - command for notes scratchpad use in dwm/etc


NOTE_DIR=${NOTE_DIR:-${HOME}/notes}
selection=$(fd --color=always \
  --base-directory "${NOTE_DIR}" \
  -e md -e txt -e qalc \
  | fzf \
    --ansi \
    --prompt=" Notes  " \
    --margin="10%,3%" \
    --no-info --height=100% --scrollbar="" \
    --preview="fuz-preview ${NOTE_DIR}/{}" \
    --preview-window="70%,border-left")

[ -n "${selection}" ] && ${EDITOR:-vi} "${NOTE_DIR}"/"${selection}"
