# Smarana Notebook Configuration

[smarana]
# The editor to use when running `sma --config`
editor = "nvim"
shell = "/bin/bash"
default_title = "Untitled Note"
# Script to generate the filename for a new note. The raw note name is provided via STDIN. 
filename_gen = "tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]\\+/-/g;s/^-//;s/-$//' | sed \"s/^/$(date +%F)-/\""

[frontmatter]
# Shell commands used to generate values for variables in the matter string
date = "date --iso"
time = "date +%T"
template = "fleeting.typ"

# Add aliases below. Each alias maps a name to a command and an optional description.
# Usage: sma <alias_name>

[alias]
fuzzy.cmd = "sma --list | awk '{print $1}' | fzf | sma"
fuzzy.desc = "Fuzzy find a note"

search.cmd = "sma --json | jq '.[] | .title'"
search.desc = "Search note titles"

recent.cmd = '''
sma --json \
  | jq -r '.[] | "\(.date) \(.title)"' \
  | sort -r \
  | head -20
'''
recent.desc = "Show 20 most recent notes"

edit-fuzzy.cmd = '''
note=$(sma --list | fzf)
if [ -n "$note" ]; then
  sma --edit "$note"
fi
'''
edit-fuzzy.desc = "Fuzzy find and edit a note"
