echasnovski / mini.nvim

Library of 40+ independent Lua modules improving overall Neovim (version 0.8 and higher) experience with minimal effort
MIT License
4.54k stars 175 forks source link

mini.pairs not working #856

Closed LeoLee53 closed 2 months ago

LeoLee53 commented 2 months ago

Contributing guidelines

Module(s)

mini.pairs

Description

when trying to insert any paired symbols, an error message would pop up and a 0 will inserted instead.

Neovim version

v0.9.5

Steps to reproduce

  1. setup mini.pairs in config
  2. restart nvim
  3. try to input any paired symbols, like "(".

Expected behavior

No response

Actual behavior

an error message will show up, and a 0 will be inserted instead.

image
echasnovski commented 2 months ago

There is a not proper Lua pattern set up for ( character in the config. I can not help more without seeing how 'mini.pairs' is set up.

LeoLee53 commented 2 months ago

I used the default setup using require(“mini.pairs”).setup()

echasnovski commented 2 months ago

I used the default setup using require(“mini.pairs”).setup()

It doesn't look like it, because with basic require('mini.pairs').setup() everything works on all supported Neovim versions.

Would you mind executing the following command which will put some lines at the start of current buffer, copy those lines and paste here?

:lua vim.fn.append(0, vim.split(vim.inspect(MiniPairs.config), '\n'))
LeoLee53 commented 2 months ago

sure, here's the config I got through the command:

{
  mappings = {
    ['"'] = {
      action = "closeopen",
      neigh_pattern = "[^\\].",
      pair = '""',
      register = {
        cr = false
      }
    },
    ["'"] = {
      action = "closeopen",
      neigh_pattern = "[^%a\\].",
      pair = "''",
      register = {
        cr = false
      }
    },
    ["("] = {
      action = "open",
      neigh_pattern = "[^\\].",
      pair = "()"
    },
    [")"] = {
      action = "close",
      neigh_pattern = "[^\\].",
      pair = "()"
    },
    ["["] = {
      action = "open",
      neigh_pattern = "[^\\].",
      pair = "[]"
    },
    ["]"] = {
      action = "close",
      neigh_pattern = "[^\\].",
      pair = "[]"
    },
    ["`"] = {
      action = "closeopen",
      neigh_pattern = "[^\\].",
      pair = "``",
      register = {
        cr = false
      }
    },
    ["{"] = {
      action = "open",
      neigh_pattern = "[^\\].",
      pair = "{}"
    },
    ["}"] = {
      action = "close",
      neigh_pattern = "[^\\].",
      pair = "{}"
    }
  },
  modes = {
    command = false,
    insert = true,
    terminal = false
  }
}

also, this is the setup i have in my config

image
echasnovski commented 2 months ago

sure, here's the config I got through the command:

Hmm, this look about right.

Would you mind trying to reproduce this with clean config in which only 'mini.pairs' installed and active? For this:

Also it would be helpful to share a bit more info:

LeoLee53 commented 2 months ago

Thanks for the step-by-step guide. I'll give it a go and keep you updated when I got time. For now I'll just use nvim-autopairs as a replacement.