windwp / nvim-autopairs

autopairs for neovim written in lua
MIT License
3k stars 111 forks source link

fast wrap for `*`/`_` not working (same with multiple chars - `**`/`__`) #413

Open JosefLitos opened 8 months ago

JosefLitos commented 8 months ago

Description

fast wrap won't trigger upon pressing keybind when trying to use it for * or **/__ (markdown)

Mapping bug

No response

Steps to reproduce

Try to do a fast wrap of ** or even just *

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()
    local nap = require 'nvim-autopairs'
    nap.setup {
        ts_config = {
            lua = { 'string' }, -- it will not add pair on that treesitter node
            javascript = { 'template_string' },
        },
        disable_filetype = { 'rnvimr', 'NvimTree' },
        fast_wrap = {
            map = '<M-w>',
            chars = { '{', '[', '(', '"', "'", '`', '**', '_' },
            pattern = '[\'")>%]},: ]',
            end_key = '$',
            before_key = 'q',
            after_key = 'e',
            keys = "qwertasdfgzxcvb12345[poiu';lkjh/.,mny-0987",
            check_comma = true,
            highlight = 'IncSearch',
            highlight_grey = '',
            use_virt_lines = false,
        },
        ignored_next_char = '[^.,;>)%]}]',
    }
    local Rule = require 'nvim-autopairs.rule'
    local cond = require 'nvim-autopairs.conds'
    nap.add_rules {
        Rule('**', '**', 'markdown'):with_pair(cond.not_after_regex '[^.,;>)%]}]'),
        Rule('_', '_', 'markdown'):with_pair(cond.not_after_regex '[^.,;>)%]}]'),
    }
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()]]
stale[bot] commented 6 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

JosefLitos commented 6 months ago

I would like to at least understand why singular _ does wrap, but * doesn't.

stale[bot] commented 4 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

JosefLitos commented 3 months ago

This bot should've been automatically marked as useless because it has not had any useful impact on the issue, let alone the comment and email spam forced by this "feature".

stale[bot] commented 1 month ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

JosefLitos commented 1 month ago

This bot is the literal definition of a spam generator