3 ms·
In my .zshrc: # Summary: run `note <title>` to make a new note # run `notes` to get a fuzzy finder (if available) to view all notes function not
by nameless912 8y ago
In my .zshrc:
# Summary: run `note <title>` to make a new note
# run `notes` to get a fuzzy finder (if available) to view all notes
function note() {
NOTE_DIR=~/Dropbox/notes
mkdir -p $NOTE_DIR || true
NOTE_NAME="$1"
if [[ -z $NOTE_NAME ]]; then
NOTE_NAME="$(date +%Y-%m-%d)"
else
NOTE_NAME="$(date +%Y-%m-%d)-$NOTE_NAME"
fi
vim $NOTE_DIR/$NOTE_NAME.txt
}
function notes() {
NOTE_DIR=~/Dropbox/notes
mkdir -p $NOTE_DIR || true
pushd $NOTE_DIR > /dev/null
# Use the fuzzy finder if available
if command_exists fzf; then
# Only open the selection if one was actually chosen
NOTEFILE=$(find * -type f -maxdepth 0 | fzf)
if [[ -n $NOTEFILE ]]; then
vim $NOTEFILE
fi
else
vim .
fi
popd > /dev/null
}
I dump my notes in my Dropbox folder so that I get sync for free. And fzf makes finding notes super easy.