Created
April 19, 2021 09:52
-
-
Save jujhars13/060ff015181ef388ab46fc4550269730 to your computer and use it in GitHub Desktop.
vimNotes using vim to save my notes on a weekly basis (bound to super+N)
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
#!/bin/bash | |
# inspired by Leafshade software https://www.youtube.com/watch?v=zB_3FIGRWRU&t=333s | |
# daily notes | |
#noteFilename="$HOME/Dropbox/notes/notes/note-$(date +%Y-%m-%d).md" | |
# weekly notes | |
fileDate="$(date +%Y-%m-%d)" | |
if [[ "$(date +%a)" != "Mon" ]]; then | |
fileDate="$(date -dlast-monday +%Y-%m-%d)" | |
fi | |
noteFilename="$HOME/Dropbox/notes/notes/note-${fileDate}.md" | |
if [[ ! -f "${noteFilename}" ]]; then | |
echo "# Notes for $(date +%Y-%m-%d)" > "${noteFilename}" | |
fi | |
# go to end of file | |
# add subheading | |
# create two empty lines | |
# put cursor in the middle scroll | |
# put into insert mode | |
vim -c "norm Go" \ | |
-c "norm Go## $(date '+%a %H:%M:%S')" \ | |
-c "norm G2o" \ | |
-c "norm zz" \ | |
"${noteFilename}" | |
#-c "startinsert" "${noteFilename}" [0.09s] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
for Danny Burke