From 450a395c5ba9eaf206db869173bed1d1ab1c9059 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=84min=20Baumeler?= Date: Wed, 21 May 2025 17:19:59 +0200 Subject: [PATCH] Added delete option Using ctrl-k --- fzf-vjour | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/fzf-vjour b/fzf-vjour index 4d345de..75621bd 100755 --- a/fzf-vjour +++ b/fzf-vjour @@ -236,12 +236,18 @@ if [[ "${1:-}" == "--preview" ]]; then cat "$vjfile" | __vjournal2json | jq -r ".description" | batcat --color=always --style=numbers --language=md exit fi +# Delete file from selection +if [[ "${1:-}" == "--delete" ]]; then + local vjfile=$(__filepath_from_selection "$2") + rm -v "$vjfile" + exit +fi -selection=$(__lines | fzf --ansi --preview="$0 --preview {}" - #--bind='ctrl-d:execute(rm -i $(echo {}|$HOME/.zsh/journaling/filefromline))' \ +selection=$(__lines | fzf --ansi \ + --preview="$0 --preview {}" \ + --bind="ctrl-d:execute($0 --delete {})" #--bind='ctrl-n:execute($HOME/.zsh/journaling/add)' \ #--bind='ctrl-s:execute(vdirsyncer sync journals)' \ - #--preview='vjour2json < $(echo {}|$HOME/.zsh/journaling/filefromline) | jq -r ".description" | batcat --color=always --style=numbers --language=md') ) if [[ -z "$selection" ]]; then return 0;