-
I am trying to create my own custom surrounds but I can't get this one to work. @kylechui Any idea why the following doesn't do anything when I run require("nvim-surround").buffer_setup {
surrounds = {
["*"] = {
find = function()
return require("nvim-surround.config").get_selection { textobject = "*" }
end,
delete = "^(%*%*?)().-(%*%*?)()$",
},
},
} Also, is the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
Here you're going to want to use In general, the process is:
General rule of thumb: If you can't do Also I assume you mean |
Beta Was this translation helpful? Give feedback.
Here you're going to want to use
find = "%*%*?.-%*%*?"
. This is because the text-objecta*
does not exist (unless it is defined by another plugin, e.g.targets.vim
). The idea is that thetextobject
key should only really be used for built-in text-objects or for characters for which there exists a defined text-object, e.g.T
key usest
for finding the parent selection. I'll look into improving the docs; thefind
key can be omitted but it defaults toinvalid_key_behavior
'sfind
key, which just looks for a surrounding pair of the character you inputted.In general, the process is:
find
key finds a "parent" selection that includes the surrounding pairnvim-surround
will fall…