kylechui / nvim-surround

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

Visual mode select won't surround #292

Closed esn89 closed 4 months ago

esn89 commented 6 months ago

Checklist

Neovim Version

NVIM v0.9.4
Build type: Release
LuaJIT 2.1.1700008891

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/opt/local/share/nvim"

Run :checkhealth for more info

Plugin Version

Tagged (Stable)

Minimal Configuration

    {
        'kylechui/nvim-surround',
        version = '*',
        event = 'VeryLazy',
        config = function()
            require('nvim-surround').setup({})
        end,
    },

Sample Buffer

I have a similar issue in Visual mode as well, with this block of text:

image

Keystroke Sequence

I select it by:

vEE then

S), but it doesn't surround.

Expected behavior

I expect to see:

(cipher.Stream, error)

Actual behavior

No surround.

Additional context

No response

9mm commented 6 months ago

This works fine for me btw

func decryptStream(key string, iv []byte) (cipher.Stream, error) {

}

if my cursor is on the c in cipher and I push vEES) it surrounds

9mm commented 6 months ago

heres my config

-- https://github.com/kylechui/nvim-surround/blob/main/lua/nvim-surround/config.lua

return {
  "kylechui/nvim-surround",
  version = "*",
  event = "InsertEnter",
  config = function()
    require("nvim-surround").setup()
  end,
}

I notice some plugins have problems with passing an empty {} instead of () into setup. I have no idea if thats it but maybe?

kylechui commented 6 months ago

I notice some plugins have problems with passing an empty {} instead of () into setup. I have no idea if thats it but maybe?

Shouldn't be an issue; was patched a long long time ago.

Is your base problem that it works after you already add the parentheses (and it adds a second pair), but doesn't in your original image? I'm unable to reproduce your error on my system.

esn89 commented 6 months ago

Hmm, has there been known issues in the past where it doesn't play well with other plugins?

kylechui commented 6 months ago

Typically plugins like targets.vim or mini.ai, but what usually happens is that it causes unintended/unexpected behavior, not no behavior at all.

esn89 commented 6 months ago

@kylechui Hm, I am using none of those.

Could it be a keybinding thing?

kylechui commented 6 months ago

Ah good question, try verbose xmap S and see what pops up; you might have a completely different plugin/keymap overriding it.

esn89 commented 6 months ago

Aaaaah. I think I see it....

I have this:

https://imgur.com/a/ZhKhnNn

kylechui commented 6 months ago

Yeah try remapping either plugin's bindings to avoid conflicts, and that should fix things. Perhaps plugin authors should check for keymaps before setting them (mine included) :thinking:

kylechui commented 4 months ago

Feel free to re-open if you are still having issues.