Skip to content

Instantly share code, notes, and snippets.

@lostella
Last active November 8, 2023 23:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lostella/552b32e284eafaa5290be095131e9b8e to your computer and use it in GitHub Desktop.
Save lostella/552b32e284eafaa5290be095131e9b8e to your computer and use it in GitHub Desktop.
# Just journal for today: journal
# yesterday: journal -1
# in a directory: (cd PATH && journal)
function journal {
case "$(uname -s)" in
Linux*) machine=linux;;
Darwin*) machine=mac;;
esac
if [[ $machine == "mac" ]] then
dateshift="${1-+0}d"
targetdate="$(date -v $dateshift +%Y-%m-%d)"
else
dateshift="${1-+0} days"
targetdate="$(date -d $dateshift +%Y-%m-%d)"
fi
local filename="${targetdate}.md"
nvim + "$filename"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment