Skip to content
Discussion options

You must be logged in to vote

... how would I do that?

Unfortunately, there is no easy way to do this, as usually mixing charwise and linewise operations (as this makes charwise selection appear on separate lines with new indent) is up to no good.

The best feasible solution is to follow @krovuxdev's suggestion and dedicate a special identifier for such cases. However, using only {\n and \n} is not enough as it will not keep indent, which is the real problem here. So this would require something like this:

require('mini.surround').setup({
  custom_surroundings = {
    ['{'] = {
      output = function()
        local indent = vim.api.nvim_get_current_line():match('^%s*')
        local sw = vim.bo.shiftwidth
        l…

Replies: 1 comment 8 replies

Comment options

You must be logged in to vote
8 replies
@echasnovski
Comment options

@oiiiiiiii
Comment options

@krovuxdev
Comment options

@echasnovski
Comment options

Answer selected by echasnovski
@oiiiiiiii
Comment options

@echasnovski
Comment options

@oiiiiiiii
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested mini.surround wiki Solution is present (or should be present) in wiki
3 participants