Compare commits
2 Commits
5b956b096c
...
b6a29a0dca
Author | SHA1 | Date |
---|---|---|
Leonora Tindall | b6a29a0dca | |
Leonora Tindall | 58c309fe91 |
6
README
6
README
|
@ -2,7 +2,7 @@ nnote: nora's notes
|
||||||
----
|
----
|
||||||
|
|
||||||
provides a script, nnote, to quickly make notes in a simple hierarchy
|
provides a script, nnote, to quickly make notes in a simple hierarchy
|
||||||
provides four quick aliases: dnote, mnote, ynote, gnote
|
provides eight quick aliases: dnote[s], mnote[s], ynote[s], gnote[s]
|
||||||
|
|
||||||
installation
|
installation
|
||||||
----
|
----
|
||||||
|
@ -39,6 +39,10 @@ aliases are provided:
|
||||||
- ynote for yearly
|
- ynote for yearly
|
||||||
- gnote for global
|
- gnote for global
|
||||||
|
|
||||||
|
pluralized aliases (dnotes, mnotes, ynotes, gnotes) are provided to open an
|
||||||
|
editor in the appropriate directory. this is great if you use an editor with
|
||||||
|
a directory-based quick find function, like CtrlP.vim or Telescope in Neovim
|
||||||
|
|
||||||
you can enter different names but by default those are the note names too
|
you can enter different names but by default those are the note names too
|
||||||
the file hierarchy is very simple, for instance:
|
the file hierarchy is very simple, for instance:
|
||||||
- $NOTESDIR
|
- $NOTESDIR
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
if [ -f "$(which nnotes)" ]; then
|
||||||
|
NNOTES="$(which nnotes)"
|
||||||
|
else
|
||||||
|
NOTEBIN="$( dirname -- "$( readlink -f -- "$0"; )"; )"
|
||||||
|
NNOTES="$NOTEBIN/nnotes"
|
||||||
|
fi
|
||||||
|
|
||||||
|
$NNOTES daily "$*"
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
if [ -f "$(which nnotes)" ]; then
|
||||||
|
NNOTES="$(which nnotes)"
|
||||||
|
else
|
||||||
|
NOTEBIN="$( dirname -- "$( readlink -f -- "$0"; )"; )"
|
||||||
|
NNOTES="$NOTEBIN/nnotes"
|
||||||
|
fi
|
||||||
|
|
||||||
|
$NNOTES global "$*"
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
if [ -f "$(which nnotes)" ]; then
|
||||||
|
NNOTES="$(which nnotes)"
|
||||||
|
else
|
||||||
|
NOTEBIN="$( dirname -- "$( readlink -f -- "$0"; )"; )"
|
||||||
|
NNOTES="$NOTEBIN/nnotes"
|
||||||
|
fi
|
||||||
|
|
||||||
|
$NNOTES monthly "$*"
|
||||||
|
|
2
nnote
2
nnote
|
@ -43,6 +43,8 @@ else
|
||||||
printf "$NOTENAME$NOTEHEAD\n---\n\n" > "$NOTEPATH"
|
printf "$NOTENAME$NOTEHEAD\n---\n\n" > "$NOTEPATH"
|
||||||
fi
|
fi
|
||||||
pushd "$NOTESDIR" > /dev/null
|
pushd "$NOTESDIR" > /dev/null
|
||||||
|
printf "\033]2;$NOTENAME $NOTETYPE note\a"
|
||||||
$EDITOR "$NOTEPATH"
|
$EDITOR "$NOTEPATH"
|
||||||
|
printf "\033]2;\a"
|
||||||
popd > /dev/null
|
popd > /dev/null
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
NOTETYPE="${1-}"
|
||||||
|
if [[ "$NOTETYPE" == "daily" ]]; then
|
||||||
|
DATESTRING="$(date +%Y/%m/%d)"
|
||||||
|
NOTEHEAD=" for $DATESTRING"
|
||||||
|
elif [[ "$NOTETYPE" == "monthly" ]]; then
|
||||||
|
DATESTRING="$(date +%Y/%m)"
|
||||||
|
NOTEHEAD=" for $DATESTRING"
|
||||||
|
elif [[ "$NOTETYPE" == "yearly" ]]; then
|
||||||
|
DATESTRING="$(date +%Y)"
|
||||||
|
NOTEHEAD=" for $DATESTRING"
|
||||||
|
elif [[ "$NOTETYPE" == "global" ]]; then
|
||||||
|
DATESTRING=""
|
||||||
|
NOTEHEAD=""
|
||||||
|
else
|
||||||
|
echo "usage: nnotes <type>"
|
||||||
|
echo " open $EDITOR (\$EDITOR) in the directory for \$type notes"
|
||||||
|
echo " nnote <type> --help | -h"
|
||||||
|
echo " get help for a note type"
|
||||||
|
echo " "
|
||||||
|
echo "nnotes requires a type: daily, monthly, yearly, or global"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${2-}" == "--help" ] || [ "${2-}" == "-h" ]; then
|
||||||
|
echo "usage: nnotes $NOTETYPE"
|
||||||
|
echo " open $EDITOR (\$EDITOR) in \$NOTESDIR/$DATESTRING"
|
||||||
|
echo " default \$NOTESDIR is ~/Notes"
|
||||||
|
echo " yours is ${NOTESDIR-$HOME/Notes}"
|
||||||
|
else
|
||||||
|
NOTESDIR="${NOTESDIR:-$HOME/Notes}"
|
||||||
|
DATEDIR="$NOTESDIR/$DATESTRING"
|
||||||
|
mkdir -p "$DATEDIR"
|
||||||
|
echo "$DATEDIR"
|
||||||
|
pushd "$NOTESDIR" > /dev/null
|
||||||
|
printf "\033]2;$NOTETYPE note\a"
|
||||||
|
$EDITOR
|
||||||
|
printf "\033]2;\a"
|
||||||
|
popd > /dev/null
|
||||||
|
fi
|
Loading…
Reference in New Issue