Commenting Out Code
Prev | Chapter 6. Editing Source Code | Next

## Commenting Out Code

Most programming and markup languages support the notion of “comments”, or regions of code which are ignored by the compiler/interpreter. jEdit has commands which make inserting comments more convenient.

Comment strings are mode-specific, and some in some modes such as HTML different parts of a buffer can have different comment strings. For example, in HTML files, different comment strings are used for HTML text and inline JavaScript.

Edit>Source Code>Range Comment (shortcut: `C+e C+c`) encloses the selection with comment start and end strings, for example `/*` and `*/` in Java mode.

Edit>Source Code>Line Comment (shortcut: `C+e C+k`) inserts the line comment string, for example `//` in Java mode, at the start of each selected line.

### Toggling Comments

You might be looking for the actions Toggle Line Comment or Toggle Range Comment. They are available from the TextTools plugin, not jEdit core.

Prev | Up | Next
Tabbing and Indentation | Home | Bracket Matching