4 ms·
Love this. This really appeals to my way of thinking, it's oldskool, but extremely practical.
by hammyhavoc 2y ago
Love this. This really appeals to my way of thinking, it's oldskool, but extremely practical.
- bravetraveler 2y agoGlad I hit the mark! I'll provide a copy below. Fair warning: only tested on Linux, not Mac/BSD: NOTE_DIR="${NOTE_DIR:-${HOME}/notes}" CURRENT_NOTE=$(date +%Y-week%V) LAST_WEEK_NAME=$(date -d '7 days ago' +%Y-week%V) NOTE_PATHS=("$NOTE_DIR/$CURRENT_NOTE" "$NOTE_DIR/$LAST_WEEK_NAME") EDITOR="${EDITOR:-vim}" if [[ $EDITOR == *vim* ]]; then # Run the vim-like editor with tabs $EDITOR -c ':tab all' "${NOTE_PATHS[@]}" else # Run the editor without vim tab arg $EDITOR "${NOTE_PATHS[@]}" fi The bit for '$EDITOR' makes this work for 'vim', but also 'gvim' (vim-X11) and 'neovim'. The assumption for 'else' is that the other editors simply accept an array of arguments with no other direction required Edit: I realize now I misspoke - no yearly directories [anymore]; dashed names instead! Apparently I quit that in week 10 of 2023. IIRC, managing the directories added a few lines I didn't care to keep. I don't look outside of the two week window often :)
- hammyhavoc 2y agoThanks! As a fellow Linux geek, I love this so much.