kylechui / nvim-surround

Add/change/delete surrounding delimiter pairs with ease. Written with :heart: in Lua.
MIT License
2.98k stars 60 forks source link

Error on custom surrounds. #191

Closed D00mch closed 1 year ago

D00mch commented 1 year ago

Checklist

Neovim Version

NVIM v0.8.1
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by brew@Ventura-arm64.local

Features: +acl +iconv +tui

Plugin Version

Tagged (Stable)

Minimal Configuration

setup({
  surrounds = {
   ["("] = {add = {{"("}, {")"}}},
    c = {add = {{"#_"}, {""}}},
  }
})

Sample Buffer

(ns dumch.play)

(defn a [])

Keystroke Sequence

ysaw(, ysa(c

Expected behavior

Command: ysa(c Cursor: |.

Before:

(|defn a [])

After:

`#_|(defn a [])

Actual behavior

Error executing lua... buffer.lua:203: Expected lua table

image

Additional context

This began to happen after the last three commits. This one works: f0077c3726d243eeaabd2ec280216e8c3ca7da9f

While submitting this issue, I discovered that if I rewrite my config, everything works, but I decided to create an issue anyway so that others could find it.

setup({
  surrounds = {
   ["("] = {add = {"(", ")"}},
    c = {add = {"#_", ""}},
  }
})
kylechui commented 1 year ago

Should be fixed in the latest commit; feel free to re-open if the issue persists. Thanks for reporting the bug!