Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 18609

Comments are programmer-readable annotations in source code which are ignored by the parser.

1 vote

How to comment out only code lines and not existing comments

mappings, you have <Leader>cc to comment a block of code (not toggle) and also <Leader>cn to comment the code, but forces nesting (which makes it easier to uncomment the block and keep the pre-existing comments
filbranden's user avatar
  • 29.9k
1 vote
Accepted

Change default character for comments

Even though it looks like Vim itself doesn't make much use of this option, it's also used by plug-ins that manage comments, for example vim-commentary leverages the option for its own configuration. …
filbranden's user avatar
  • 29.9k
4 votes
Accepted

Are there comments in command-line mode?

Vimscript does have comments and they're started by the " character. They always work at the beginning of the line: " echo usage echo "hello" They sometimes work inline, but not always. … This can be used to add comments. [...] …
filbranden's user avatar
  • 29.9k
2 votes

How to disable auto insertion of comment header when pressing enter, but keep auto insertion...

The idea of removing :// from 'comments' can be made to work, but instead of leaving Insert mode with <Esc>, use <C-\><C-O> to run a single Normal command (in this case, the : command to run the Ex :set … This mapping works: inoremap <silent> <CR> <C-\><C-o>:set comments-=://<CR><CR><C-\><C-o>:set comments+=://<CR> Additionally, you might want to keep this mapping only for file type cpp and maybe also …
filbranden's user avatar
  • 29.9k
1 vote

Configure custom key mapping for plugin actions

Like many other plug-ins, NERDCommenter creates internal mappings using the <plug> virtual key as a prefix, that you can use to map your own key-bindings to. See :help NERDCommenterMappings: To c …
filbranden's user avatar
  • 29.9k
3 votes
Accepted

bad comment behavior in cmake files

(You could argue that the ftplugin for cmake should do the same, since both languages use # to mark comments.) …
filbranden's user avatar
  • 29.9k