Open dvogel opened 3 years ago
I tracked down the issue to these two pull requests:
which stem from the initially contentious issue, #40
Of course, the issue is a result of this line: https://github.com/tpope/vim-commentary/blob/349340debb34f6302931f0eb7139b2c11dfdf427/plugin/commentary.vim#L19
Although, I must say it's weird that it does not happen in visual-block, and I have not fully investigated that aspect.
Maybe:
b:commentary_strip_empty
option (like b:commentary_startofline
) or ..If you want me to try my hand at a pull req, I can. If you can spot an easy solution, then please do fix.
If I have an "empty" comment line inside a visual block,
gc
eats the space preceding%s
in mycommentstring
(orb:commentary_format
). I've captured this in a gist but, I will illustrate the before and after here.Visually selecting this entire block and commenting (with
commentstring=#\ %s
):Yields the properly indented block:
However, if I introduce an empty comment line like so:
Then visually selecting the entire block and commenting it yields:
This is true regardless of whether that "empty" comment line has a trailing space.