Last active
November 8, 2023 23:35
-
-
Save lostella/552b32e284eafaa5290be095131e9b8e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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