diff --git a/.config/nvim/lua/nvim.lua b/.config/nvim/lua/nvim.lua index 11bc96503..c34813666 100644 --- a/.config/nvim/lua/nvim.lua +++ b/.config/nvim/lua/nvim.lua @@ -516,6 +516,17 @@ function M.delete_mostly_inner_surround() return end + -- TODO: Workaround. For some reason 'B' ('**foo**') cannot be deleted by vim-operator-surround + -- See also: .vim/autoload/vimrc.vim - same workaround in Vimscript + if obj_key == 'B' then + -- Delete content between * (which leaves ** on each side) + vim.cmd('normal! d' .. vim.api.nvim_replace_termcodes('(textobj-between-i)*', true, false, true)) + -- Replace the remaining **** with the deleted content + vim.cmd([[s/\*\*\*\*/{@"}/]]) + print('**deleted**') + return + end + M.run_with_virtual_keymaps('va' .. obj_key .. '(operator-surround-delete)') vim.call('repeat#set', 'va' .. obj_key .. '\\(operator-surround-delete)') end @@ -535,6 +546,7 @@ function M.replace_mostly_inner_surround() return end + -- Use the original pattern that works for most delimiters M.run_with_virtual_keymaps('va' .. obj_key_from .. '(operator-surround-replace)' .. obj_key_to) vim.call('repeat#set', 'va' .. obj_key_from .. '\\(operator-surround-replace)' .. obj_key_to) end