From 929a8b9cae7f2ef4f5359a9d4f1ca9937f12c52c Mon Sep 17 00:00:00 2001 From: Wryn Wagner Date: Thu, 16 Sep 2021 20:16:20 -0600 Subject: [PATCH] moved notetaker to memo plugin' --- .gitmodules | 3 ++ env/env.zsh | 1 + zsh/notetaker | 82 ------------------------------------------------ zsh/plugins/memo | 1 + 4 files changed, 5 insertions(+), 82 deletions(-) delete mode 100644 zsh/notetaker create mode 160000 zsh/plugins/memo diff --git a/.gitmodules b/.gitmodules index 84e36df..0899775 100644 --- a/.gitmodules +++ b/.gitmodules @@ -19,3 +19,6 @@ [submodule "ssh-zsh"] path = zsh/plugins/ssh url = https://wryn.cloud/gizmos/ssh-zsh.git +[submodule "memo-zsh"] + path = zsh/plugins/memo + url = https://wryn.cloud/gizmos/memo-zsh.git diff --git a/env/env.zsh b/env/env.zsh index 2ba0e7b..24b0ecd 100644 --- a/env/env.zsh +++ b/env/env.zsh @@ -40,6 +40,7 @@ EXTERNAL_PLUGINS=( "$DOTWRYN/zsh/plugins/code-activator/activator.plugin.zsh" "$DOTWRYN/zsh/plugins/latex/latex.plugin.zsh" "$DOTWRYN/zsh/plugins/ssh/ssh.plugin.zsh" + "$DOTWRYN/zsh/plugins/memo/memo.plugin.zsh" ) FZF_DEFAULT_OPTS='--reverse' diff --git a/zsh/notetaker b/zsh/notetaker deleted file mode 100644 index b525c88..0000000 --- a/zsh/notetaker +++ /dev/null @@ -1,82 +0,0 @@ -#!/bin/zsh -# -alias note="TAKE_NOTE_OR_MEMO note" -alias memo="TAKE_NOTE_OR_MEMO memo" -alias memos="TAKE_NOTE_OR_MEMO viewmemos" - -function TAKE_NOTE_OR_MEMO() { - local FILENAME="$2"; - - local MEMO_DIR="$HOME/.memos"; - local FILETYPE='md'; - - local DIR=""; - local TITLE="$FILENAME"; - local ADD_EDITOR_ARGS=0; - local EDITOR_ARGS=''; - - local ERROR_CODE=0; - - case $1 in - - viewmemos ) - [ -d $MEMO_DIR ] || { - echo "unable to find any memos; try to make a memo first"; - ERROR_CODE=1; - } - - DIR="$MEMO_DIR" - FILENAME=''; - ;; - - memo ) - [ -d $MEMO_DIR ] || { - mkdir $MEMO_DIR || { - echo "unable to find or create memo directory '$MEMO_DIR'" - ERROR_CODE=2; - } - } - DIR="$MEMO_DIR" - - [ $FILENAME ] && FILENAME="$FILENAME.$FILETYPE"\ - || { - for i in {001..999}; do - TITLE="$i"; - FILENAME="$i.$FILETYPE"; - [ ! -f "$MEMO_DIR/$i.$FILETYPE" ] && break; - done - } - - ADD_EDITOR_ARGS=1; - ;; - - note ) - DIR="." - - [ $FILENAME ] || { - FILENAME="$(date -I)-notes"; - TITLE='Notes'; - ADD_EDITOR_ARGS=1; - } - - FILENAME="$FILENAME.$FILETYPE" - ;; - - * ) - echo "please specify whether this is an in-place 'note' or a general 'memo'"; - ERROR_CODE=3; - ;; - esac - - [ $ERROR_CODE -ne 0 ] && { - echo 'syntax: `TAKE_NOTE_OR_MEMO [ note | memo | viewmemos ] [ filename ]`'; - return $ERROR_CODE; - } - - [ $ADD_EDITOR_ARGS -ne 0 ] && [ ! -f "$DIR/$FILENAME" ] && { - DATESTRING="$(date '+%A, %B %-d, %Y')" - [ $EDITOR == 'vim' ] && EDITOR_ARGS='-c "normal! i# $TITLE :: $DATESTRING"'; - } - - eval "$EDITOR $EDITOR_ARGS $DIR/$FILENAME"; -} diff --git a/zsh/plugins/memo b/zsh/plugins/memo new file mode 160000 index 0000000..e28dbff --- /dev/null +++ b/zsh/plugins/memo @@ -0,0 +1 @@ +Subproject commit e28dbff13057b5ecfe5fa52920612adf5fc7c73e