nvim-autopairs icon indicating copy to clipboard operation
nvim-autopairs copied to clipboard

with_del(cond.done()) doesn't always delete pairwise

Open TroySigX opened this issue 1 year ago • 0 comments

Description

For the rule similar to the sample config:

      npairs.add_rules({
        Rule("b%d%d%d%d%w$", "", "vim")
          :use_regex(true,"<tab>")
          :replace_endpair(function(opts)
                return
                    opts.prev_char
          end)
          :with_pair(cond.done())
          :with_del(cond.done()),
     })

After pressing b1234s<tab>, the end pair will be added, which is b1234sb1234s Now, if I move the cursor to the opening pair b1234s|b1234s, where | is the current cursor, and press <BS>, it just removes the opening part, leaving the text after deletion to |b1234s

Mapping bug

1.If you report a bug about indent. Please remember that plugin doesn't do anything about indent. It just trigger the indent of your vim config so if you have wrong indent config then it will do wrong indent. You can check by select a block of code and press == 2. provide result of command :verbose imap <cr>.

Steps to reproduce

No response

Minimal config

vim.cmd [[set runtimepath=$VIMRUNTIME]]
vim.cmd [[set packpath=/tmp/nvim/site]]
local package_root = '/tmp/nvim/site/pack'
local install_path = package_root .. '/packer/start/packer.nvim'
local function load_plugins()
  require('packer').startup {
    {
      'wbthomason/packer.nvim',
      {
        'windwp/nvim-autopairs',
      },
      -- ADD PLUGINS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
    },
    config = {
      package_root = package_root,
      compile_path = install_path .. '/plugin/packer_compiled.lua',
      display = { non_interactive = true },
    },
  }
end
_G.load_config = function()
  require('nvim-autopairs').setup()
end
if vim.fn.isdirectory(install_path) == 0 then
  print("Installing nvim-autopairs and dependencies.")
  vim.fn.system { 'git', 'clone', '--depth=1', 'https://github.com/wbthomason/packer.nvim', install_path }
end
load_plugins()
require('packer').sync()
vim.cmd [[autocmd User PackerComplete ++once echo "Ready!" | lua load_config()]]

TroySigX avatar Jun 28 '23 15:06 TroySigX