diff --git a/ftplugin/vimwiki.vim b/ftplugin/vimwiki.vim index 509f997..c77e6cb 100644 --- a/ftplugin/vimwiki.vim +++ b/ftplugin/vimwiki.vim @@ -74,7 +74,7 @@ if !has('nvim') command! -buffer -nargs=1 VimwikiChangeSymbolTo call nuwiki#commands#list_change_symbol(, 0) command! -buffer -nargs=1 VimwikiListChangeSymbolI call nuwiki#commands#list_change_symbol(, 0) command! -buffer -nargs=1 VimwikiChangeSymbolInListTo call nuwiki#commands#list_change_symbol(, 1) - command! -buffer VimwikiRemoveDone call nuwiki#commands#list_remove_done() + command! -buffer -bang VimwikiRemoveDone if 0 | call nuwiki#commands#list_remove_done_all() | else | call nuwiki#commands#list_remove_done() | endif command! -buffer -range VimwikiRemoveSingleCB call nuwiki#commands#list_remove_checkbox() command! -buffer VimwikiRemoveCBInList call nuwiki#commands#list_remove_checkbox_in_list() command! -buffer -nargs=? VimwikiListChangeLvl call nuwiki#commands#list_change_lvl() @@ -158,7 +158,7 @@ if !has('nvim') command! -buffer Nuwiki2HTMLBrowse call nuwiki#commands#export_browse() command! -buffer -bang NuwikiAll2HTML if 0 | call nuwiki#commands#export_all_force() | else | call nuwiki#commands#export_all() | endif - command! -buffer NuwikiRemoveDone call nuwiki#commands#list_remove_done() + command! -buffer -bang NuwikiRemoveDone if 0 | call nuwiki#commands#list_remove_done_all() | else | call nuwiki#commands#list_remove_done() | endif command! -buffer -range NuwikiRemoveCheckbox call nuwiki#commands#list_remove_checkbox() command! -buffer NuwikiRemoveCheckboxInList call nuwiki#commands#list_remove_checkbox_in_list() command! -buffer -nargs=? NuwikiListChangeLvl call nuwiki#commands#list_change_lvl() @@ -264,8 +264,12 @@ if !has('nvim') nnoremap gLa :call nuwiki#commands#list_change_symbol('a)', 1) nnoremap glA :call nuwiki#commands#list_change_symbol('A)', 0) nnoremap gLA :call nuwiki#commands#list_change_symbol('A)', 1) - nnoremap gl :call nuwiki#commands#list_remove_done() - nnoremap gL :call nuwiki#commands#list_remove_done_all() + " Bare gl/gL: remove the checkbox marker, keep the item text (upstream + " VimwikiRemoveSingleCB / RemoveCBInList). They share the `gl…` prefix + " with the maps above, so they fire after 'timeoutlen' — exactly as + " upstream. Remove-done is command-only (:NuwikiRemoveDone[!]). + nnoremap gl :call nuwiki#commands#list_remove_checkbox() + nnoremap gL :call nuwiki#commands#list_remove_checkbox_in_list() nnoremap o :call nuwiki#commands#open_below_with_bullet() nnoremap O :call nuwiki#commands#open_above_with_bullet() @@ -409,7 +413,7 @@ command! -buffer VimwikiDecrementListItem lua require('nuwiki.commands command! -buffer -nargs=1 VimwikiChangeSymbolTo lua require('nuwiki.commands').list_change_symbol(, false) command! -buffer -nargs=1 VimwikiListChangeSymbolI lua require('nuwiki.commands').list_change_symbol(, false) command! -buffer -nargs=1 VimwikiChangeSymbolInListTo lua require('nuwiki.commands').list_change_symbol(, true) -command! -buffer VimwikiRemoveDone lua require('nuwiki.commands').list_remove_done() +command! -buffer -bang VimwikiRemoveDone lua require('nuwiki.commands')[('' == '!') and 'list_remove_done_all' or 'list_remove_done']() command! -buffer -range VimwikiRemoveSingleCB lua require('nuwiki.commands').list_remove_checkbox() command! -buffer VimwikiRemoveCBInList lua require('nuwiki.commands').list_remove_checkbox_in_list() command! -buffer -nargs=? VimwikiListChangeLvl lua require('nuwiki.commands').list_change_lvl() @@ -494,7 +498,7 @@ command! -buffer NuwikiSplitLink split | lua vim.lsp.buf.definition() command! -buffer NuwikiVSplitLink vsplit | lua vim.lsp.buf.definition() command! -buffer NuwikiTabnewLink tabnew | lua vim.lsp.buf.definition() command! -buffer NuwikiTabDropLink lua require('nuwiki.commands').follow_link_drop() -command! -buffer NuwikiRemoveDone lua require('nuwiki.commands').list_remove_done() +command! -buffer -bang NuwikiRemoveDone lua require('nuwiki.commands')[('' == '!') and 'list_remove_done_all' or 'list_remove_done']() command! -buffer -range NuwikiRemoveCheckbox lua require('nuwiki.commands').list_remove_checkbox() command! -buffer NuwikiRemoveCheckboxInList lua require('nuwiki.commands').list_remove_checkbox_in_list() command! -buffer -nargs=? NuwikiListChangeLvl lua require('nuwiki.commands').list_change_lvl() diff --git a/lua/nuwiki/keymaps.lua b/lua/nuwiki/keymaps.lua index 5591671..90f0905 100644 --- a/lua/nuwiki/keymaps.lua +++ b/lua/nuwiki/keymaps.lua @@ -231,10 +231,14 @@ function M.attach(bufnr, mappings) map('n', 'gL' .. key, function() cmd.list_change_symbol(sym, true) end, { desc = 'nuwiki: set list markers to ' .. sym }, bufnr) end - map('n', 'gl', cmd.list_remove_done, - { desc = 'nuwiki: remove done items (current list)' }, bufnr) - map('n', 'gL', cmd.list_remove_done_all, - { desc = 'nuwiki: remove done items (whole doc)' }, bufnr) + -- Bare gl/gL: remove the checkbox marker, keep the item text (upstream + -- VimwikiRemoveSingleCB / RemoveCBInList). They share the `gl…` prefix + -- with the maps above, so they fire after `timeoutlen` — exactly as + -- upstream. Remove-done is command-only (`:NuwikiRemoveDone[!]`). + map('n', 'gl', cmd.list_remove_checkbox, + { desc = 'nuwiki: remove checkbox (current item)' }, bufnr) + map('n', 'gL', cmd.list_remove_checkbox_in_list, + { desc = 'nuwiki: remove checkboxes (whole list)' }, bufnr) map('n', 'o', open_below_with_bullet, { desc = 'nuwiki: open below + bullet' }, bufnr) map('n', 'O', open_above_with_bullet, { desc = 'nuwiki: open above + bullet' }, bufnr)