#!/usr/bin/env sh

# Command for notes scratchpad used in dwm
selection=$(fd --color=always                   \
  --base-directory ~/notes                      \
  -e md -e txt -e qalc                          \
  | fzf                                         \
    --ansi                                      \
    --prompt=" Notes  "                        \
    --margin="10%,3%"                           \
    --no-info --height=100% --scrollbar=""      \
    --preview="fuz-preview ~/notes/{}"          \
    --preview-window="70%,border-left")

[ -n "$selection" ] && nvim ~/notes/"$selection"