From c3ed08e42fc9ee395c9268bd20176b583c5b638f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=84min=20Baumeler?= Date: Sat, 28 Feb 2026 22:31:10 +0100 Subject: [PATCH] note deletion with bang --- autoload/denote/ft.vim | 2 +- autoload/denote/notes.vim | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/autoload/denote/ft.vim b/autoload/denote/ft.vim index c97e704..4f11ee3 100644 --- a/autoload/denote/ft.vim +++ b/autoload/denote/ft.vim @@ -45,7 +45,7 @@ function denote#ft#qf() command! -nargs=1 -range -buffer DenoteSetTitle :call denote#notes#settitle(, ) command! -nargs=1 -range -buffer -complete=custom,denote#completion#tags DenoteTagAdd :call denote#notes#tagmod(, , , v:true) command! -nargs=1 -range -buffer -complete=custom,denote#completion#tags DenoteTagRm :call denote#notes#tagmod(, , , v:false) - command! -range -buffer DenoteDelete :call denote#notes#rm(, ) + command! -range -buffer -bang DenoteDelete :call denote#notes#rm(, , 0) nnoremap C :DenoteSetTitle nnoremap + :DenoteTagAdd nnoremap - :DenoteTagRm diff --git a/autoload/denote/notes.vim b/autoload/denote/notes.vim index 8524d2b..3965bef 100644 --- a/autoload/denote/notes.vim +++ b/autoload/denote/notes.vim @@ -146,7 +146,8 @@ function denote#notes#copy(origfile) endfunction " Delete notes from denote directory -function denote#notes#rm(line1, line2) +function denote#notes#rm(line1, line2, bang) + echom "bang set to:"..a:bang let l:items = getloclist(0, {'items': 1})['items'] if empty(l:items) return @@ -156,9 +157,11 @@ function denote#notes#rm(line1, line2) let l:bufnr = l:item['bufnr'] let l:filename = bufname(l:bufnr) let l:title = denote#meta#noteTitleFromFile(l:filename) - let l:answer = confirm('Are you sure you want to delete the note "' .. l:title .. '"?', "&Yes\n&No\n", 2, 'Question') - if l:answer != 1 - continue + if a:bang == v:false + let l:answer = confirm('Are you sure you want to delete the note "' .. l:title .. '"?', "&Yes\n&No\n", 2, 'Question') + if l:answer != 1 + continue + endif endif " Wipe buffer, if it exists if bufexists(l:filename)