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;