tenseleyflow/ndotfiles / 47e7d4f

Browse files

raycast script for viewing quicknotes

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
47e7d4ff884a46002bb62cb22dc0068a4c6a8a64
Parents
c4f9fca
Tree
656f2f6

1 changed file

StatusFile+-
A Script/browse-markdown 35 0
Script/browse-markdownadded
@@ -0,0 +1,35 @@
1
+#!/bin/bash
2
+
3
+# Required parameters:
4
+# @raycast.schemaVersion 1
5
+# @raycast.title Browse Markdown Files
6
+# @raycast.mode silent
7
+
8
+# Optional parameters:
9
+# @raycast.icon 📝
10
+# @raycast.description Browse ndotfiles notes and view micro keybinds
11
+# @raycast.packageName Markdown Browser
12
+# @raycast.argument1 { "type": "text", "placeholder": "Directory (optional)", "optional": true }
13
+
14
+# Get the script's directory to find ndotfiles root
15
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
16
+NDOTFILES_ROOT="$(dirname "$SCRIPT_DIR")"
17
+
18
+# Set directory to search (default to ndotfiles/notes or argument)
19
+SEARCH_DIR="${1:-$NDOTFILES_ROOT/notes}"
20
+
21
+# Check if directory exists
22
+if [ ! -d "$SEARCH_DIR" ]; then
23
+  echo "Error: Directory '$SEARCH_DIR' does not exist"
24
+  exit 1
25
+fi
26
+
27
+# Launch fzf markdown browser in a floating Ghostty window
28
+open -na Ghostty --args -e bash -c "
29
+  cd '$SEARCH_DIR' && \
30
+  fd -e md -e markdown | \
31
+  fzf --preview 'bat --color=always --style=numbers {}' \
32
+      --preview-window=right:60% \
33
+      --bind 'enter:execute(open {})+abort' \
34
+      --header 'Enter: Open | Esc: Cancel'
35
+"