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

Default Aliases Are Difficult or Impossible to Fully Unset #212

Closed mardamkada closed 1 year ago

mardamkada commented 1 year ago

Checklist

Neovim Version

0.8.3

Plugin Version

Tagged (Stable)

Minimal Configuration

local test_surround = {
    add = { "[bold]" , "[/bold]" },
    find = "%[bold].-%[/bold]",
    delete = "(%[bold])().-(%[/bold])()",
}
require("nvim-surround").setup({
    surrounds = {
        ["b"] = test_surround,
        ["i"] = test_surround,
    },
    aliases = {
        ["b"] = {},
    },
}

Sample Buffer

[bold]hello[/bold] world

Keystroke Sequence

dsbdsi

Expected behavior

the surrounding [bold][/bold] text should be deleted with the dsb sequence.

Actual behavior

surrounding [bold][/bold] text remains after dsb but gets deleted with the dsi sequence.

Additional context

Setting the aliases table to empty (i.e. aliases = {}) doesn't seem to work at all, whereas setting specific aliases to empty (e.g. aliases = {["b"] = {}}) seems to delete the alias but not allow for overwriting the 'ds' and 'cs' keys.

kylechui commented 1 year ago

Have you tried setting the alias keys to false instead of an empty table?

mardamkada commented 1 year ago

I hadn't. That does work. I guess I read the help too hastily and missed that, please excuse the unneeded issue.

kylechui commented 1 year ago

No worries, glad to help :)