Skip to content

surround using lazy opts not working #445

Description

@Dragit

Explain the issue

It seems that the surround option is broken in lazy.nvim

  1. neovim (NVIM v0.12.3 Build type: RelWithDebInfo LuaJIT 2.1.1780076327) with treesitter

  2. Reproduction:
    minimal init.lua, call with nvim --clean -u minit.lua
    minit.lua:

     vim.env.LAZY_STDPATH = ".repro"
     load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()
     
     require("lazy.minit").repro({
     	spec = {
     		{
     			"nvim-treesitter/nvim-treesitter",
     			build = ":TSUpdate",
     
     			ensure_installed = { "html", "latex", "markdown", "markdown_inline", "typst", "yaml" },
     		},
     		{
     			"andymass/vim-matchup",
     			lazy = false,
     			---@type matchup.Config
     			opts = {
     				treesitter = {
     					stopline = 500,
     				},
     				surround = {
     					enabled = 1,
     				},
     			},
     		},
     	},
     })
  3. matchup should load the <Plug>(matchup-cs%) and <Plug>(matchup-ds%) bindings

  4. they are not loaded, however. :echo get(g:, 'matchup_surround_enabled', 0) yields 1
    when I try :map <Plug>(matchup-cs%) and :map <Plug>(matchup-ds%) yields no mappings found

Fix

use

    vim.env.LAZY_STDPATH = ".repro"
    load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()
    
    require("lazy.minit").repro({
    	spec = {
    		{
    			"nvim-treesitter/nvim-treesitter",
    			build = ":TSUpdate",
    
    			ensure_installed = { "html", "latex", "markdown", "markdown_inline", "typst", "yaml" },
    		},
    		{
    			"andymass/vim-matchup",
    			lazy = false,
          init = function()
            vim.g.matchup_surround_enabled = 1
          end,
          ---@type matchup.Config
          opts = {
            treesitter = {
              stopline = 500,
            },
            surround = {
              enabled = 1,
            },
          },
    			},
    		},
    	},
    })

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions