]> git.r.bdr.sh - rbdr/dotfiles/blame - vim/doc/NERD_commenter.txt
Add gitignore
[rbdr/dotfiles] / vim / doc / NERD_commenter.txt
CommitLineData
0d23b6e5
BB
1*NERD_commenter.txt* Plugin for commenting code
2
3
4 NERD COMMENTER REFERENCE MANUAL~
5
6
7
8
9
10==============================================================================
11CONTENTS *NERDCommenterContents*
12
13 1.Intro...................................|NERDCommenter|
14 2.Installation............................|NERDComInstallation|
15 3.Functionality provided..................|NERDComFunctionality|
16 3.1 Functionality Summary.............|NERDComFunctionalitySummary|
17 3.2 Functionality Details.............|NERDComFunctionalityDetails|
18 3.2.1 Comment map.................|NERDComComment|
19 3.2.2 Nested comment map..........|NERDComNestedComment|
20 3.2.3 Toggle comment map..........|NERDComToggleComment|
21 3.2.4 Minimal comment map.........|NERDComMinimalComment|
22 3.2.5 Invert comment map..........|NERDComInvertComment|
23 3.2.6 Sexy comment map............|NERDComSexyComment|
24 3.2.7 Yank comment map............|NERDComYankComment|
25 3.2.8 Comment to EOL map..........|NERDComEOLComment|
26 3.2.9 Append com to line map......|NERDComAppendComment|
27 3.2.10 Insert comment map.........|NERDComInsertComment|
28 3.2.11 Use alternate delims map...|NERDComAltDelim|
29 3.2.12 Comment aligned maps.......|NERDComAlignedComment|
30 3.2.13 Uncomment line map.........|NERDComUncommentLine|
31 3.4 Sexy Comments.....................|NERDComSexyComments|
32 3.5 The NERDComment function..........|NERDComNERDComment|
33 4.Options.................................|NERDComOptions|
34 4.1 Options summary...................|NERDComOptionsSummary|
35 4.2 Options details...................|NERDComOptionsDetails|
36 4.3 Default delimiter Options.........|NERDComDefaultDelims|
37 5. Customising key mappings...............|NERDComMappings|
38 6. Issues with the script.................|NERDComIssues|
39 6.1 Delimiter detection heuristics....|NERDComHeuristics|
40 6.2 Nesting issues....................|NERDComNesting|
41 7.About.. ............................|NERDComAbout|
42 8.Changelog...............................|NERDComChangelog|
43 9.Credits.................................|NERDComCredits|
44 10.License................................|NERDComLicense|
45
46==============================================================================
471. Intro *NERDCommenter*
48
49The NERD commenter provides many different commenting operations and styles
50which are invoked via key mappings and a menu. These operations are available
51for most filetypes.
52
53There are also options that allow to tweak the commenting engine to your
54taste.
55
56==============================================================================
572. Installation *NERDComInstallation*
58
59The NERD Commenter requires Vim 7 or higher.
60
61Extract the plugin files in your ~/.vim (*nix) or ~/vimfiles (Windows). You
62should have 2 files: >
63 plugin/NERD_commenter.vim
64 doc/NERD_commenter.txt
65<
66Next, to finish installing the help file run: >
67 :helptags ~/.vim/doc
68<
69See |add-local-help| for more details.
70
71Make sure that you have filetype plugins enabled, as the script makes use of
72|'commentstring'| where possible (which is usually set in a filetype plugin).
73See |filetype-plugin-on| for details, but basically, stick this in your vimrc >
74 filetype plugin on
75<
76
77==============================================================================
783. Functionality provided *NERDComFunctionality*
79
80------------------------------------------------------------------------------
813.1 Functionality summary *NERDComFunctionalitySummary*
82
83The following key mappings are provided by default (there is also a menu
84with items corresponding to all the mappings below):
85
86[count]<leader>cc |NERDComComment|
87Comment out the current line or text selected in visual mode.
88
89
90[count]<leader>cn |NERDComNestedComment|
91Same as <leader>cc but forces nesting.
92
93
94[count]<leader>c<space> |NERDComToggleComment|
95Toggles the comment state of the selected line(s). If the topmost selected
96line is commented, all selected lines are uncommented and vice versa.
97
98
99[count]<leader>cm |NERDComMinimalComment|
100Comments the given lines using only one set of multipart delimiters.
101
102
103[count]<leader>ci |NERDComInvertComment|
104Toggles the comment state of the selected line(s) individually.
105
106
107[count]<leader>cs |NERDComSexyComment|
108Comments out the selected lines ``sexily''
109
110
111[count]<leader>cy |NERDComYankComment|
112Same as <leader>cc except that the commented line(s) are yanked first.
113
114
115<leader>c$ |NERDComEOLComment|
116Comments the current line from the cursor to the end of line.
117
118
119<leader>cA |NERDComAppendComment|
120Adds comment delimiters to the end of line and goes into insert mode between
121them.
122
123
124|NERDComInsertComment|
125Adds comment delimiters at the current cursor position and inserts between.
126Disabled by default.
127
128
129<leader>ca |NERDComAltDelim|
130Switches to the alternative set of delimiters.
131
132
133[count]<leader>cl
134[count]<leader>cb |NERDComAlignedComment|
135Same as |NERDComComment| except that the delimiters are aligned down the
136left side (<leader>cl) or both sides (<leader>cb).
137
138
139[count]<leader>cu |NERDComUncommentLine|
140Uncomments the selected line(s).
141
142------------------------------------------------------------------------------
1433.2 Functionality details *NERDComFunctionalityDetails*
144
145------------------------------------------------------------------------------
1463.2.1 Comment map *NERDComComment*
147
148Default mapping: [count]<leader>cc
149Mapped to: <plug>NERDCommenterComment
150Applicable modes: normal visual visual-line visual-block.
151
152
153Comments out the current line. If multiple lines are selected in visual-line
154mode, they are all commented out. If some text is selected in visual or
155visual-block mode then the script will try to comment out the exact text that
156is selected using multi-part delimiters if they are available.
157
158If a [count] is given in normal mode, the mapping works as though that many
159lines were selected in visual-line mode.
160
161------------------------------------------------------------------------------
1623.2.2 Nested comment map *NERDComNestedComment*
163
164Default mapping: [count]<leader>cn
165Mapped to: <plug>NERDCommenterNest
166Applicable modes: normal visual visual-line visual-block.
167
168Performs nested commenting. Works the same as <leader>cc except that if a line
169is already commented then it will be commented again.
170
171If |'NERDUsePlaceHolders'| is set then the previous comment delimiters will
172be replaced by place-holder delimiters if needed. Otherwise the nested
173comment will only be added if the current commenting delimiters have no right
174delimiter (to avoid syntax errors)
175
176If a [count] is given in normal mode, the mapping works as though that many
177lines were selected in visual-line mode.
178
179Related options:
180|'NERDDefaultNesting'|
181
182------------------------------------------------------------------------------
1833.2.3 Toggle comment map *NERDComToggleComment*
184
185Default mapping: [count]<leader>c<space>
186Mapped to: <plug>NERDCommenterToggle
187Applicable modes: normal visual-line.
188
189Toggles commenting of the lines selected. The behaviour of this mapping
190depends on whether the first line selected is commented or not. If so, all
191selected lines are uncommented and vice versa.
192
193With this mapping, a line is only considered to be commented if it starts with
194a left delimiter.
195
196If a [count] is given in normal mode, the mapping works as though that many
197lines were selected in visual-line mode.
198
199------------------------------------------------------------------------------
2003.2.4 Minimal comment map *NERDComMinimalComment*
201
202Default mapping: [count]<leader>cm
203Mapped to: <plug>NERDCommenterMinimal
204Applicable modes: normal visual-line.
205
206Comments the selected lines using one set of multipart delimiters if possible.
207
208For example: if you are programming in c and you select 5 lines and press
209<leader>cm then a '/*' will be placed at the start of the top line and a '*/'
210will be placed at the end of the last line.
211
212Sets of multipart comment delimiters that are between the top and bottom
213selected lines are replaced with place holders (see |'NERDLPlace'|) if
214|'NERDUsePlaceHolders'| is set for the current filetype. If it is not, then
215the comment will be aborted if place holders are required to prevent illegal
216syntax.
217
218If a [count] is given in normal mode, the mapping works as though that many
219lines were selected in visual-line mode.
220
221------------------------------------------------------------------------------
2223.2.5 Invert comment map *NERDComInvertComment*
223
224Default mapping: <leader>ci
225Mapped to: <plug>NERDCommenterInvert
226Applicable modes: normal visual-line.
227
228Inverts the commented state of each selected line. If the a selected line is
229commented then it is uncommented and vice versa. Each line is examined and
230commented/uncommented individually.
231
232With this mapping, a line is only considered to be commented if it starts with
233a left delimiter.
234
235If a [count] is given in normal mode, the mapping works as though that many
236lines were selected in visual-line mode.
237
238------------------------------------------------------------------------------
2393.2.6 Sexy comment map *NERDComSexyComment*
240
241Default mapping: [count]<leader>cs
242Mapped to: <plug>NERDCommenterSexy
243Applicable modes: normal, visual-line.
244
245Comments the selected line(s) ``sexily''... see |NERDComSexyComments| for
246a description of what sexy comments are. Can only be done on filetypes for
247which there is at least one set of multipart comment delimiters specified.
248
249Sexy comments cannot be nested and lines inside a sexy comment cannot be
250commented again.
251
252If a [count] is given in normal mode, the mapping works as though that many
253lines were selected in visual-line mode.
254
255Related options:
256|'NERDCompactSexyComs'|
257
258------------------------------------------------------------------------------
2593.2.7 Yank comment map *NERDComYankComment*
260
261Default mapping: [count]<leader>cy
262Mapped to: <plug>NERDCommenterYank
263Applicable modes: normal visual visual-line visual-block.
264
265Same as <leader>cc except that it yanks the line(s) that are commented first.
266
267------------------------------------------------------------------------------
2683.2.8 Comment to EOL map *NERDComEOLComment*
269
270Default mapping: <leader>c$
271Mapped to: <plug>NERDCommenterToEOL
272Applicable modes: normal.
273
274Comments the current line from the current cursor position up to the end of
275the line.
276
277------------------------------------------------------------------------------
2783.2.9 Append com to line map *NERDComAppendComment*
279
280Default mapping: <leader>cA
281Mapped to: <plug>NERDCommenterAppend
282Applicable modes: normal.
283
284Appends comment delimiters to the end of the current line and goes
285to insert mode between the new delimiters.
286
287------------------------------------------------------------------------------
2883.2.10 Insert comment map *NERDComInsertComment*
289
290Default mapping: disabled by default.
291Map it to: <plug>NERDCommenterInInsert
292Applicable modes: insert.
293
294Adds comment delimiters at the current cursor position and inserts
295between them.
296
297NOTE: prior to version 2.1.17 this was mapped to ctrl-c. To restore this
298mapping add >
299 let NERDComInsertMap='<c-c>'
300<
301to your vimrc.
302
303------------------------------------------------------------------------------
3043.2.11 Use alternate delims map *NERDComAltDelim*
305
306Default mapping: <leader>ca
307Mapped to: <plug>NERDCommenterAltDelims
308Applicable modes: normal.
309
310Changes to the alternative commenting style if one is available. For example,
311if the user is editing a c++ file using // comments and they hit <leader>ca
312then they will be switched over to /**/ comments.
313
314See also |NERDComDefaultDelims|
315
316------------------------------------------------------------------------------
3173.2.12 Comment aligned maps *NERDComAlignedComment*
318
319Default mappings: [count]<leader>cl [count]<leader>cb
320Mapped to: <plug>NERDCommenterAlignLeft
321 <plug>NERDCommenterAlignBoth
322Applicable modes: normal visual-line.
323
324Same as <leader>cc except that the comment delimiters are aligned on the left
325side or both sides respectively. These comments are always nested if the
326line(s) are already commented.
327
328If a [count] is given in normal mode, the mapping works as though that many
329lines were selected in visual-line mode.
330
331------------------------------------------------------------------------------
3323.2.13 Uncomment line map *NERDComUncommentLine*
333
334Default mapping: [count]<leader>cu
335Mapped to: <plug>NERDCommenterUncomment
336Applicable modes: normal visual visual-line visual-block.
337
338Uncomments the current line. If multiple lines are selected in
339visual mode then they are all uncommented.
340
341When uncommenting, if the line contains multiple sets of delimiters then the
342``outtermost'' pair of delimiters will be removed.
343
344The script uses a set of heurisics to distinguish ``real'' delimiters from
345``fake'' ones when uncommenting. See |NERDComIssues| for details.
346
347If a [count] is given in normal mode, the mapping works as though that many
348lines were selected in visual-line mode.
349
350Related options:
351|'NERDRemoveAltComs'|
352|'NERDRemoveExtraSpaces'|
353
354------------------------------------------------------------------------------
3553.3 Sexy Comments *NERDComSexyComments*
356These are comments that use one set of multipart comment delimiters as well as
357one other marker symbol. For example: >
358 /*
359 * This is a c style sexy comment
360 * So there!
361 */
362
363 /* This is a c style sexy comment
364 * So there!
365 * But this one is ``compact'' style */
366<
367Here the multipart delimiters are /* and */ and the marker is *.
368
369------------------------------------------------------------------------------
3703.4 The NERDComment function *NERDComNERDComment*
371
372All of the NERD commenter mappings and menu items invoke a single function
373which delegates the commenting work to other functions. This function is
374public and has the prototype: >
375 function! NERDComment(isVisual, type)
376<
377The arguments to this function are simple:
378 - isVisual: if you wish to do any kind of visual comment then set this to
379 1 and the function will use the '< and '> marks to find the comment
380 boundries. If set to 0 then the function will operate on the current
381 line.
382 - type: is used to specify what type of commenting operation is to be
383 performed, and it can be one of the following: "sexy", "invert",
384 "minimal", "toggle", "alignLeft", "alignBoth", "norm", "nested",
385 "toEOL", "append", "insert", "uncomment", "yank"
386
387For example, if you typed >
388 :call NERDComment(1, 'sexy')
389<
390then the script would do a sexy comment on the last visual selection.
391
392
393==============================================================================
3944. Options *NERDComOptions*
395
396------------------------------------------------------------------------------
3974.1 Options summary *NERDComOptionsSummary*
398
399|'loaded_nerd_comments'| Turns off the script.
400|'NERDAllowAnyVisualDelims'| Allows multipart alternative delims to
401 be used when commenting in
402 visual/visual-block mode.
403|'NERDBlockComIgnoreEmpty'| Forces right delims to be placed when
404 doing visual-block comments.
405|'NERDCommentWholeLinesInVMode'| Changes behaviour of visual comments.
406|'NERDCreateDefaultMappings'| Turn the default mappings on/off.
407|'NERDDefaultNesting'| Tells the script to use nested comments
408 by default.
409|'NERDMenuMode'| Specifies how the NERD commenter menu
410 will appear (if at all).
411|'NERDLPlace'| Specifies what to use as the left
412 delimiter placeholder when nesting
413 comments.
414|'NERDUsePlaceHolders'| Specifies which filetypes may use
415 placeholders when nesting comments.
416|'NERDRemoveAltComs'| Tells the script whether to remove
417 alternative comment delimiters when
418 uncommenting.
419|'NERDRemoveExtraSpaces'| Tells the script to always remove the
420 extra spaces when uncommenting
421 (regardless of whether NERDSpaceDelims
422 is set)
423|'NERDRPlace'| Specifies what to use as the right
424 delimiter placeholder when nesting
425 comments.
426|'NERDSpaceDelims'| Specifies whether to add extra spaces
427 around delimiters when commenting, and
428 whether to remove them when
429 uncommenting.
430|'NERDCompactSexyComs'| Specifies whether to use the compact
431 style sexy comments.
432
433------------------------------------------------------------------------------
4344.3 Options details *NERDComOptionsDetails*
435
436To enable any of the below options you should put the given line in your
437~/.vimrc
438
439 *'loaded_nerd_comments'*
440If this script is driving you insane you can turn it off by setting this
441option >
442 let loaded_nerd_comments=1
443<
444------------------------------------------------------------------------------
445 *'NERDAllowAnyVisualDelims'*
446Values: 0 or 1.
447Default: 1.
448
449If set to 1 then, when doing a visual or visual-block comment (but not a
450visual-line comment), the script will choose the right delimiters to use for
451the comment. This means either using the current delimiters if they are
452multipart or using the alternative delimiters if THEY are multipart. For
453example if we are editing the following java code: >
454 float foo = 1221;
455 float bar = 324;
456 System.out.println(foo * bar);
457<
458If we are using // comments and select the "foo" and "bar" in visual-block
459mode, as shown left below (where '|'s are used to represent the visual-block
460boundary), and comment it then the script will use the alternative delims as
461shown on the right: >
462
463 float |foo| = 1221; float /*foo*/ = 1221;
464 float |bar| = 324; float /*bar*/ = 324;
465 System.out.println(foo * bar); System.out.println(foo * bar);
466<
467------------------------------------------------------------------------------
468 *'NERDBlockComIgnoreEmpty'*
469Values: 0 or 1.
470Default: 1.
471
472This option affects visual-block mode commenting. If this option is turned
473on, lines that begin outside the right boundary of the selection block will be
474ignored.
475
476For example, if you are commenting this chunk of c code in visual-block mode
477(where the '|'s are used to represent the visual-block boundary) >
478 #include <sys/types.h>
479 #include <unistd.h>
480 #include <stdio.h>
481 |int| main(){
482 | | printf("SUCK THIS\n");
483 | | while(1){
484 | | fork();
485 | | }
486 |} |
487<
488If NERDBlockComIgnoreEmpty=0 then this code will become: >
489 #include <sys/types.h>
490 #include <unistd.h>
491 #include <stdio.h>
492 /*int*/ main(){
493 /* */ printf("SUCK THIS\n");
494 /* */ while(1){
495 /* */ fork();
496 /* */ }
497 /*} */
498<
499Otherwise, the code block would become: >
500 #include <sys/types.h>
501 #include <unistd.h>
502 #include <stdio.h>
503 /*int*/ main(){
504 printf("SUCK THIS\n");
505 while(1){
506 fork();
507 }
508 /*} */
509<
510------------------------------------------------------------------------------
511 *'NERDCommentWholeLinesInVMode'*
512Values: 0, 1 or 2.
513Default: 0.
514
515By default the script tries to comment out exactly what is selected in visual
516mode (v). For example if you select and comment the following c code (using |
517to represent the visual boundary): >
518 in|t foo = 3;
519 int bar =| 9;
520 int baz = foo + bar;
521<
522This will result in: >
523 in/*t foo = 3;*/
524 /*int bar =*/ 9;
525 int baz = foo + bar;
526<
527But some people prefer it if the whole lines are commented like: >
528 /*int foo = 3;*/
529 /*int bar = 9;*/
530 int baz = foo + bar;
531<
532If you prefer the second option then stick this line in your vimrc: >
533 let NERDCommentWholeLinesInVMode=1
534<
535
536If the filetype you are editing only has no multipart delimiters (for example
537a shell script) and you hadnt set this option then the above would become >
538 in#t foo = 3;
539 #int bar = 9;
540<
541(where # is the comment delimiter) as this is the closest the script can
542come to commenting out exactly what was selected. If you prefer for whole
543lines to be commented out when there is no multipart delimiters but the EXACT
544text that was selected to be commented out if there IS multipart delimiters
545then stick the following line in your vimrc: >
546 let NERDCommentWholeLinesInVMode=2
547<
548
549Note that this option does not affect the behaviour of commenting in
550|visual-block| mode.
551
552------------------------------------------------------------------------------
553 *'NERDCreateDefaultMappings'*
554Values: 0 or 1.
555Default: 1.
556
557If set to 0, none of the default mappings will be created.
558
559See also |NERDComMappings|.
560
561------------------------------------------------------------------------------
562 *'NERDRemoveAltComs'*
563Values: 0 or 1.
564Default: 1.
565
566When uncommenting a line (for a filetype with an alternative commenting style)
567this option tells the script whether to look for, and remove, comment
568delimiters of the alternative style.
569
570For example, if you are editing a c++ file using // style comments and you go
571<leader>cu on this line: >
572 /* This is a c++ comment baby! */
573<
574It will not be uncommented if the NERDRemoveAltComs is set to 0.
575
576------------------------------------------------------------------------------
577 *'NERDRemoveExtraSpaces'*
578Values: 0 or 1.
579Default: 1.
580
581By default, the NERD commenter will remove spaces around comment delimiters if
582either:
5831. |'NERDSpaceDelims'| is set to 1.
5842. NERDRemoveExtraSpaces is set to 1.
585
586This means that if we have the following lines in a c code file: >
587 /* int foo = 5; */
588 /* int bar = 10; */
589 int baz = foo + bar
590<
591If either of the above conditions hold then if these lines are uncommented
592they will become: >
593 int foo = 5;
594 int bar = 10;
595 int baz = foo + bar
596<
597Otherwise they would become: >
598 int foo = 5;
599 int bar = 10;
600 int baz = foo + bar
601<
602If you want the spaces to be removed only if |'NERDSpaceDelims'| is set then
603set NERDRemoveExtraSpaces to 0.
604
605------------------------------------------------------------------------------
606 *'NERDLPlace'*
607 *'NERDRPlace'*
608Values: arbitrary string.
609Default:
610 NERDLPlace: "[>"
611 NERDRPlace: "<]"
612
613These options are used to control the strings used as place-holder delimiters.
614Place holder delimiters are used when performing nested commenting when the
615filetype supports commenting styles with both left and right delimiters.
616To set these options use lines like: >
617 let NERDLPlace="FOO"
618 let NERDRPlace="BAR"
619<
620Following the above example, if we have line of c code: >
621 /* int horse */
622<
623and we comment it with <leader>cn it will be changed to: >
624 /*FOO int horse BAR*/
625<
626When we uncomment this line it will go back to what it was.
627
628------------------------------------------------------------------------------
629 *'NERDMenuMode'*
630Values: 0, 1, 2, 3.
631Default: 3
632
633This option can take 4 values:
634 "0": Turns the menu off.
635 "1": Turns the 'comment' menu on with no menu shortcut.
636 "2": Turns the 'comment 'menu on with <alt>-c as the shortcut.
637 "3": Turns the 'Plugin -> comment' menu on with <alt>-c as the shortcut.
638
639------------------------------------------------------------------------------
640 *'NERDUsePlaceHolders'*
641Values: 0 or 1.
642Default 1.
643
644This option is used to specify whether place-holder delimiters should be used
645when creating a nested comment.
646
647------------------------------------------------------------------------------
648 *'NERDSpaceDelims'*
649Values: 0 or 1.
650Default 0.
651
652Some people prefer a space after the left delimiter and before the right
653delimiter like this: >
654 /* int foo=2; */
655<
656as opposed to this: >
657 /*int foo=2;*/
658<
659If you want spaces to be added then set NERDSpaceDelims to 1 in your vimrc.
660
661See also |'NERDRemoveExtraSpaces'|.
662
663------------------------------------------------------------------------------
664 *'NERDCompactSexyComs'*
665Values: 0 or 1.
666Default 0.
667
668Some people may want their sexy comments to be like this: >
669 /* Hi There!
670 * This is a sexy comment
671 * in c */
672<
673As opposed to like this: >
674 /*
675 * Hi There!
676 * This is a sexy comment
677 * in c
678 */
679<
680If this option is set to 1 then the top style will be used.
681
682------------------------------------------------------------------------------
683 *'NERDDefaultNesting'*
684Values: 0 or 1.
685Default 1.
686
687When this option is set to 1, comments are nested automatically. That is, if
688you hit <leader>cc on a line that is already commented it will be commented
689again.
690
691------------------------------------------------------------------------------
6923.3 Default delimiter customisation *NERDComDefaultDelims*
693
694If you want the NERD commenter to use the alternative delimiters for a
695specific filetype by default then put a line of this form into your vimrc: >
696 let NERD_<filetype>_alt_style=1
697<
698Example: java uses // style comments by default, but you want it to default to
699/* */ style comments instead. You would put this line in your vimrc: >
700 let NERD_java_alt_style=1
701<
702
703See |NERDComAltDelim| for switching commenting styles at runtime.
704
705==============================================================================
7065. Key mapping customisation *NERDComMappings*
707
708To change a mapping just map another key combo to the internal <plug> mapping.
709For example, to remap the |NERDComComment| mapping to ",omg" you would put
710this line in your vimrc: >
711 map ,omg <plug>NERDCommenterComment
712<
713This will stop the corresponding default mappings from being created.
714
715See the help for the mapping in question to see which <plug> mapping to
716map to.
717
718See also |'NERDCreateDefaultMappings'|.
719
720==============================================================================
7216. Issues with the script *NERDComIssues*
722
723
724------------------------------------------------------------------------------
7256.1 Delimiter detection heuristics *NERDComHeuristics*
726
727Heuristics are used to distinguish the real comment delimiters
728
729Because we have comment mappings that place delimiters in the middle of lines,
730removing comment delimiters is a bit tricky. This is because if comment
731delimiters appear in a line doesnt mean they really ARE delimiters. For
732example, Java uses // comments but the line >
733 System.out.println("//");
734<
735clearly contains no real comment delimiters.
736
737To distinguish between ``real'' comment delimiters and ``fake'' ones we use a
738set of heuristics. For example, one such heuristic states that any comment
739delimiter that has an odd number of non-escaped " characters both preceding
740and following it on the line is not a comment because it is probably part of a
741string. These heuristics, while usually pretty accurate, will not work for all
742cases.
743
744------------------------------------------------------------------------------
7456.2 Nesting issues *NERDComNesting*
746
747If we have some line of code like this: >
748 /*int foo */ = /*5 + 9;*/
749<
750This will not be uncommented legally. The NERD commenter will remove the
751"outter most" delimiters so the line will become: >
752 int foo */ = /*5 + 9;
753<
754which almost certainly will not be what you want. Nested sets of comments will
755uncomment fine though. Eg: >
756 /*int/* foo =*/ 5 + 9;*/
757<
758will become: >
759 int/* foo =*/ 5 + 9;
760<
761(Note that in the above examples I have deliberately not used place holders
762for simplicity)
763
764==============================================================================
7657. About *NERDComAbout*
766
767The author of the NERD commenter is Martyzillatron --- the half robot, half
768dinosaur bastard son of Megatron and Godzilla. He enjoys destroying
769metropolises and eating tourist busses.
770
771Drop him a line at martin_grenfell at msn.com. He would love to hear from you.
772its a lonely life being the worlds premier terror machine. How would you feel
773if your face looked like a toaster and a t-rex put together? :(
774
775The latest stable versions can be found at
776 http://www.vim.org/scripts/script.php?script_id=1218
777
778The latest dev versions are on github
779 http://github.com/scrooloose/nerdcommenter
780
781==============================================================================
7828. Changelog *NERDComChangelog*
783
7842.3.0
785 - remove all filetypes which have a &commentstring in the standard vim
786 runtime for vim > 7.0 unless the script stores an alternate set of
787 delimiters
788 - make the script complain if the user doesnt have filetype plugins enabled
789 - use <leader> instead of comma to start the default mappings
790 - fix a couple of bugs with sexy comments - thanks to Tim Smart
791 - lots of refactoring
792
7932.2.2
794 - remove the NERDShutup option and the message is suppresses, this makes
795 the plugin silently rely on &commentstring for unknown filetypes.
796 - add support for dhcpd, limits, ntp, resolv, rgb, sysctl, udevconf and
797 udevrules. Thanks to Thilo Six.
798 - match filetypes case insensitively
799 - add support for mp (metapost), thanks to Andrey Skvortsov.
800 - add support for htmlcheetah, thanks to Simon Hengel.
801 - add support for javacc, thanks to Matt Tolton.
802 - make <%# %> the default delims for eruby, thanks to tpope.
803 - add support for javascript.jquery, thanks to Ivan Devat.
804 - add support for cucumber and pdf. Fix sass and railslog delims,
805 thanks to tpope
806
8072.2.1
808 - add support for newlisp and clojure, thanks to Matthew Lee Hinman.
809 - fix automake comments, thanks to Elias Pipping
810 - make haml comments default to -# with / as the alternative delimiter,
811 thanks to tpope
812 - add support for actionscript and processing thanks to Edwin Benavides
813 - add support for ps1 (powershell), thanks to Jason Mills
814 - add support for hostsaccess, thanks to Thomas Rowe
815 - add support for CVScommit
816 - add support for asciidoc, git and gitrebase. Thanks to Simon Ruderich.
817 - use # for gitcommit comments, thanks to Simon Ruderich.
818 - add support for mako and genshi, thanks to Keitheis.
819 - add support for conkyrc, thanks to David
820 - add support for SVNannotate, thanks to Miguel Jaque Barbero.
821 - add support for sieve, thanks to Stefan Walk
822 - add support for objj, thanks to Adam Thorsen.
823
8242.2.0
825 - rewrote the mappings system to be more "standard".
826 - removed all the mapping options. Now, mappings to <plug> mappings are
827 used
828 - see :help NERDComMappings, and :help NERDCreateDefaultMappings for
829 more info
830 - remove "prepend comments" and "right aligned comments".
831 - add support for applescript, calbire, man, SVNcommit, potwiki, txt2tags and SVNinfo.
832 Thanks to nicothakis, timberke, sgronblo, mntnoe, Bernhard Grotz, John
833 O'Shea, François and Giacomo Mariani respectively.
834 - bugfix for haskell delimiters. Thanks to mntnoe.
8352.1.18
836 - add support for llvm. Thanks to nicothakis.
837 - add support for xquery. Thanks to Phillip Kovalev.
8382.1.17
839 - fixed haskell delimiters (hackily). Thanks to Elias Pipping.
840 - add support for mailcap. Thanks to Pascal Brueckner.
841 - add support for stata. Thanks to Jerónimo Carballo.
842 - applied a patch from ewfalor to fix an error in the help file with the
843 NERDMapleader doc
844 - disable the insert mode ctrl-c mapping by default, see :help
845 NERDComInsertComment if you wish to restore it
846
847==============================================================================
8489. Credits *NERDComCredits*
849
850Thanks to the follow people for suggestions and patches:
851
852Nick Brettell
853Matthew Hawkins
854Mathieu Clabaut
855Greg Searle
856Nguyen
857Litchi
858Jorge Scandaliaris
859Shufeng Zheng
860Martin Stubenschrott
861Markus Erlmann
862Brent Rice
863Richard Willis
864Igor Prischepoff
865Harry
866David Bourgeois
867Eike Von Seggern
868Torsten Blix
869Alexander Bosecke
870Stefano Zacchiroli
871Norick Chen
872Joseph Barker
873Gary Church
874Tim Carey-Smith
875Markus Klinik
876Anders
877Seth Mason
878James Hales
879Heptite
880Cheng Fang
881Yongwei Wu
882David Miani
883Jeremy Hinegardner
884Marco
885Ingo Karkat
886Zhang Shuhan
887tpope
888Ben Schmidt
889David Fishburn
890Erik Falor
891JaGoTerr
892Elias Pipping
893mntnoe
894Mark S.
895
896
897Thanks to the following people for sending me new filetypes to support:
898
899The hackers The filetypes~
900Sam R verilog
901Jonathan Derque context, plaintext and mail
902Vigil fetchmail
903Michael Brunner kconfig
904Antono Vasiljev netdict
905Melissa Reid omlet
906Ilia N Ternovich quickfix
907John O'Shea RTF, SVNcommitlog and vcscommit, SVNCommit
908Anders occam
909Mark Woodward csv
910fREW gentoo-package-mask,
911 gentoo-package-keywords,
912 gentoo-package-use, and vo_base
913Alexey verilog_systemverilog, systemverilog
914Lizendir fstab
915Michael Böhler autoit, autohotkey and docbk
916Aaron Small cmake
917Ramiro htmldjango and django
918Stefano Zacchiroli debcontrol, debchangelog, mkd
919Alex Tarkovsky ebuild and eclass
920Jorge Rodrigues gams
921Rainer Müller Objective C
922Jason Mills Groovy, ps1
923Normandie Azucena vera
924Florian Apolloner ldif
925David Fishburn lookupfile
926Niels Aan de Brugh rst
927Don Hatlestad ahk
928Christophe Benz Desktop and xsd
929Eyolf Østrem lilypond, bbx and lytex
930Ingo Karkat dosbatch
931Nicolas Weber markdown, objcpp
932tinoucas gentoo-conf-d
933Greg Weber D, haml
934Bruce Sherrod velocity
935timberke cobol, calibre
936Aaron Schaefer factor
937Mr X asterisk, mplayerconf
938Kuchma Michael plsql
939Brett Warneke spectre
940Pipp lhaskell
941Renald Buter scala
942Vladimir Lomov asymptote
943Marco mrxvtrc, aap
944nicothakis SVNAnnotate, CVSAnnotate, SVKAnnotate,
945 SVNdiff, gitAnnotate, gitdiff, dtrace
946 llvm, applescript
947Chen Xing Wikipedia
948Jacobo Diaz dakota, patran
949Li Jin gentoo-env-d, gentoo-init-d,
950 gentoo-make-conf, grub, modconf, sudoers
951SpookeyPeanut rib
952Greg Jandl pyrex/cython
953Christophe Benz services, gitcommit
954A Pontus vimperator
955Stromnov slice, bzr
956Martin Kustermann pamconf
957Indriði Einarsson mason
958Chris map
959Krzysztof A. Adamski group
960Pascal Brueckner mailcap
961Jerónimo Carballo stata
962Phillip Kovalev xquery
963Bernhard Grotz potwiki
964sgronblo man
965François txt2tags
966Giacomo Mariani SVNinfo
967Matthew Lee Hinman newlisp, clojure
968Elias Pipping automake
969Edwin Benavides actionscript, processing
970Thomas Rowe hostsaccess
971Simon Ruderich asciidoc, git, gitcommit, gitrebase
972Keitheis mako, genshi
973David conkyrc
974Miguel Jaque Barbero SVNannotate
975Stefan Walk sieve
976Adam Thorsen objj
977Thilo Six dhcpd, limits, ntp, resolv, rgb, sysctl,
978 udevconf, udevrules
979Andrey Skvortsov mp
980Simon Hengel htmlcheetah
981Matt Tolton javacc
982Ivan Devat javascript.jquery
983tpope cucumber,pdf
984==============================================================================
98510. License *NERDComLicense*
986
987The NERD commenter is released under the wtfpl.
988See http://sam.zoy.org/wtfpl/COPYING.