kylechui / nvim-surround

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

`cs` pattern is not working on `main` branch #217

Closed sxyazi closed 1 year ago

sxyazi commented 1 year ago

Checklist

Neovim Version

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

Features: +acl +iconv +tui

Plugin Version

Nightly (Beta)

Minimal Configuration

The lazy.nvim is my used on:

{
  "kylechui/nvim-surround",
  event = "BufRead",
  config = function()
    require("nvim-surround").setup({})
  end
}

Sample Buffer

"abc"

Keystroke Sequence

cs"'

Expected behavior

'abc'

Actual behavior

nothing happened

Additional context

Guessing that is caused by https://github.com/kylechui/nvim-surround/commit/af10059b0f1589a485d9e1b0298172bbf60cdb47, since I checked out the previous commit 1d83fecd27c6b4b66cc529930552d205fbecb660 and all worked fine.

kylechui commented 1 year ago

Those commits are from a while ago; can you update to the most recent commit on main and see if the issue persists?

sxyazi commented 1 year ago

Yes, It still has the issue that using the latest commit on the main.

kylechui commented 1 year ago

What's the output of :verbose nmap cs say? Are any of the other keymaps set or are all of them "disabled"? I think this might have to do with your BufRead event, but I don't know too much about how lazy loading works

sxyazi commented 1 year ago

I found the problem after rechecking my keymaps and disabling them one by one!

The culprit was this line:

vim.keymap.set("", "l", "u", { noremap = true })

Previously I did check the keymaps associated with the plugin via :map cs that found no conflict, and by switching to 1d83fec or tagged v1.0.0 all was well.

Just a bit curious, is that some internal mechanism has used the l key? 🤔

kylechui commented 1 year ago

Ah shoot, see #197 for more info. Going to close this issue to focus discussion in one thread.