plan/plan.bak

45 lines
826 B
Bash
Executable File

#!/bin/bash
cd ~/.plan || {
echo "Directory ~/.plan not found"
exit 1
}
# YYYY-MM-DD format
today=$(date +%F)
# create if None
if ! ls "$today.md" >/dev/null 2>&1; then
touch "$today.md"
{
printf "# %s\n\n" "$today"
printf "# todo\n\n"
# todo
- chore: shred documents.
- workout: ymca.
- buy: soda stream.
- donate: table
- hang: painting
- code:
# meals
- breakfast: oatmeal
- lunch: leftovers
- dinner: curry
# groceries
} >>"$today.md"
fi
# most recently modified
recent_file=$(ls -t *.md | head -n 1)
if [[ "$recent_file" != "$today.md" ]]; then
recent_file="$today.md"
fi
# Open the most recent file in Neovim and run the <C-e> command
nvim "$recent_file" +":normal \<C-e\>"