normal·mode
~ / neovim / comment-lineslesson 3/7

Comment lines: gcc and gc{motion}

Toggle comments with the built-in gc operator.

4 drills

  1. One line with gcc: Toggle the comment on the cursor line with gcc: comment it out, or bring it back if it's already a comment.
  2. Several lines with gc{motion}: Comment out the lines shown in the target with one gc command: the operator plus a motion or text object.
  3. Blocks that already have comments: Comment out the whole block in one go. Existing comments get a second //, and empty lines inside the range get a bare //.
  4. Toggle again with .: Toggle the two places shown in the target. Do the first with gc, move, and repeat it with ..

The drill editor loads in your browser.

outside the editor the page is in normal mode: ? keymaps · / find · : commandsfound this useful? ☕ support it ·credits · source · not affiliated with Vim or Neovim