| 1 |
# Comment Plugin |
| 2 |
|
| 3 |
The comment plugin provides auto commenting/uncommenting. |
| 4 |
The default binding to comment/uncomment a line is `Alt-/` |
| 5 |
and `CtrlUnderscore`, which is equivalent in most terminals |
| 6 |
to `Ctrl-/`. You can easily modify that in your `bindings.json` |
| 7 |
file: |
| 8 |
|
| 9 |
```json |
| 10 |
{ |
| 11 |
"Alt-g": "lua:comment.comment" |
| 12 |
} |
| 13 |
``` |
| 14 |
|
| 15 |
You can also execute a command which will do the same thing as |
| 16 |
the binding: |
| 17 |
|
| 18 |
``` |
| 19 |
> comment |
| 20 |
``` |
| 21 |
|
| 22 |
If you have a selection, the plugin will comment all the lines |
| 23 |
selected. |
| 24 |
|
| 25 |
The comment type will be auto detected based on the filetype, |
| 26 |
but it is only available for certain filetypes: |
| 27 |
|
| 28 |
* apacheconf: `# %s` |
| 29 |
* bat: `:: %s` |
| 30 |
* c: `// %s` |
| 31 |
* c++: `// %s` |
| 32 |
* cmake: `# %s` |
| 33 |
* conf: `# %s` |
| 34 |
* crystal: `# %s` |
| 35 |
* css: `/* %s */` |
| 36 |
* d: `// %s` |
| 37 |
* dart: `// %s` |
| 38 |
* dockerfile: `# %s` |
| 39 |
* elm: `-- %s` |
| 40 |
* fish: `# %s` |
| 41 |
* gdscript: `# %s` |
| 42 |
* glsl: `// %s` |
| 43 |
* go: `// %s` |
| 44 |
* haskell: `-- %s` |
| 45 |
* html: `<!-- %s -->` |
| 46 |
* ini: `; %s` |
| 47 |
* java: `// %s` |
| 48 |
* javascript: `// %s` |
| 49 |
* jinja2: `{# %s #}` |
| 50 |
* json: `// %s` |
| 51 |
* julia: `# %s` |
| 52 |
* kotlin: `// %s` |
| 53 |
* lua: `-- %s` |
| 54 |
* markdown: `<!-- %s -->` |
| 55 |
* nginx: `# %s` |
| 56 |
* nim: `# %s` |
| 57 |
* objc: `// %s` |
| 58 |
* pascal: `{ %s }` |
| 59 |
* perl: `# %s` |
| 60 |
* php: `// %s` |
| 61 |
* pony: `// %s` |
| 62 |
* powershell: `# %s` |
| 63 |
* proto: `// %s` |
| 64 |
* python: `# %s` |
| 65 |
* python3: `# %s` |
| 66 |
* ruby: `# %s` |
| 67 |
* rust: `// %s` |
| 68 |
* scala: `// %s` |
| 69 |
* shell: `# %s` |
| 70 |
* sql: `-- %s` |
| 71 |
* swift: `// %s` |
| 72 |
* tex: `% %s` |
| 73 |
* toml: `# %s` |
| 74 |
* twig: `{# %s #}` |
| 75 |
* v: `// %s` |
| 76 |
* xml: `<!-- %s -->` |
| 77 |
* yaml: `# %s` |
| 78 |
* zig: `// %s` |
| 79 |
* zscript: `// %s` |
| 80 |
* zsh: `# %s` |
| 81 |
|
| 82 |
If your filetype is not available here, you can simply modify |
| 83 |
the `comment.type` option: |
| 84 |
|
| 85 |
``` |
| 86 |
set comment.type "/* %s */" |
| 87 |
``` |
| 88 |
|
| 89 |
Or in your `settings.json`: |
| 90 |
|
| 91 |
```json |
| 92 |
{ |
| 93 |
"*.c": { |
| 94 |
"comment.type": "/* %s */" |
| 95 |
} |
| 96 |
} |
| 97 |
``` |
| 98 |
|
| 99 |
`commenttype` (without the dot) is the legacy option that is |
| 100 |
superseded by `comment.type`. `commenttype` is still supported |
| 101 |
but deprecated. |
| 102 |
**Use `comment.type` instead.** |