I've got a few zsh functions that let me type "note" which creates a file named todays date (if it doesn't exist), inserts a timestamp, and opens it in vim. When I exit vim, the notes directory is committed to git then pushed up. This lets me keep my notes directory in sync across machines, and available via web (gitea).
note () {
DATE=`date +"%Y%m%d"`
TS=`date +"%Y%m%d %H:%M:%S"`
FILE=$HOME/Documents/notes/$DATE.txt
notegitpull
echo $TS >> $FILE
vi $FILE
notegitpush
}
notegitpull () {
pushd $HOME/Documents/notes
if ping -c 1 git.server &> /dev/null
then
git pull
else
echo "Offline, not pulling changes"
fi
popd
}
notegitpush () {
pushd $HOME/Documents/notes
git pull
git add \*
git commit -m "Autocommit due to edit of $FILE"
if ping -c 1 git.server &> /dev/null
then
git push origin main
else
echo "Offline, not pushing changes up"
fi
popd
}