Skip to content

Why does mini.surround behave like this? #661

Closed Answered by echasnovski
limaceous-bushwhacker asked this question in Q&A
Discussion options

You must be logged in to vote

Because quotes in 'mini.surround' are not balanced by default. I don't quite remember the actual reason why this is the default, but it was deliberate (there is explicit test for that). My current reasoning is that all three quotes are not balanced pairs (they use same open and close characters) and I can see them closely to any other default surrounding (which is not balanced). Not very strong reason, I admit, but it is what it is now (as breaking change is bad).

Besides, you can modify them to be balanced like this:

require('mini.surround').setup({
  custom_surroundings = {
    ['"'] = { input = { '%b""', '^.().*().$' } },
  },
  search_method = 'cover_or_next',
})

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@limaceous-bushwhacker
Comment options

Answer selected by echasnovski
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants