Skip to content

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

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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