echasnovski / mini.nvim

Library of 40+ independent Lua modules improving overall Neovim (version 0.8 and higher) experience with minimal effort
MIT License
4.84k stars 183 forks source link

[surround] brackets replacing to change indents #594

Closed kaiphat closed 9 months ago

kaiphat commented 9 months ago

Contributing guidelines

Module(s)

surround

Neovim version

0.9.4

Steps to reproduce

I want to replace {} brackets to []

image

When i do replacing i get

image

As you can see bottom brackets and userId changed their positions.

Expected behavior

Brackets shouldn't move when i do replacing

echasnovski commented 9 months ago

I presume replacement is done with sr{]. In this case it is an expected behavior, because opening brackets include outer whitespace padding into them. Try using sr}] to not include whitespace.

Here are more examples of this behavior.

kaiphat commented 9 months ago

Thank you!