Comments are programmer-readable annotations in source code which are ignored by the parser.
Questions tagged [comments]
113 questions
13
votes
2 answers
How to toggle comments with ctrl+/?
I'm coming from Atom, and with that I can highlight multiple lines and hit ctrl/ and it'll toggle comments for those lines. I how easy this is.
Can I do something similar using ctrl/ with vim? I don't want to be doing ctrlv, highlight rows, //,…
ditto
- 275
- 1
- 2
- 6
6
votes
0 answers
Comments pane for current buffer that you can jump to such as TODO:, WARN:, and NOTE:?
A while ago I used to use eclipse as my IDE, and I remember you could add TODO: some task, NOTE: some comment, WARN: some warning to your code, and it would appear in a particular pane for the current buffer, so you could click and jump to that…
leeand00
- 3,555
- 5
- 24
- 40
4
votes
1 answer
Automatic comment leader not inserted on some file types
My formatoptions include cro.
I have a filetype (Stata .do files) in which the comment character is *. Anything after this character is considered a comment line.
In insert mode ** leads to
*
*
However ** leads to
**
My…
evencoil
- 245
- 1
- 8
4
votes
2 answers
Vim tcomment plugin changes the hyphens in untagged text (html) to html code (& #45;)
When editing html in Vim, I'll write the class name of the section that I am working on like this:
mid-med
It is untagged plain text.
I'll call tcomment to comment that out. What I expect to have happen is this:
Instead I get…
Derek Dakan
- 43
- 2
3
votes
1 answer
Commenting out an element of a multiline list
Is it possible to comment out one element of a multiline list? Or, in general, can you combine line continuations with comments?
(Lightly modified from my vimrc)
[
\'eslint',
\'tsserver',
\'xo'
\]
0az
- 133
- 4
3
votes
1 answer
How to comment a line in vim?
#inlcude
int main()
{
printf("Hello world\n");
}
I want to comment line where the cursor is. For, example if I am on the line printf then I want to get following -
#inlcude
int main()
{
/* printf("Hello world\n"); */
}…
alhelal
- 659
- 4
- 10
- 17
2
votes
1 answer
Toggling comments on and off
I have the following within my .vimrc:
" toggle comments
noremap :exe "normal! I".g:commentType
autocmd BufReadPost *.php let g:commentType='//' "Perl files
autocmd…
ditto
- 275
- 1
- 2
- 6
2
votes
2 answers
How can I configure a three-piece comment?
When editing an Haskell file, I want to configure a comment format {- -} such that:
{-
-
- -}
But it doesn't work as expected (but almost there):
{-
-
- -}
notice that after hitting enter, the - doesn't align.
What option…
Jason Hu
- 1,385
- 1
- 9
- 17
2
votes
1 answer
A question about the comment for comment shell command
When I read the comment help file, I found
It is not possible to add a comment to a shell command ":!cmd" or to the
":map" command and a few others (mainly commands that expect expressions)
that see the '"' as part of their argument: ...
What is…
lizhe
- 137
- 6
2
votes
1 answer
Commentary with a Single Block
With Commentary I've set the commentstring for markdown:
autocmd FileType markdown setlocal commentstring=
When I visually select the lines and gc
a
b
c
I get
where I'd prefer a single block like