summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xz7
-rwxr-xr-xz-edit-daily12
2 files changed, 17 insertions, 2 deletions
diff --git a/z b/z
index 855e669..4082828 100755
--- a/z
+++ b/z
@@ -3,6 +3,7 @@
# -- browse tags:
# --bind "ctrl-t:unbind(change)+enable-search+preview[echo 'match: {}']+reload[rg --no-filename --only-matching '(^|\B)#\w+' | sort | uniq]" \
# - vim function to follow wiki links
+# - search both title and content
set -euo pipefail
notesdir=${NOTES:-~/notes/notes}
cd "$notesdir"
@@ -15,17 +16,19 @@ fzf \
--disabled \
--header="alt+: 0=view 1=search 2=tags 3=outline 4=backlinks" \
--header-first \
+ --delimiter : \
+ --with-nth 1 \
--bind "ctrl-/:change-preview-window(90%|down|hidden|)" \
--bind "change:reload:$RG {q} || true" \
--bind "enter:execute($EDITOR {})" \
--bind "alt-enter:execute($EDITOR {q}.md)" \
- --bind "ctrl-space:execute($EDITOR daily/\$(date $DATEFMT).md)" \
+ --bind "ctrl-space:execute($EDITOR $(z-edit-daily))" \
--bind "ctrl-r:replace-query" \
+ --bind "ctrl-t:unbind(change,alt-enter)+change-prompt(title> )+enable-search+clear-query" \
--bind "pgdn:preview-page-down" \
--bind "pgup:preview-page-up" \
--bind "alt-0:preview:bat -p --color always {}" \
--bind "alt-1:preview($RG_VIEW {q} {})" \
- --bind "alt-1:+reload:$RG {q} || true" \
--bind "alt-2:preview:rg --only-matching '(^|\B)#\w+' {}" \
--bind "alt-3:preview:rg --only-matching '^[#]+ .*$' {}" \
--bind "alt-4:reload:rg -lF \$(tr -d '.md' <<< {+}) || true" \
diff --git a/z-edit-daily b/z-edit-daily
new file mode 100755
index 0000000..05da963
--- /dev/null
+++ b/z-edit-daily
@@ -0,0 +1,12 @@
+#!/usr/bin/env bash
+#
+# Return today's daily notes file. If it doesn't already exist, make it using the
+# daily template. Must be executed from inside the notes directory.
+#
+DATEFMT="+%Y.%-m.%-d"
+DATE=$(date $DATEFMT)
+FILE="daily/$DATE"
+if [[ ! -f "$FILE" ]]; then
+ cat templates/daily.md | sed "s/{{date:YYYY.M.D}}/$DATE/" > $FILE
+fi
+echo "$FILE"