8000 fast wrap for `*`/`_` not working (same with multiple chars - `**`/`__`) · Issue #413 · windwp/nvim-autopairs · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
fast wrap for */_ not working (same with multiple chars - **/__) #413
Open
@litoj

Description

@litoj

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()]]

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpinned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0