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

Feature parity with vim-surround's `s` #255

Closed Kyuuhachi closed 11 months ago

Kyuuhachi commented 11 months ago

Checklist

Is your feature request related to a problem? Please describe. tpope/vim-surround has a s delimiter, which changes require("telescope") to require "telescope". Would be nice to have that.

Describe the solution you'd like Pretty easy to add, though not battle-tested.

surrounds = {
    ["s"] = {
        add = { " ", "" },
    },
}

Kinda conflicts with the existing s=any delimiter alias, but since you can only change from that alias, and can only change to this one, it works out pretty well.

kylechui commented 11 months ago

I'm not particularly convinced this needs to be a built-in for nvim-surround, since it's really just a one-off edge case that IMO is quite rare; I would rather people just nnoremap [something] dsbi <Esc>.

Kyuuhachi commented 11 months ago

Yeah, that's fine too. As mentioned, it's not difficult to add to my local config anyway. It's just that I happened to see that you claimed feature parity in /discussions/55, so.

kylechui commented 11 months ago

Yeah fair enough; in the beginning that was more of a goal but I think this plugin has now gotten to most of the use-cases, and I don't really want to add more functionality at the cost of complexity. If you want to keep the current s behavior as well, you can map s to a table with find, add, and delete keys, which will allow you to specify different behavior depending on if you are adding using the alias vs. change/delete using the alias.

Kyuuhachi commented 11 months ago

Actually it seems I don't need to do anything to keep the upstream behavior — csss happily replaces whatever delimiter is available with a space.

kylechui commented 11 months ago

Oh yeah, I suppose I did code aliases to take precedence 😄