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