Display a bookmark's containing file in bookmark-find feature

This commit is contained in:
2026-02-24 16:11:12 -06:00
parent e6a90d5642
commit 7e5e5fe307
2 changed files with 10 additions and 3 deletions

View File

@@ -10,7 +10,11 @@ bm_selected_bookmark_url=$(
\( -type d -name "*archive" -prune \) \
-o \( -type d -name "*z-sort" -prune \) \
-o -name "*.bkmrk" -print |
while IFS= read -r bookmark_file; do tail -n +2 "$bookmark_file"; done |
while IFS= read -r bookmark_file; do
# tail -n +2 "$bookmark_file" |
# BKMRK_FZF_SED_STR="s/^(.*)$/$bookmark_file^\1/g" sed -E "$BKMRK_FZF_SED_STR"
tail -n +2 "$bookmark_file" | awk -v f="$bookmark_file" '{print $0 "^" f}'
done |
fzf \
--style full \
--border --padding 0,1 \

View File

@@ -1,6 +1,6 @@
#!/bin/sh
IFS="^" read -r bm_name bm_url bm_date_added bm_type bm_comments <<BM_LINE_BLOCK
IFS="^" read -r bm_name bm_url bm_date_added bm_type bm_comments bm_file <<BM_LINE_BLOCK
$(printf "%s" "$@")
BM_LINE_BLOCK
@@ -20,7 +20,10 @@ type:
comments:
%s
containing file:
%s
BM_PREVIEW_FORMAT_BLOCK)
printf "$bm_preview_format_block" \
"$bm_name" "$bm_url" "$bm_date_added" "$bm_type" "$bm_comments"
"$bm_name" "$bm_url" "$bm_date_added" "$bm_type" "$bm_comments" "$bm_file"