nvim-surround
nvim-surround copied to clipboard
Use the appropriate replacement function for aliases
I have an alias for two surrounds, both of which have replacement functions defined in the change
table. When I invoke a change of surrounds (cs<alias>
) with the alias, however, neither replacement function is applied, and the behavior falls back to waiting for a single surround character. I think the desired behavior should be to apply the replacement that belongs to the actual surrounds triggered by the alias in the context.
Can you provide an example of what is exactly the problem? Like your setup function + buffer + keymap combo?
Sample config:
require("nvim-surround").setup({
surrounds = {
[")"] = {
change = {
replacement = { "(", ")" },
},
},
["}"] = {
change = {
replacement = { "{", "}" },
},
},
},
aliases = {
["o"] = { ")", "}" },
},
})
Buffer:
{(test)}
The keymap cso
shouldn't wait for another keypress, but should directly trigger the replacement
key.
Note to self: When computing nearest selection, return which character from the alias table was actually used to find the selections.
Closing this as it seems to incur high cost for little utility, and is related to #98.