kylechui / nvim-surround

Add/change/delete surrounding delimiter pairs with ease. Written with :heart: in Lua.
MIT License
2.98k stars 60 forks source link

Fix (line mode): Use line mode parameter when possible #194

Closed phgz closed 1 year ago

phgz commented 1 year ago

In normal callback, the call to normal_surround would always send false for line_mode.

kylechui commented 1 year ago

Is there an actual bug that this is related to? The reason that this is the case (which is something that should honestly be refactored) is because the line_mode variable is handled on lines 256--260. Changing that variable in the callback effectively does nothing.

phgz commented 1 year ago

Is there an actual bug that this is related to?

When surrounding with a keybinding using "_line", the indentation is not made. In fact, we're back to #184 (#185 for screenshot).

kylechui commented 1 year ago

Do you mind trying the alternate branch refactor-utils and see if that resolves the issue?

kylechui commented 1 year ago

Actually in either case it should be fine; I've merged this branch in for now, and the corresponding change has been made to the other branch. Thanks again for submitting this fix!

phgz commented 1 year ago

Do you mind trying the alternate branch refactor-utils and see if that resolves the issue?

It seems to indeed solve it! Other keymaps do not seem to be disturbed as well as far as I've tested.