Sample script to fuzzy search with a preview

This commit is contained in:
Arun Prakash Jana 2020-12-08 22:24:57 +05:30
parent d4c9b89b6e
commit 8a3cd7f715
No known key found for this signature in database
GPG Key ID: A75979F35C080412

View File

@ -296,20 +296,20 @@ PROMPT KEYS:
b -p b -p
6. For GUI and browser integration (or to sync bookmarks with your favourite bookmark management service) refer to the wiki page on [System integration](https://github.com/jarun/buku/wiki/System-integration). 6. For GUI and browser integration (or to sync bookmarks with your favourite bookmark management service) refer to the wiki page on [System integration](https://github.com/jarun/buku/wiki/System-integration).
7. Handy (bash/zsh) commands to fuzzy search all URLs and open the selected one in Firefox: 7. Handy (bash/zsh) commands to fuzzy search with fzf and open the selection in Firefox:
firefox $(buku -p -f 10 | fzf) firefox $(buku -p -f 10 | fzf)
firefox $(buku -p -f 40 | fzf | cut -f1) firefox $(buku -p -f 40 | fzf | cut -f1)
POSIX script to allow cancellation as well: POSIX script to show a preview of the bookmark as well:
```sh ```sh
#!/usr/bin/env sh #!/usr/bin/env sh
url=$(buku -p -f 40 | fzf | cut -f1) url=$(buku -p -f4 | fzf -m --reverse --preview "buku -p {1}" --preview-window=wrap | cut -f2)
if [ -n "$url" ]; then if [ -n "$url" ]; then
firefox "$url" echo "$url" | xargs firefox
fi fi
``` ```