Skip to content

Commenting visual block with an embedded empty comment line. #144

@dvogel

Description

@dvogel

If I have an "empty" comment line inside a visual block, gc eats the space preceding %s in my commentstring (or b: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):

resource aws_subnet a-subnet {
  # this line is awesome:
  cidr_block = "10.0.0.0/24"
}

Yields the properly indented block:

# resource aws_subnet a-subnet {
#   # this line is awesome:
#   cidr_block = "10.0.0.0/24"
# }

However, if I introduce an empty comment line like so:

resource aws_subnet a-subnet {
  # this is the first line of a comment
  # 
  # this line is awesome:
  cidr_block = "10.0.0.0/24"
}

Then visually selecting the entire block and commenting it yields:

#resource aws_subnet a-subnet {
#  # this is the first line of a comment
#  # 
#  # this line is awesome:
#  cidr_block = "10.0.0.0/24"
#}

This is true regardless of whether that "empty" comment line has a trailing space.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions