surround: disabling surround type and granular control #982
-
Hi, I would like to
Is such fine-grained control possible? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
Found the answer for the first point. Not sure if it is recommended, but this will work: custom_surroundings = {
f = { input = {}, output = {} },
} |
Beta Was this translation helpful? Give feedback.
-
Disabling built-in surrounding identifiers doesn't make much sense, as there is typically nothing to fall back to. It makes sense in 'mini.ai', because there are many built-in
Surrounding specification has exactly this kind of separation into local ts_input = require('mini.surround').gen_spec.input.treesitter
require('mini.surround').setup({
custom_surroundings = {
C = {
input = ts_input({ outer = '@call.outer', inner = '@call.inner' }),
output = function()
local fun_name = MiniSurround.user_input('Function name')
if fun_name == nil then return nil end
return { left = fun_name .. '(', right = ')' }
end,
},
},
}) |
Beta Was this translation helpful? Give feedback.
Disabling built-in surrounding identifiers doesn't make much sense, as there is typically nothing to fall back to. It makes sense in 'mini.ai', because there are many built-in
a
/i
textobjects (likei)
,a"
, etc.), not even mentioning coming from other plugins. So the best suggestion for "disabling" is indeed overriding it with something else. Empty tables as specifications is not the case that is explicitly supported, though. So maybe coming up with something else is …