moved notetaker to memo plugin'

This commit is contained in:
Wryn Wagner 2021-09-16 20:16:20 -06:00
parent 5c1b525d8d
commit 929a8b9cae
4 changed files with 5 additions and 82 deletions

3
.gitmodules vendored
View File

@ -19,3 +19,6 @@
[submodule "ssh-zsh"] [submodule "ssh-zsh"]
path = zsh/plugins/ssh path = zsh/plugins/ssh
url = https://wryn.cloud/gizmos/ssh-zsh.git url = https://wryn.cloud/gizmos/ssh-zsh.git
[submodule "memo-zsh"]
path = zsh/plugins/memo
url = https://wryn.cloud/gizmos/memo-zsh.git

1
env/env.zsh vendored
View File

@ -40,6 +40,7 @@ EXTERNAL_PLUGINS=(
"$DOTWRYN/zsh/plugins/code-activator/activator.plugin.zsh" "$DOTWRYN/zsh/plugins/code-activator/activator.plugin.zsh"
"$DOTWRYN/zsh/plugins/latex/latex.plugin.zsh" "$DOTWRYN/zsh/plugins/latex/latex.plugin.zsh"
"$DOTWRYN/zsh/plugins/ssh/ssh.plugin.zsh" "$DOTWRYN/zsh/plugins/ssh/ssh.plugin.zsh"
"$DOTWRYN/zsh/plugins/memo/memo.plugin.zsh"
) )
FZF_DEFAULT_OPTS='--reverse' FZF_DEFAULT_OPTS='--reverse'

View File

@ -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";
}

1
zsh/plugins/memo Submodule

@ -0,0 +1 @@
Subproject commit e28dbff13057b5ecfe5fa52920612adf5fc7c73e