-
-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multi-character string delimiters #146
Comments
To my knowledge (if I'm understanding correctly) this should already be possible in the plugin. It's certainly not the most elegant, but here's a code sample for Lua strings: require("nvim-surround").setup({
surrounds = {
["s"] = {
add = function()
local count = require("nvim-surround.config").get_input("Enter a count: ")
return { { "[" .. ("="):rep(count) .. "[" }, { "]" .. ("="):rep(count) .. "]" } }
end,
find = "%[(=*)%[.-%]%1%]",
delete = "^(%[=*%[)().-(%]=*%])()$",
},
},
aliases = {
["s"] = false,
},
}) The other ones that you mentioned should also be possible, through a mix of using |
I guess this could also be implemented using counts like #147. For example:
(The first count could come either before or after Workarounds for -- add this to init.lua because it's not built-in
vim.keymap.set({'o', 'x'}, 'a/', ':<C-U>normal F/vf/<CR>', {silent = true})
|
Going to close this issue in favor of #147, which seems to be a good implementation strategy for this idea. |
Checklist
:h nvim-surround
to see if there might be any relevant information there?Is your feature request related to a problem? Please describe.
Several languages support strings that use multiple characters as delimiters.
"""string"""
"""string"""
"""string"""
or'''string'''
"""string"""
or'''string'''
or$/string/$
[[string]]
or[=[string]=]
(any number of=
)##string##
(any number of#
)``string``
(any number of`
)Describe the solution you'd like
It'd be nice if we could change single-character delimited strings to multi-character and vice versa.
Additional context
Some languages also support prefixes but that would probably be too complicated.
@"string"
or$"string"
(any supported delimiter, can be mixed, any number of$
)b"string"
orr"string"
orf"string"
(any supported delimiter, can be mixed)b"string"
orr"string"
(any supported delimiter, can be mixed)$'string'
(any supported delimiter)String.raw`string`
(prefix can be any function)The text was updated successfully, but these errors were encountered: