Comment out a block

Three debugging lines are cluttering a function that otherwise works. They will be useful again the next time this breaks, so they should be commented out rather than deleted — and later, when they are wanted again, uncommented in one go.

Helix knows the comment token for the file’s language, and one command toggles a line comment on every line the selection touches (lesson 8). That makes the job a selection question: get the three lines under one selection, or under one cursor each, and toggle once.

Undo the whole toggle (lesson 7), or run the same command on the commented lines to bring them back — it removes the token it added.

The goal: make the buffer match the target under the editor.

One route, if you want it

Move to the first print line and press x three times to select all three lines. Ctrl-c puts a # at the start of each, lined up with the block’s indentation. Pressing Ctrl-c again on the same selection takes them back out.

Make the file match the target under the editor.

Any route counts — the buffer alone is judged.

Loading editor…

Target

def fetch(url):
    response = get(url)
    # print("status", response.status)
    # print("headers", response.headers)
    # print("body", response.text[:200])
    return response.json()