kylechui / nvim-surround

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

A weird behavior on changing surrounding. #172

Closed Fau818 closed 1 year ago

Fau818 commented 1 year ago

Checklist

Neovim Version

NVIM v0.8.0

Plugin Version

Nightly (Beta)

Minimal Configuration

The following is my configuration.

local status_ok, surround = pcall(require, "nvim-surround")
if not status_ok then return end

local config = {
    keymaps = {
        insert = false,
        insert_line = false,
        normal = "s",
        normal_cur = "ss",
        normal_line = "SSSSSSSSSSSSSSS",  -- false,
        normal_cur_line = "S",
        visual = "s",
        visual_line = "S",
        delete = "ds",
        change = "cs",
    },
}

surround.setup(config)

Sample Buffer

"hello "world""

Keystroke Sequence

The cursor should in the world word. Then, change the surrounding " to '.

Expected behavior

"hello "world"" -> "hello 'world'"

Actual behavior

'hello 'world""

Additional context

As shown in the video, the plugin has highlighted the correct pair of quotes, but it changed another pair.

https://user-images.githubusercontent.com/75115028/202343999-b2caf8e8-c215-4f35-af6f-b44c8f2a104b.mov

kylechui commented 1 year ago

The latest commit should fix this issue, thanks for reporting and feel free to re-open if necessary!