Reuse draft script for adhoc notes
authorSiraaj Khandkar <siraaj@khandkar.net>
Thu, 30 Mar 2023 20:55:00 +0000 (16:55 -0400)
committerSiraaj Khandkar <siraaj@khandkar.net>
Thu, 30 Mar 2023 20:55:00 +0000 (16:55 -0400)
home/.xbindkeysrc
home/bin/draft

index c9c1d51..e8216ec 100644 (file)
 
 "cd ~/doc/ideas && gvim ideas.md"
     Mod4 + i
-#"cd ~/doc/drafts && drafts_prepend && gvim -c NERDTreeFind drafts.md"
+
 "cd ~/doc/drafts && drafts_prepend && gvim drafts.md"
     Mod4 + d + Shift
-"cd ~/doc/drafts && gvim $(draft)"
+"cd ~/doc/drafts && gvim $(draft ~/doc/drafts/adhoc)"
     Mod4 + d
+
 "cd ~/doc/notes && notes_prepend && gvim -c NERDTreeFind notes.md"
+    Mod4 + n + Shift
+"cd ~/doc/notes && gvim $(draft ~/doc/notes/adhoc)"
     Mod4 + n
+
 "cd ~/doc/bookmarks && gvim bookmarks.md"
     Mod4 + b
+
 "cd ~/doc/quotations && gvim quotations.md"
     Mod4 + q
 
index de7b6e4..d9f2c40 100755 (executable)
@@ -2,6 +2,8 @@
 
 set -euo pipefail
 
+DEFAULT_BASE="$HOME/doc/drafts/adhoc"
+
 bar() {
     local -r len="${1:-80}" # 1st arg or 80.
     local -r char="${2:--}" # 2nd arg or a dash.
@@ -10,10 +12,11 @@ bar() {
 }
 
 main() {
+    local -r base="${1:-$DEFAULT_BASE}"
+
     local -r title_given='Untitled'
     local -r title_lower=$(echo "$title_given" | tr '[:upper:]' '[:lower:]')
     local -r title_lower_dashed=$(echo "$title_lower" | sed 's/\s\+/-/g')
-    local -r base="${HOME}/doc/drafts/adhoc"
     local -r timestamp="$(date --iso-8601=ns)"
     local -r file="${base}/${timestamp}--${title_lower_dashed}.md"
 
This page took 0.025322 seconds and 4 git commands to generate.