70 Commits

Author SHA1 Message Date
Martin Grenfell
ee14557c87 switch to 2.2.1 2008-11-13 23:25:03 +13:00
Martin Grenfell
8098fea8d9 add support for objj 2008-11-13 23:23:48 +13:00
Martin Grenfell
7e3f47ed8d add support for sieve 2008-11-13 23:16:21 +13:00
Martin Grenfell
06683e3311 add support for SVNannotate 2008-11-13 22:57:08 +13:00
Martin Grenfell
dda8510e0c add support for conkyrc 2008-11-13 22:54:59 +13:00
Martin Grenfell
a0003bc926 add support for clojure 2008-11-13 22:40:00 +13:00
Martin Grenfell
ca94c70dba add support for genshi and mako 2008-11-13 22:37:02 +13:00
Martin Grenfell
44b4c26b86 add support for asciidoc, git, gitrebase and fix gitcommit 2008-11-13 22:31:37 +13:00
Martin Grenfell
5d8bb28113 add support for CVScommit 2008-11-06 20:45:46 +13:00
Martin Grenfell
f65d86fea3 add support for hostsaccess 2008-10-29 20:31:13 +13:00
Martin Grenfell
1d92203107 add support for ps1 2008-10-25 11:49:36 +13:00
Martin Grenfell
fe73c80dc8 update credits 2008-10-25 11:37:04 +13:00
Martin Grenfell
cc9f986514 add support for processing 2008-10-25 11:36:01 +13:00
Martin Grenfell
03d9562db8 add support for actionscript 2008-10-25 11:35:34 +13:00
Martin Grenfell
1301323179 make haml comments own more 2008-10-25 11:32:40 +13:00
Martin Grenfell
842055ae43 fix a bug in the doc 2008-10-12 22:14:01 +13:00
Martin Grenfell
68bf65fcd2 fix automake comments 2008-10-12 22:14:01 +13:00
Martin Grenfell
aaf2471da7 add support for newlisp 2008-10-12 22:14:01 +13:00
Martin Grenfell
e14bdb0735 fix to the credits 2008-10-07 09:08:39 +13:00
Martin Grenfell
8dda3f17e0 always use :normal! instead of :normal 2008-10-04 12:13:10 +13:00
Martin Grenfell
ddd235757b switch to version 2.2.0 2008-10-04 00:07:40 +13:00
Martin Grenfell
d6ca231ac9 update changelog 2008-10-04 00:07:31 +13:00
Martin Grenfell
fe71371c15 make the mappings start with comma (again) 2008-10-03 23:58:41 +13:00
Martin Grenfell
226063bfc1 add support for SVNinfo 2008-10-03 23:23:08 +13:00
Martin Grenfell
d6282ef7a3 add support for txt2tags 2008-10-03 23:19:31 +13:00
Martin Grenfell
c2a3f093ae remove prepend comments 2008-09-23 21:41:15 +12:00
Martin Grenfell
b8c5a4443c remove useless "align right" comments 2008-09-23 21:39:06 +12:00
Martin Grenfell
6bf14ce062 update the changelog 2008-09-23 21:29:33 +12:00
Martin Grenfell
e6a36fb8aa update the changelog 2008-09-21 20:07:56 +12:00
Martin Grenfell
5bf567d75e update the mapping section of the doc 2008-09-21 12:55:08 +12:00
Martin Grenfell
1ae6bd4870 various updates/corrections to the doc 2008-09-21 11:46:40 +12:00
Martin Grenfell
6835cfe090 wrap the help tags for options in quotes 2008-09-21 11:43:33 +12:00
Martin Grenfell
b54d3bbc92 rewrite the key mappings part of the script
internal <plug> mappings are now used for all the commenting operations.
Key mappings are no longer specified with options. Instead the user must
create their own mappings to the internal <plug> mappings.
2008-09-21 11:08:49 +12:00
Martin Grenfell
27e8727a35 add support for applescript 2008-09-09 22:51:57 +12:00
Martin Grenfell
e164c00246 add support for calibre 2008-09-09 22:49:30 +12:00
Martin Grenfell
134acc595e add support for man 2008-09-09 22:44:07 +12:00
Martin Grenfell
d3718d9d21 bugfix for haskell delimiters 2008-09-09 22:37:43 +12:00
Martin Grenfell
53558869a9 remove a redundant if statement 2008-09-01 00:16:58 +12:00
Martin Grenfell
0370366572 add support for SVNcommit 2008-08-02 14:51:45 +12:00
Martin Grenfell
a4453c01ee add support for potwiki 2008-07-28 22:52:34 +12:00
Martin Grenfell
377a04eeec add support for xquery 2008-07-27 22:11:34 +12:00
Martin Grenfell
709d01d074 add support for llvm 2008-07-27 22:09:45 +12:00
Martin Grenfell
2e9b7ca58e dont map the insert comment map if the key isnt set 2008-07-20 00:59:51 +12:00
Martin Grenfell
01d6c8c7f6 change version to 2.1.17 2008-07-19 21:03:39 +12:00
Martin Grenfell
89c008b644 disable the ctrl-c mapping by default 2008-07-19 21:02:52 +12:00
Martin Grenfell
1b9033c7ee apply a doc fix path for NERDMapLeader option 2008-07-13 12:12:36 +12:00
Martin Grenfell
165d1e3686 add support for stata 2008-07-13 12:09:22 +12:00
Martin Grenfell
4567fae10f add support for mailcap 2008-07-13 12:09:03 +12:00
Martin Grenfell
2ea675da5e made a hack fix to haskell comments 2008-07-01 23:18:08 +12:00
Martin Grenfell
865d928a1f update changelog and credits 2008-06-27 12:46:56 +12:00
Martin Grenfell
8a0056a610 switch to version 2.1.16 2008-06-27 12:35:32 +12:00
Martin Grenfell
e466dd9418 fix compatibiltiy bug with vim 7.2 2008-06-27 12:35:02 +12:00
Martin Grenfell
a84365f174 switch version to 2.1.15 2008-06-22 12:09:48 +12:00
Martin Grenfell
1fc1decbe9 update changelog 2008-06-22 12:09:19 +12:00
Martin Grenfell
dc8275ffa0 update the header comments 2008-06-22 12:08:11 +12:00
Martin Grenfell
64f0798984 use wtfpl license, remove todo list from the help 2008-06-22 12:03:32 +12:00
Martin Grenfell
01f8df684c add support for group 2008-06-20 21:46:17 +12:00
Martin Grenfell
7c830eb223 remove all trailing whitespace 2008-06-15 21:36:23 +12:00
Martin Grenfell
af0d51d8b3 add support for bzr 2008-06-15 21:34:08 +12:00
Martin Grenfell
650396b1fc update the changelog 2008-05-24 18:55:53 +12:00
Martin Grenfell
cf54bfc7c4 add support for map 2008-05-24 18:55:08 +12:00
Martin Grenfell
6b2cc6c41d add support for mason 2008-05-24 16:35:03 +12:00
Martin Grenfell
e52840527a remove an out of date comment 2008-05-19 15:44:53 +12:00
Martin Grenfell
dee2021b8f fix some indenting in the changelog 2008-05-19 15:43:42 +12:00
Martin Grenfell
2da9787ff1 add support for pamconf 2008-05-19 15:42:19 +12:00
Martin Grenfell
fef5db7e92 change version to 2.1.14 2008-05-17 16:12:27 +12:00
Martin Grenfell
875831209a add support for dtrace 2008-05-17 15:44:36 +12:00
Martin Grenfell
191bb50879 add support for nerdtree 2008-05-17 14:54:44 +12:00
Martin Grenfell
e92b6f60d5 add support for tar 2008-05-15 09:17:51 +12:00
Martin Grenfell
3eea85daa4 add support for gitconfig 2008-05-13 10:51:56 +12:00
2 changed files with 1114 additions and 1288 deletions

View File

@@ -23,11 +23,10 @@ CONTENTS *NERDCommenterContents*
2.2.7 Yank comment map............|NERDComYankComment| 2.2.7 Yank comment map............|NERDComYankComment|
2.2.8 Comment to EOL map..........|NERDComEOLComment| 2.2.8 Comment to EOL map..........|NERDComEOLComment|
2.2.9 Append com to line map......|NERDComAppendComment| 2.2.9 Append com to line map......|NERDComAppendComment|
2.2.10 Prepend com to line map....|NERDComPrependComment| 2.2.10 Insert comment map.........|NERDComInsertComment|
2.2.11 Insert comment map.........|NERDComInsertComment| 2.2.11 Use alternate delims map...|NERDComAltDelim|
2.2.12 Use alternate delims map...|NERDComAltDelim| 2.2.12 Comment aligned maps.......|NERDComAlignedComment|
2.2.13 Comment aligned maps.......|NERDComAlignedComment| 2.2.13 Uncomment line map.........|NERDComUncommentLine|
2.2.14 Uncomment line map.........|NERDComUncommentLine|
2.3 Supported filetypes...............|NERDComFiletypes| 2.3 Supported filetypes...............|NERDComFiletypes|
2.4 Sexy Comments.....................|NERDComSexyComments| 2.4 Sexy Comments.....................|NERDComSexyComments|
2.5 The NERDComment function..........|NERDComNERDComment| 2.5 The NERDComment function..........|NERDComNERDComment|
@@ -35,24 +34,24 @@ CONTENTS *NERDCommenterContents*
3.1 Options summary...................|NERDComOptionsSummary| 3.1 Options summary...................|NERDComOptionsSummary|
3.2 Options details...................|NERDComOptionsDetails| 3.2 Options details...................|NERDComOptionsDetails|
3.3 Default delimiter Options.........|NERDComDefaultDelims| 3.3 Default delimiter Options.........|NERDComDefaultDelims|
3.4 Key mapping Options...............|NERDComMappings| 4. Customising key mappings...............|NERDComMappings|
4.Issues with the script..................|NERDComIssues| 5. Issues with the script.................|NERDComIssues|
4.1 Delimiter detection heuristics....|NERDComHeuristics| 5.1 Delimiter detection heuristics....|NERDComHeuristics|
4.2 Nesting issues....................|NERDComNesting| 5.2 Nesting issues....................|NERDComNesting|
5.The author..............................|NERDComAuthor| 6.The author..............................|NERDComAuthor|
6.TODO list...............................|NERDComTodo|
7.Changelog...............................|NERDComChangelog| 7.Changelog...............................|NERDComChangelog|
8.Credits.................................|NERDComCredits| 8.Credits.................................|NERDComCredits|
9.License.................................|NERDComLicense|
============================================================================== ==============================================================================
1. Intro *NERDCommenter* 1. Intro *NERDCommenter*
The NERD commenter provides many different commenting operations and styles The NERD commenter provides many different commenting operations and styles
which may be invoked via key mappings and a commenting menu. These operations which are invoked via key mappings and a menu. These operations are available
are available for most filetypes. for most filetypes.
There are also options available that allow you to tweak the commenting engine There are also options that allow to tweak the commenting engine to your
to you taste. taste.
============================================================================== ==============================================================================
2. Functionality provided *NERDComFunctionality* 2. Functionality provided *NERDComFunctionality*
@@ -61,17 +60,15 @@ to you taste.
2.1 Functionality summary *NERDComFunctionalitySummary* 2.1 Functionality summary *NERDComFunctionalitySummary*
The following key mappings are provided by default (there is also a menu The following key mappings are provided by default (there is also a menu
provided that contains menu items corresponding to all the below mappings): with items corresponding to all the mappings below):
Most of the following mappings are for normal/visual mode only. The
|NERDComInsertComment| mapping is for insert mode only.
[count],cc |NERDComComment| [count],cc |NERDComComment|
Comments out the current line or text selected in visual mode. Comment out the current line or text selected in visual mode.
[count],cn |NERDComNestedComment| [count],cn |NERDComNestedComment|
Same as |NERDComComment| but forces nesting. Same as ,cc but forces nesting.
[count],c<space> |NERDComToggleComment| [count],c<space> |NERDComToggleComment|
Toggles the comment state of the selected line(s). If the topmost selected Toggles the comment state of the selected line(s). If the topmost selected
@@ -79,13 +76,11 @@ line is commented, all selected lines are uncommented and vice versa.
[count],cm |NERDComMinimalComment| [count],cm |NERDComMinimalComment|
Comments the given lines using only one set of multipart delimiters if Comments the given lines using only one set of multipart delimiters.
possible.
[count],ci |NERDComInvertComment| [count],ci |NERDComInvertComment|
Toggles the comment state of the selected line(s) individually. Each selected Toggles the comment state of the selected line(s) individually.
line that is commented is uncommented and vice versa.
[count],cs |NERDComSexyComment| [count],cs |NERDComSexyComment|
@@ -93,8 +88,7 @@ Comments out the selected lines ``sexily''
[count],cy |NERDComYankComment| [count],cy |NERDComYankComment|
Same as |NERDComComment| except that the commented line(s) are yanked Same as ,cc except that the commented line(s) are yanked first.
before commenting.
,c$ |NERDComEOLComment| ,c$ |NERDComEOLComment|
@@ -106,13 +100,9 @@ Adds comment delimiters to the end of line and goes into insert mode between
them. them.
,cI |NERDComPrependComment| |NERDComInsertComment|
Adds comment delimiters to the start of line and goes into insert mode between
them.
<C-c> |NERDComInsertComment|
Adds comment delimiters at the current cursor position and inserts between. Adds comment delimiters at the current cursor position and inserts between.
Disabled by default.
,ca |NERDComAltDelim| ,ca |NERDComAltDelim|
@@ -120,11 +110,9 @@ Switches to the alternative set of delimiters.
[count],cl [count],cl
[count],cr
[count],cb |NERDComAlignedComment| [count],cb |NERDComAlignedComment|
Same as |NERDComComment| except that the delimiters are aligned down the Same as |NERDComComment| except that the delimiters are aligned down the
left side (,cl), the right side (,cr) or both sides left side (,cl) or both sides (,cb).
(,cb).
[count],cu |NERDComUncommentLine| [count],cu |NERDComUncommentLine|
@@ -137,7 +125,7 @@ Uncomments the selected line(s).
2.2.1 Comment map *NERDComComment* 2.2.1 Comment map *NERDComComment*
Default mapping: [count],cc Default mapping: [count],cc
Change the mapping with: NERDComLineMap. Mapped to: <plug>NERDCommenterComment
Applicable modes: normal visual visual-line visual-block. Applicable modes: normal visual visual-line visual-block.
@@ -153,13 +141,13 @@ lines were selected in visual-line mode.
2.2.2 Nested comment map *NERDComNestedComment* 2.2.2 Nested comment map *NERDComNestedComment*
Default mapping: [count],cn Default mapping: [count],cn
Change the mapping with: NERDComLineNestMap. Mapped to: <plug>NERDCommenterNest
Applicable modes: normal visual visual-line visual-block. Applicable modes: normal visual visual-line visual-block.
Performs nested commenting. Works the same as ,cc except that if a Performs nested commenting. Works the same as ,cc except that if a line is
line is already commented then it will be commented again. already commented then it will be commented again.
If |NERDUsePlaceHolders| is set then the previous comment delimiters will If |'NERDUsePlaceHolders'| is set then the previous comment delimiters will
be replaced by place-holder delimiters if needed. Otherwise the nested be replaced by place-holder delimiters if needed. Otherwise the nested
comment will only be added if the current commenting delimiters have no right comment will only be added if the current commenting delimiters have no right
delimiter (to avoid syntax errors) delimiter (to avoid syntax errors)
@@ -168,13 +156,13 @@ If a [count] is given in normal mode, the mapping works as though that many
lines were selected in visual-line mode. lines were selected in visual-line mode.
Related options: Related options:
|NERDDefaultNesting| |'NERDDefaultNesting'|
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
2.2.3 Toggle comment map *NERDComToggleComment* 2.2.3 Toggle comment map *NERDComToggleComment*
Default mapping: [count],c<space> Default mapping: [count],c<space>
Change the mapping with: NERDComLineToggleMap. Mapped to: <plug>NERDCommenterToggle
Applicable modes: normal visual-line. Applicable modes: normal visual-line.
Toggles commenting of the lines selected. The behaviour of this mapping Toggles commenting of the lines selected. The behaviour of this mapping
@@ -191,18 +179,18 @@ lines were selected in visual-line mode.
2.2.4 Minimal comment map *NERDComMinimalComment* 2.2.4 Minimal comment map *NERDComMinimalComment*
Default mapping: [count],cm Default mapping: [count],cm
Change the mapping with: NERDComLineMinimalMap Mapped to: <plug>NERDCommenterMinimal
Applicable modes: normal visual-line. Applicable modes: normal visual-line.
Comments the selected lines using one set of multipart delimiters if possible. Comments the selected lines using one set of multipart delimiters if possible.
For example: if you are programming in c and you select 5 lines and press For example: if you are programming in c and you select 5 lines and press ,cm
,cm then a '/*' will be placed at the start of the top line and a '*/' then a '/*' will be placed at the start of the top line and a '*/' will be
will be placed at the end of the last line. placed at the end of the last line.
Sets of multipart comment delimiters that are between the top and bottom Sets of multipart comment delimiters that are between the top and bottom
selected lines are replaced with place holders (see |NERDLPlace|) if selected lines are replaced with place holders (see |'NERDLPlace'|) if
|NERDUsePlaceHolders| is set for the current filetype. If it is not, then |'NERDUsePlaceHolders'| is set for the current filetype. If it is not, then
the comment will be aborted if place holders are required to prevent illegal the comment will be aborted if place holders are required to prevent illegal
syntax. syntax.
@@ -213,7 +201,7 @@ lines were selected in visual-line mode.
2.2.5 Invert comment map *NERDComInvertComment* 2.2.5 Invert comment map *NERDComInvertComment*
Default mapping: ,ci Default mapping: ,ci
Change the mapping with: NERDComLineInvertMap. Mapped to: <plug>NERDCommenterInvert
Applicable modes: normal visual-line. Applicable modes: normal visual-line.
Inverts the commented state of each selected line. If the a selected line is Inverts the commented state of each selected line. If the a selected line is
@@ -230,7 +218,7 @@ lines were selected in visual-line mode.
2.2.6 Sexy comment map *NERDComSexyComment* 2.2.6 Sexy comment map *NERDComSexyComment*
Default mapping: [count],cs Default mapping: [count],cs
Change the mapping with: NERDComLineSexyMap Mapped to: <plug>NERDCommenterSexy
Applicable modes: normal, visual-line. Applicable modes: normal, visual-line.
Comments the selected line(s) ``sexily''... see |NERDComSexyComments| for Comments the selected line(s) ``sexily''... see |NERDComSexyComments| for
@@ -244,13 +232,13 @@ If a [count] is given in normal mode, the mapping works as though that many
lines were selected in visual-line mode. lines were selected in visual-line mode.
Related options: Related options:
|NERDCompactSexyComs| |'NERDCompactSexyComs'|
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
2.2.7 Yank comment map *NERDComYankComment* 2.2.7 Yank comment map *NERDComYankComment*
Default mapping: [count],cy Default mapping: [count],cy
Change the mapping with: NERDComLineYankMap Mapped to: <plug>NERDCommenterYank
Applicable modes: normal visual visual-line visual-block. Applicable modes: normal visual visual-line visual-block.
Same as ,cc except that it yanks the line(s) that are commented first. Same as ,cc except that it yanks the line(s) that are commented first.
@@ -259,7 +247,7 @@ Same as ,cc except that it yanks the line(s) that are commented first.
2.2.8 Comment to EOL map *NERDComEOLComment* 2.2.8 Comment to EOL map *NERDComEOLComment*
Default mapping: ,c$ Default mapping: ,c$
Change the mapping with: NERDComToEOLMap Mapped to: <plug>NERDCommenterToEOL
Applicable modes: normal. Applicable modes: normal.
Comments the current line from the current cursor position up to the end of Comments the current line from the current cursor position up to the end of
@@ -269,37 +257,33 @@ the line.
2.2.9 Append com to line map *NERDComAppendComment* 2.2.9 Append com to line map *NERDComAppendComment*
Default mapping: ,cA Default mapping: ,cA
Change the mapping with: NERDAppendComMap. Mapped to: <plug>NERDCommenterAppend
Applicable modes: normal. Applicable modes: normal.
Appends comment delimiters to the end of the current line and goes Appends comment delimiters to the end of the current line and goes
to insert mode between the new delimiters. to insert mode between the new delimiters.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
2.2.10 Prepend com to line map *NERDComPrependComment* 2.2.10 Insert comment map *NERDComInsertComment*
Default mapping: ,cI Default mapping: disabled by default.
Change the mapping with: NERDPrependComMap. Map it to: <plug>NERDCommenterInInsert
Applicable modes: normal.
Prepends comment delimiters to the start of the current line and goes to
insert mode between the new delimiters.
------------------------------------------------------------------------------
2.2.11 Insert comment map *NERDComInsertComment*
Default mapping: <C-c>
Change the mapping with: NERDComInInsertMap.
Applicable modes: insert. Applicable modes: insert.
Adds comment delimiters at the current cursor position and inserts Adds comment delimiters at the current cursor position and inserts
between them. between them.
NOTE: prior to version 2.1.17 this was mapped to ctrl-c. To restore this
mapping add >
let NERDComInsertMap='<c-c>'
<
to your vimrc.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
2.2.12 Use alternate delims map *NERDComAltDelim* 2.2.11 Use alternate delims map *NERDComAltDelim*
Default mapping: ,ca Default mapping: ,ca
Change the mapping with: NERDAltComMap Mapped to: <plug>NERDCommenterAltDelims
Applicable modes: normal. Applicable modes: normal.
Changes to the alternative commenting style if one is available. For example, Changes to the alternative commenting style if one is available. For example,
@@ -309,25 +293,25 @@ then they will be switched over to /**/ comments.
See also |NERDComDefaultDelims| See also |NERDComDefaultDelims|
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
2.2.13 Comment aligned maps *NERDComAlignedComment* 2.2.12 Comment aligned maps *NERDComAlignedComment*
Default mappings: [count],cl [count],cr [count],cb Default mappings: [count],cl [count],cb
Change the mappings with: NERDComAlignLeftMap, NERDComAlignRightMap and Mapped to: <plug>NERDCommenterAlignLeft
NERDComAlignBothMap. <plug>NERDCommenterAlignBoth
Applicable modes: normal visual-line. Applicable modes: normal visual-line.
Same as ,cc except that the comment delimiters are aligned on the left Same as ,cc except that the comment delimiters are aligned on the left side or
side, right side or both sides respectively. These comments are always nested both sides respectively. These comments are always nested if the line(s) are
if the line(s) are already commented. already commented.
If a [count] is given in normal mode, the mapping works as though that many If a [count] is given in normal mode, the mapping works as though that many
lines were selected in visual-line mode. lines were selected in visual-line mode.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
2.2.14 Uncomment line map *NERDComUncommentLine* 2.2.13 Uncomment line map *NERDComUncommentLine*
Default mapping: [count],cu Default mapping: [count],cu
Change the mapping with: NERDUncomLineMap. Mapped to: <plug>NERDCommenterUncomment
Applicable modes: normal visual visual-line visual-block. Applicable modes: normal visual visual-line visual-block.
Uncomments the current line. If multiple lines are selected in Uncomments the current line. If multiple lines are selected in
@@ -343,8 +327,8 @@ If a [count] is given in normal mode, the mapping works as though that many
lines were selected in visual-line mode. lines were selected in visual-line mode.
Related options: Related options:
|NERDRemoveAltComs| |'NERDRemoveAltComs'|
|NERDRemoveExtraSpaces| |'NERDRemoveExtraSpaces'|
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
2.3 Supported filetypes *NERDComFiletypes* 2.3 Supported filetypes *NERDComFiletypes*
@@ -393,8 +377,7 @@ one other marker symbol. For example: >
* So there! * So there!
* But this one is ``compact'' style */ * But this one is ``compact'' style */
< <
Here the multipart delimiters are /* and */ and the marker is *. The NERD Here the multipart delimiters are /* and */ and the marker is *.
commenter is capable of adding and removing comments of this type.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
2.5 The NERDComment function *NERDComNERDComment* 2.5 The NERDComment function *NERDComNERDComment*
@@ -410,9 +393,9 @@ The arguments to this function are simple:
boundries. If set to 0 then the function will operate on the current boundries. If set to 0 then the function will operate on the current
line. line.
- type: is used to specify what type of commenting operation is to be - type: is used to specify what type of commenting operation is to be
performed, and it can be one of the following: 'sexy', 'invert', performed, and it can be one of the following: "sexy", "invert",
'minimal', 'toggle', 'alignLeft', 'alignRight', 'alignBoth', 'norm', "minimal", "toggle", "alignLeft", "alignBoth", "norm", "nested",
'nested', 'toEOL', 'prepend', 'append', 'insert', 'uncomment', 'yank' "toEOL", "append", "insert", "uncomment", "yank"
For example, if you typed > For example, if you typed >
:call NERDComment(1, 'sexy') :call NERDComment(1, 'sexy')
@@ -426,41 +409,40 @@ then the script would do a sexy comment on the last visual selection.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
3.1 Options summary *NERDComOptionsSummary* 3.1 Options summary *NERDComOptionsSummary*
|loaded_nerd_comments| Turns off the script. |'loaded_nerd_comments'| Turns off the script.
|NERDAllowAnyVisualDelims| Allows multipart alternative delims to |'NERDAllowAnyVisualDelims'| Allows multipart alternative delims to
be used when commenting in be used when commenting in
visual/visual-block mode. visual/visual-block mode.
|NERDBlockComIgnoreEmpty| Forces right delims to be placed when |'NERDBlockComIgnoreEmpty'| Forces right delims to be placed when
doing visual-block comments. doing visual-block comments.
|NERDCommentWholeLinesInVMode| Changes behaviour of visual comments. |'NERDCommentWholeLinesInVMode'| Changes behaviour of visual comments.
|NERDDefaultNesting| Tells the script to use nested comments |'NERDCreateDefaultMappings'| Turn the default mappings on/off.
|'NERDDefaultNesting'| Tells the script to use nested comments
by default. by default.
|NERDMenuMode| Specifies how the NERD commenter menu |'NERDMenuMode'| Specifies how the NERD commenter menu
will appear (if at all). will appear (if at all).
|NERDLPlace| Specifies what to use as the left |'NERDLPlace'| Specifies what to use as the left
delimiter placeholder when nesting delimiter placeholder when nesting
comments. comments.
|NERDMapleader| Specifies what all the commenting key |'NERDUsePlaceHolders'| Specifies which filetypes may use
mappings will begin with.
|NERDUsePlaceHolders| Specifies which filetypes may use
placeholders when nesting comments. placeholders when nesting comments.
|NERDRemoveAltComs| Tells the script whether to remove |'NERDRemoveAltComs'| Tells the script whether to remove
alternative comment delimiters when alternative comment delimiters when
uncommenting. uncommenting.
|NERDRemoveExtraSpaces| Tells the script to always remove the |'NERDRemoveExtraSpaces'| Tells the script to always remove the
extra spaces when uncommenting extra spaces when uncommenting
(regardless of whether NERDSpaceDelims (regardless of whether NERDSpaceDelims
is set) is set)
|NERDRPlace| Specifies what to use as the right |'NERDRPlace'| Specifies what to use as the right
delimiter placeholder when nesting delimiter placeholder when nesting
comments. comments.
|NERDShutUp| Stops "Unknown filetype" output from the |'NERDShutUp'| Stops "Unknown filetype" output from the
script script
|NERDSpaceDelims| Specifies whether to add extra spaces |'NERDSpaceDelims'| Specifies whether to add extra spaces
around delimiters when commenting, and around delimiters when commenting, and
whether to remove them when whether to remove them when
uncommenting. uncommenting.
|NERDCompactSexyComs| Specifies whether to use the compact |'NERDCompactSexyComs'| Specifies whether to use the compact
style sexy comments. style sexy comments.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
@@ -469,13 +451,13 @@ then the script would do a sexy comment on the last visual selection.
To enable any of the below options you should put the given line in your To enable any of the below options you should put the given line in your
~/.vimrc ~/.vimrc
*loaded_nerd_comments* *'loaded_nerd_comments'*
If this script is driving you insane you can turn it off by setting this If this script is driving you insane you can turn it off by setting this
option > option >
let loaded_nerd_comments=1 let loaded_nerd_comments=1
< <
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
*NERDAllowAnyVisualDelims* *'NERDAllowAnyVisualDelims'*
Values: 0 or 1. Values: 0 or 1.
Default: 1. Default: 1.
@@ -498,7 +480,7 @@ shown on the right: >
System.out.println(foo * bar); System.out.println(foo * bar); System.out.println(foo * bar); System.out.println(foo * bar);
< <
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
*NERDBlockComIgnoreEmpty* *'NERDBlockComIgnoreEmpty'*
Values: 0 or 1. Values: 0 or 1.
Default: 1. Default: 1.
@@ -541,7 +523,7 @@ Otherwise, the code block would become: >
/*} */ /*} */
< <
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
*NERDCommentWholeLinesInVMode* *'NERDCommentWholeLinesInVMode'*
Values: 0, 1 or 2. Values: 0, 1 or 2.
Default: 0. Default: 0.
@@ -579,15 +561,25 @@ then stick the following line in your vimrc: >
let NERDCommentWholeLinesInVMode=2 let NERDCommentWholeLinesInVMode=2
< <
Note that this option does not affect the behaviour of |visual-block| mode. Note that this option does not affect the behaviour of commenting in
|visual-block| mode.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
*NERDRemoveAltComs* *'NERDCreateDefaultMappings'*
Values: 0 or 1.
Default: 1.
If set to 0, none of the default mappings will be created.
See also |NERDComMappings|.
------------------------------------------------------------------------------
*'NERDRemoveAltComs'*
Values: 0 or 1. Values: 0 or 1.
Default: 1. Default: 1.
When uncommenting a line (for a filetype with an alternative commenting style) When uncommenting a line (for a filetype with an alternative commenting style)
this option tells the script whether to look for, and remove, comments this option tells the script whether to look for, and remove, comment
delimiters of the alternative style. delimiters of the alternative style.
For example, if you are editing a c++ file using // style comments and you go For example, if you are editing a c++ file using // style comments and you go
@@ -597,13 +589,13 @@ For example, if you are editing a c++ file using // style comments and you go
It will not be uncommented if the NERDRemoveAltComs is set to 0. It will not be uncommented if the NERDRemoveAltComs is set to 0.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
*NERDRemoveExtraSpaces* *'NERDRemoveExtraSpaces'*
Values: 0 or 1. Values: 0 or 1.
Default: 1. Default: 1.
By default, the NERD commenter will remove spaces around comment delimiters if By default, the NERD commenter will remove spaces around comment delimiters if
either: either:
1. |NERDSpaceDelims| is set to 1. 1. |'NERDSpaceDelims'| is set to 1.
2. NERDRemoveExtraSpaces is set to 1. 2. NERDRemoveExtraSpaces is set to 1.
This means that if we have the following lines in a c code file: > This means that if we have the following lines in a c code file: >
@@ -622,12 +614,12 @@ Otherwise they would become: >
int bar = 10; int bar = 10;
int baz = foo + bar int baz = foo + bar
< <
If you want the spaces to be removed only if |NERDSpaceDelims| is set then If you want the spaces to be removed only if |'NERDSpaceDelims'| is set then
set NERDRemoveExtraSpaces to 0. set NERDRemoveExtraSpaces to 0.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
*NERDLPlace* *'NERDLPlace'*
*NERDRPlace* *'NERDRPlace'*
Values: arbitrary string. Values: arbitrary string.
Default: Default:
NERDLPlace: "[>" NERDLPlace: "[>"
@@ -649,37 +641,7 @@ and we comment it with ,cn it will be changed to: >
When we uncomment this line it will go back to what it was. When we uncomment this line it will go back to what it was.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
*NERDMapleader* *'NERDMenuMode'*
Values: arbitrary string.
Default: \c
NERDMapleader is used to specify what all the NERD commenter key mappings
begin with.
The default key mappings will look like this: >
\cc
\cu
\ca
\ci
\cs
...
<
However, if this line: >
let NERDMapleader = ',x'
<
were present in your vimrc then the default mappings would look like this: >
,xc
,xu
,xa
,xi
,xs
...
<
This option only affects the mappings that have not been explicitly set
manually (see |NERDComMappings|).
------------------------------------------------------------------------------
*NERDMenuMode*
Values: 0, 1, 2, 3. Values: 0, 1, 2, 3.
Default: 3 Default: 3
@@ -690,15 +652,15 @@ This option can take 4 values:
"3": Turns the 'Plugin -> comment' menu on with <alt>-c as the shortcut. "3": Turns the 'Plugin -> comment' menu on with <alt>-c as the shortcut.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
*NERDUsePlaceHolders* *'NERDUsePlaceHolders'*
Values: 0 or 1. Values: 0 or 1.
Default 1. Default 1.
This option is used to specify whether place-holder delimiters should be used This option is used to specify whether place-holder delimiters should be used
when adding nested comments. when creating a nested comment.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
*NERDShutUp* *'NERDShutUp'*
Values: 0 or 1. Values: 0 or 1.
Default 1. Default 1.
@@ -707,7 +669,7 @@ messages. Stick this line in your vimrc: >
let NERDShutUp=1 let NERDShutUp=1
< <
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
*NERDSpaceDelims* *'NERDSpaceDelims'*
Values: 0 or 1. Values: 0 or 1.
Default 0. Default 0.
@@ -720,10 +682,10 @@ as opposed to this: >
< <
If you want spaces to be added then set NERDSpaceDelims to 1 in your vimrc. If you want spaces to be added then set NERDSpaceDelims to 1 in your vimrc.
See also |NERDRemoveExtraSpaces|. See also |'NERDRemoveExtraSpaces'|.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
*NERDCompactSexyComs* *'NERDCompactSexyComs'*
Values: 0 or 1. Values: 0 or 1.
Default 0. Default 0.
@@ -742,20 +704,19 @@ As opposed to like this: >
If this option is set to 1 then the top style will be used. If this option is set to 1 then the top style will be used.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
*NERDDefaultNesting* *'NERDDefaultNesting'*
Values: 0 or 1. Values: 0 or 1.
Default 1. Default 1.
When this option is set to 1, comments are nested automatically. That is, if When this option is set to 1, comments are nested automatically. That is, if
you hit ,cc on a line that is already commented it will be commented you hit ,cc on a line that is already commented it will be commented again
again
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
3.3 Default delimiter customisation *NERDComDefaultDelims* 3.3 Default delimiter customisation *NERDComDefaultDelims*
If you want the NERD commenter to use the alternative delimiters for a If you want the NERD commenter to use the alternative delimiters for a
specific filetype by default then put a line of this form into your vimrc: > specific filetype by default then put a line of this form into your vimrc: >
let NERD_<&filetype>_alt_style=1 let NERD_<filetype>_alt_style=1
< <
Example: java uses // style comments by default, but you want it to default to Example: java uses // style comments by default, but you want it to default to
/* */ style comments instead. You would put this line in your vimrc: > /* */ style comments instead. You would put this line in your vimrc: >
@@ -764,42 +725,27 @@ Example: java uses // style comments by default, but you want it to default to
See |NERDComAltDelim| for switching commenting styles at runtime. See |NERDComAltDelim| for switching commenting styles at runtime.
------------------------------------------------------------------------------ ==============================================================================
3.4 Key mapping customisation *NERDComMappings* 4. Key mapping customisation *NERDComMappings*
These options are used to override the default keys that are used for the To change a mapping just map another key combo to the internal <plug> mapping.
commenting mappings. Their values must be set to strings. As an example: if For example, to remap the |NERDComComment| mapping to ",omg" you would put
you wanted to use the mapping ,foo to uncomment lines of code then this line in your vimrc: >
you would place this line in your vimrc > map ,omg <plug>NERDCommenterComment
let NERDUncomLineMap=",foo"
< <
Check out |NERDComFunctionality| for details about what the following This will stop the corresponding default mappings from being created.
mappings do.
Default Mapping Option to override~ See the help for the mapping in question to see which <plug> mapping to
map to.
,ca NERDAltComMap See also |'NERDCreateDefaultMappings'|.
,ce NERDAppendComMap
,cl NERDComAlignLeftMap
,cb NERDComAlignBothMap
,cr NERDComAlignRightMap
<C-c> NERDComInInsertMap
,ci NERDComLineInvertMap
,cc NERDComLineMap
,cn NERDComLineNestMap
,cs NERDComLineSexyMap
,c<space> NERDComLineToggleMap
,cm NERDComLineMinimalMap
,c$ NERDComToEOLMap
,cy NERDComLineYankMap
,cu NERDUncomLineMap
============================================================================== ==============================================================================
4. Issues with the script *NERDComIssues* 5. Issues with the script *NERDComIssues*
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
4.1 Delimiter detection heuristics *NERDComHeuristics* 5.1 Delimiter detection heuristics *NERDComHeuristics*
Heuristics are used to distinguish the real comment delimiters Heuristics are used to distinguish the real comment delimiters
@@ -819,7 +765,7 @@ string. These heuristics, while usually pretty accurate, will not work for all
cases. cases.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
4.2 Nesting issues *NERDComNesting* 5.2 Nesting issues *NERDComNesting*
If we have some line of code like this: > If we have some line of code like this: >
/*int foo */ = /*5 + 9;*/ /*int foo */ = /*5 + 9;*/
@@ -849,215 +795,48 @@ Drop him a line at martin_grenfell at msn.com. He would love to hear from you.
its a lonely life being the worlds premier terror machine. How would you feel its a lonely life being the worlds premier terror machine. How would you feel
if your face looked like a toaster and a t-rex put together? :( if your face looked like a toaster and a t-rex put together? :(
==============================================================================
7. TODO list *NERDComTodo*
Uncommenting of minimal comments needs to be more robust. Currently it is easy
to get illegal syntax when uncommenting them.
============================================================================== ==============================================================================
8. Changelog *NERDComChangelog* 8. Changelog *NERDComChangelog*
2.1.13 2.2.1
- added support for rib, pyrex/cython, liquid, services, gitcommit, - add support for newlisp and clojure, thanks to Matthew Lee Hinman.
vimperator, and slice. Thanks to spookypeanut, Greg Jandl, Christophe - fix automake comments, thanks to Elias Pipping
Benz, A Pontus, and Stromnov for emailing me and/or posting issues. - make haml comments default to -# with / as the alternative delimiter,
- set the NERDRemoveExtraSpaces option to 1 by default as the doc states thanks to tpope
- other fixes: (thanks to Zhang Shuhan for all his emails and testing) - add support for actionscript and processing thanks to Edwin Benavides
* made the sexy comment mapping fall back to normal commenting if sexy - add support for ps1 (powershell), thanks to Jason Mills
comments arent possible for the current filetype - add support for hostsaccess, thanks to Thomas Rowe
* fixed some bugs with sexy comments - add support for CVScommit
* made the uncommenting side of toggle comments slightly more robust - add support for asciidoc, git and gitrebase. Thanks to Simon Ruderich.
* fixed a bug where some extra spaces werent being removed (although - use # for gitcommit comments, thanks to Simon Ruderich.
the currect options were set) - add support for mako and genshi, thanks to Keitheis.
2.1.12 - add support for conkyrc, thanks to David
- added support for patran and dakota, thx to Jacobo Diaz for the email - add support for SVNannotate, thanks to Miguel Jaque Barbero.
- added support for gentoo-env-d, gentoo-init-d, gentoo-make-conf, grub, - add support for sieve, thanks to Stefan Walk
modconf and sudoers filetypes, thx to Li Jin for the patch. - add support for objj, thanks to Adam Thorsen.
- added support for SVNdiff, gitAnnotate, gitdiff. Thx to nicothakis for
posting the issue
2.1.11 2.2.0
- fixed a bug with the selection option and visual commenting (again). - rewrote the mappings system to be more "standard".
Thanks to Ingo Karkat (again). - removed all the mapping options. Now, mappings to <plug> mappings are
used
2.1.10 - see :help NERDComMappings, and :help NERDCreateDefaultMappings for
- added support for Wikipedia (thanks to Chen Xing) more info
- added support for mplayerconf - remove "prepend comments" and "right aligned comments".
- bugfixes (thanks to Ingo Karkat for the bug report/patch) - add support for applescript, calbire, man, SVNcommit, potwiki, txt2tags and SVNinfo.
- added support for mkd (thanks to Stefano Zacchiroli) Thanks to nicothakis, timberke, sgronblo, mntnoe, Bernhard Grotz, John
O'Shea, François and Giacomo Mariani respectively.
2.1.9 - bugfix for haskell delimiters. Thanks to mntnoe.
- added support for mrxvtrc and aap, thx to Marco for the emails 2.1.18
- added dummy support for SVNAnnotate, SVKAnnotate and CVSAnnotate, thx to - add support for llvm. Thanks to nicothakis.
nicothakis for posting the issue - add support for xquery. Thanks to Phillip Kovalev.
2.1.17
2.1.8 - fixed haskell delimiters (hackily). Thanks to Elias Pipping.
- fixed a couple of bugs with the NERDSpaceDelims option, thx to - add support for mailcap. Thanks to Pascal Brueckner.
David Miani and Jeremy Hinegardner - add support for stata. Thanks to Jerónimo Carballo.
- added dummy support for lhaskell, thx to pipp for posting the issue - applied a patch from ewfalor to fix an error in the help file with the
- added an alternative set of delims for the plsql filetype, thx to Kuchma NERDMapleader doc
Michael - disable the insert mode ctrl-c mapping by default, see :help
- added support for spectre, thx to Brett Warneke NERDComInsertComment if you wish to restore it
- added support for scala, thx to Renald Buter
- added support for asymptote, thx to Vladimir Lomov
- made NERDDefaultNesting enabled by default as this seems more intuitive,
thx to marco for the suggestion
2.1.7
- added support for haml, thx to Greb Weber
- added support for asterisk, thx to Laurent ARNOUD
- added support for objcpp, thx to Nicolas Weber
- added support for the factor filetype, thx to Aaron Schaefer
- fixed a bug with the passwd filetype setup, thx to Yongwei Wu
- fixed a bug that was forcing filetypes with an alternative set of delims
to have at least one multipart set.
- split out the help file out from the script and repackaged everything as
a zip
2.1.6
- added support for gentoo-conf-d thanks to tinoucas for posting the issue
and the patch
- added support for the D filetype. Thanks to Greg Weber for the email.
- added dummy support for cobol, cheers to timberke for posting the issue.
- added support for velocity. Thanks to Bruce Sherrod for the email.
2.1.5
- added support for lilypond, bbx and lytex. Thanks to Eyolf Østrem for
the email.
- added an alterative set of delimiters for the dosbatch filetype, thanks
to Ingo Karkat for the email.
- added support for the markdown filetype. Thanks to Nicolas Weber for the
posting the issue.
2.1.4
- added support for the ahk filetype. Cheers to Don Hatlestad for the
email.
- added support for desktop and xsd filetypes. Thanks to Christophe Benz.
- added dummy support for Rails-log
- fixed a bunch of bugs in the comment delimiter setup process, thanks to
Cheng Fang for the email :D
- hardcore refactoring and removal of seldomly used, overly-complex
functionality.
- the script now requires vim 7
2.1.3
- fixed numerous bugs that were causing tabs to permanently be converted
to spaces, even if noexpandtab was set. Thanks to Heptite on #vim for
working with me to track them down :)
- added dummy support for "lookupfile". Thanks to David Fishburn for the
email.
- added support for "rst", thanks to Niels Aan de Brugh for the email.
2.1.2
- added support for the vera and ldif filetypes. Thanks to Normandie
Azucena and Florian Apolloner for the emails.
2.1.1
- added dummy support for SVNcommitlog and vcscommit. Thanks to John
O'Shea for the email.
- added support for Groovy. Thanks to Jason Mills for the email.
2.1.0
- now the script resets the delimiters when the filetype of the buffer
changes (thanks to James Hales for the patch)
- added formal support/doc for prepending a count to many of the
commenting maps so you can go, eg, 5,cc to comment 5 lines from normal
mode. Thanks again to James Hales for the patch.
- added support for the "gams" filetype that Jorge Rodrigues created.
- added support for the "objc" filetype, thanks to Rainer Müller for the
email.
- added support for the "sass" filetype that Dmitry Ilyashevich created.
2.0.7
- Added support for eclass and ebuild filetypes. Thanks to Alex Tarkovsky
for the email.
2.0.6
- Changed the default setting of NERDMapleader to ",c", meaning all the
maps now start with ,c instead of \c. This is to stop a major mapping
clash with the vcscommand plugin. Anyone wanting to keep the \c map
leader should read :help NERDMapleader.
- Added support for debcontrol and dummy support for debchangelog
filetypes, thanks to Stefano Zacchiroli for the email.
- Made it so that the NERDShutUp option now only controls the "Pleeease
email the delimiters..." requests. It no longer affects the general
output of the script.
- Simplified the names of the help tags.
2.0.5
- Added support for autoit, autohotkey and docbk filetypes (thanks to
Michael Böhler)
- Added support for cmake (thanks to Aaron Small)
- Added support for htmldjango and django filetypes (thanks to Ramiro
Morales)
- Improved the delimiters for eruby again
- Applied a patch from Seth Mason to fix some pathing issues with the help
file installation.
2.0.4
- Added support for verilog_systemverilog and systemverilog filetypes
(Thanks to Alexey for the email)
- Added support for fstab, thanks to Lizendir for the email.
- Added support for the smarty filetype.
- Improved the delimiters for eruby.
- Added dummy support for changelog filetype.
2.0.3
- Added dummy support for the csv filetype (thx to Mark Woodward for the
email)
- Added dummy support for vo_base and otl filetypes (thanks to fREW for
the email)
2.0.2:
- Minor bug fix that was stopping nested comments from working
2.0.1:
- Fixed the visual bell for the |NERDComToEOLMap| map.
- Added another possible value to the NERDMenuMode option which causes the
menu to be displayed under 'Plugin -> Comment'. See :h NERDMenuMode.
This new menu mode is now the default.
- Added support for the occam filetype (thanks to Anders for emailing me)
- Made the main commenting function (NERDComment) available outside the
script.
- bug fixes and refactoring
2.0.0:
- NOTE: renamed the script to NERD_commenter.vim. When you install this
version you must delete the old files: NERD_comments.vim and
NERD_comments.txt.
- Reworked the mappings and main entry point function for the script to
avoid causing visual-bells and screen scrolling.
- Changes to the script options (see |NERD_com-Customisation| for
details):
- They are all camel case now instead of underscored.
- Converted all of the regular expression options into simple boolean
options for simplicity.
- All the options are now stated positively, eg.
NERD_dont_remove_spaces_regexp has become NERDRemoveExtraSpaces.
- Some of the option names have been changed (other than in the above
ways)
- Some have been removed altogether, namely: NERD_create_h_filetype
(why was a commenting script creating a filetype?!),
NERD_left_align_regexp, NERD_right_align_regexp,
- Removed all the NERD_use_alt_style_XXX_coms options and replaced them
with a better system. Now if a filetype has alternative delims, the
script will check whether an option of the form
"NERD_<&filetype>_alt_style" exists, and if it does then alt delims will
be used. See |NERD_com-cust-delims| for details.
- The script no longer removes extra spaces for sexy comments for the
NERDRemoveExtraSpaces option (it will still remove spaces if
NERDSpaceDelims is set).
- Added dummy support for viminfo and rtf.
- Added support for the "gentoo-package-\(keywords\|mask\|use\)"
filetypes.
- Added '#' comments as an alternative for the asm filetype
Thanks to Markus Klinik and Anders for bug reports, and again to Anders
for his patch. Thanks to John O'Shea and fREW for the filetype
information.
============================================================================== ==============================================================================
8. Credits *NERDComCredits* 8. Credits *NERDComCredits*
@@ -1186,6 +965,15 @@ reports about sexy/toggle comments and for testing my fixes.
Thanks to tpope for the english lesson. Thanks to tpope for the english lesson.
Thanks to Ben Schmidt, David Fishburn, and Erik Falor for emailing me about an
incompatibility with vim7.2. Thanks also to JaGoTerr for posting the issue.
Thanks to Elias Pipping for sending me a bug report about haskell commenting.
Thanks to mntnoe for pointing out incorrect delimiters for haskell.
Thanks to Mark S. for pointing out a bug in the doc.
Not to forget! Thanks to the following people for sending me new filetypes to Not to forget! Thanks to the following people for sending me new filetypes to
support :D support :D
@@ -1197,7 +985,7 @@ Michael Brunner kconfig
Antono Vasiljev netdict Antono Vasiljev netdict
Melissa Reid omlet Melissa Reid omlet
Ilia N Ternovich quickfix Ilia N Ternovich quickfix
John O'Shea RTF, SVNcommitlog and vcscommit John O'Shea RTF, SVNcommitlog and vcscommit, SVNCommit
Anders occam Anders occam
Mark Woodward csv Mark Woodward csv
fREW gentoo-package-mask, fREW gentoo-package-mask,
@@ -1212,7 +1000,7 @@ Stefano Zacchiroli debcontrol, debchangelog, mkd
Alex Tarkovsky ebuild and eclass Alex Tarkovsky ebuild and eclass
Jorge Rodrigues gams Jorge Rodrigues gams
Rainer Müller Objective C Rainer Müller Objective C
Jason Mills Groovy Jason Mills Groovy, ps1
Normandie Azucena vera Normandie Azucena vera
Florian Apolloner ldif Florian Apolloner ldif
David Fishburn lookupfile David Fishburn lookupfile
@@ -1225,9 +1013,9 @@ Nicolas Weber markdown, objcpp
tinoucas gentoo-conf-d tinoucas gentoo-conf-d
Greg Weber D, haml Greg Weber D, haml
Bruce Sherrod velocity Bruce Sherrod velocity
timberke cobol timberke cobol, calibre
Aaron Schaefer factor Aaron Schaefer factor
Laurent ARNOUD asterisk, mplayerconf Mr X asterisk, mplayerconf
Kuchma Michael plsql Kuchma Michael plsql
Brett Warneke spectre Brett Warneke spectre
Pipp lhaskell Pipp lhaskell
@@ -1235,7 +1023,8 @@ Renald Buter scala
Vladimir Lomov asymptote Vladimir Lomov asymptote
Marco mrxvtrc, aap Marco mrxvtrc, aap
nicothakis SVNAnnotate, CVSAnnotate, SVKAnnotate, nicothakis SVNAnnotate, CVSAnnotate, SVKAnnotate,
SVNdiff, gitAnnotate, gitdiff SVNdiff, gitAnnotate, gitdiff, dtrace
llvm, applescript
Chen Xing Wikipedia Chen Xing Wikipedia
Jacobo Diaz dakota, patran Jacobo Diaz dakota, patran
Li Jin gentoo-env-d, gentoo-init-d, Li Jin gentoo-env-d, gentoo-init-d,
@@ -1244,4 +1033,31 @@ SpookeyPeanut rib
Greg Jandl pyrex/cython Greg Jandl pyrex/cython
Christophe Benz services, gitcommit Christophe Benz services, gitcommit
A Pontus vimperator A Pontus vimperator
Stromnov slice Stromnov slice, bzr
Martin Kustermann pamconf
Indriði Einarsson mason
Chris map
Krzysztof A. Adamski group
Pascal Brueckner mailcap
Jerónimo Carballo stata
Phillip Kovalev xquery
Bernhard Grotz potwiki
sgronblo man
François txt2tags
Giacomo Mariani SVNinfo
Matthew Lee Hinman newlisp, clojure
Elias Pipping automake
Edwin Benavides actionscript, processing
Thomas Rowe hostsaccess
Simon Ruderich asciidoc, git, gitcommit, gitrebase
Keitheis mako, genshi
David conkyrc
Miguel Jaque Barbero SVNannotate
Stefan Walk sieve
Adam Thorsen objj
==============================================================================
9. License *NERDComLicense*
The NERD commenter is released under the wtfpl.
See http://sam.zoy.org/wtfpl/COPYING.

View File

@@ -1,11 +1,16 @@
" vim global plugin that provides easy code commenting for various file types " ============================================================================
" Last Change: 4 May 2008 " File: NERD_commenter.vim
" Maintainer: Martin Grenfell <martin_grenfell at msn.com> " Description: vim global plugin that provides easy code commenting
let s:NERD_commenter_version = 2.1.13 " Maintainer: Martin Grenfell <martin_grenfell at msn dot com>
" Version: 2.2.1
" For help documentation type :help NERDCommenter. If this fails, Restart vim " Last Change: 13th November, 2008
" and try again. If it sill doesnt work... the help page is at the bottom " License: This program is free software. It comes without any warranty,
" of this file. " to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
" ============================================================================
" Section: script init stuff {{{1 " Section: script init stuff {{{1
if exists("loaded_nerd_comments") if exists("loaded_nerd_comments")
@@ -54,6 +59,7 @@ call s:InitVariable("g:NERDAllowAnyVisualDelims", 1)
call s:InitVariable("g:NERDBlockComIgnoreEmpty", 0) call s:InitVariable("g:NERDBlockComIgnoreEmpty", 0)
call s:InitVariable("g:NERDCommentWholeLinesInVMode", 0) call s:InitVariable("g:NERDCommentWholeLinesInVMode", 0)
call s:InitVariable("g:NERDCompactSexyComs", 0) call s:InitVariable("g:NERDCompactSexyComs", 0)
call s:InitVariable("g:NERDCreateDefaultMappings", 1)
call s:InitVariable("g:NERDDefaultNesting", 1) call s:InitVariable("g:NERDDefaultNesting", 1)
call s:InitVariable("g:NERDMenuMode", 3) call s:InitVariable("g:NERDMenuMode", 3)
call s:InitVariable("g:NERDLPlace", "[>") call s:InitVariable("g:NERDLPlace", "[>")
@@ -65,24 +71,8 @@ call s:InitVariable("g:NERDShutUp", '0')
call s:InitVariable("g:NERDSpaceDelims", 0) call s:InitVariable("g:NERDSpaceDelims", 0)
call s:InitVariable("g:NERDDelimiterRequests", 1) call s:InitVariable("g:NERDDelimiterRequests", 1)
call s:InitVariable("g:NERDMapleader", ',c')
call s:InitVariable("g:NERDAltComMap", g:NERDMapleader . 'a')
call s:InitVariable("g:NERDAppendComMap", g:NERDMapleader . 'A')
call s:InitVariable("g:NERDComAlignBothMap", g:NERDMapleader . 'b')
call s:InitVariable("g:NERDComAlignLeftMap", g:NERDMapleader . 'l')
call s:InitVariable("g:NERDComAlignRightMap", g:NERDMapleader . 'r')
call s:InitVariable("g:NERDComInInsertMap", '<C-c>')
call s:InitVariable("g:NERDComLineInvertMap", g:NERDMapleader . 'i')
call s:InitVariable("g:NERDComLineMap", g:NERDMapleader . 'c')
call s:InitVariable("g:NERDComLineNestMap", g:NERDMapleader . 'n')
call s:InitVariable("g:NERDComLineSexyMap", g:NERDMapleader . 's')
call s:InitVariable("g:NERDComLineToggleMap", g:NERDMapleader . '<space>')
call s:InitVariable("g:NERDComLineMinimalMap", g:NERDMapleader . 'm')
call s:InitVariable("g:NERDComLineYankMap", g:NERDMapleader . 'y')
call s:InitVariable("g:NERDComToEOLMap", g:NERDMapleader . '$')
call s:InitVariable("g:NERDPrependComMap", g:NERDMapleader . 'I')
call s:InitVariable("g:NERDUncomLineMap", g:NERDMapleader . 'u')
let s:NERDFileNameEscape="[]#*$%'\" ?`!&();<>\\" let s:NERDFileNameEscape="[]#*$%'\" ?`!&();<>\\"
" Section: Comment mapping functions, autocommands and commands {{{1 " Section: Comment mapping functions, autocommands and commands {{{1
@@ -90,21 +80,16 @@ let s:NERDFileNameEscape="[]#*$%'\" ?`!&();<>\\"
" Section: Comment enabler autocommands {{{2 " Section: Comment enabler autocommands {{{2
" ============================================================================ " ============================================================================
if !exists("nerd_autocmds_loaded") augroup commentEnablers
let nerd_autocmds_loaded=1
augroup commentEnablers "if the user enters a buffer or reads a buffer then we gotta set up
"the comment delimiters for that new filetype
autocmd BufEnter,BufRead * :call s:SetUpForNewFiletype(&filetype, 0)
"if the user enters a buffer or reads a buffer then we gotta set up "if the filetype of a buffer changes, force the script to reset the
"the comment delimiters for that new filetype "delims for the buffer
autocmd BufEnter,BufRead * :call s:SetUpForNewFiletype(&filetype, 0) autocmd Filetype * :call s:SetUpForNewFiletype(&filetype, 1)
augroup END
"if the filetype of a buffer changes, force the script to reset the
"delims for the buffer
autocmd Filetype * :call s:SetUpForNewFiletype(&filetype, 1)
augroup END
endif
" Function: s:SetUpForNewFiletype(filetype) function {{{2 " Function: s:SetUpForNewFiletype(filetype) function {{{2
@@ -140,6 +125,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
call s:MapDelimiters('%', '') call s:MapDelimiters('%', '')
elseif a:filetype == "acedb" elseif a:filetype == "acedb"
call s:MapDelimitersWithAlternative('//','', '/*','*/') call s:MapDelimitersWithAlternative('//','', '/*','*/')
elseif a:filetype == "actionscript"
call s:MapDelimitersWithAlternative('//','', '/*','*/')
elseif a:filetype == "ada" elseif a:filetype == "ada"
call s:MapDelimitersWithAlternative('--','', '-- ', '') call s:MapDelimitersWithAlternative('--','', '-- ', '')
elseif a:filetype == "ahdl" elseif a:filetype == "ahdl"
@@ -158,6 +145,10 @@ function s:SetUpForNewFiletype(filetype, forceReset)
call s:MapDelimiters('#', '') call s:MapDelimiters('#', '')
elseif a:filetype == "apachestyle" elseif a:filetype == "apachestyle"
call s:MapDelimiters('#', '') call s:MapDelimiters('#', '')
elseif a:filetype == "asciidoc"
call s:MapDelimiters('//', '')
elseif a:filetype == "applescript"
call s:MapDelimitersWithAlternative('--', '', '(*', '*)')
elseif a:filetype == "asm68k" elseif a:filetype == "asm68k"
call s:MapDelimiters(';', '') call s:MapDelimiters(';', '')
elseif a:filetype == "asm" elseif a:filetype == "asm"
@@ -177,7 +168,7 @@ function s:SetUpForNewFiletype(filetype, forceReset)
elseif a:filetype == "autoit" elseif a:filetype == "autoit"
call s:MapDelimiters(';','') call s:MapDelimiters(';','')
elseif a:filetype == "automake" elseif a:filetype == "automake"
call s:MapDelimitersWithAlternative('#','', 'dnl ', '') call s:MapDelimiters('##','')
elseif a:filetype == "ave" elseif a:filetype == "ave"
call s:MapDelimiters("'",'') call s:MapDelimiters("'",'')
elseif a:filetype == "awk" elseif a:filetype == "awk"
@@ -200,8 +191,12 @@ function s:SetUpForNewFiletype(filetype, forceReset)
call s:MapDelimiters('%', '') call s:MapDelimiters('%', '')
elseif a:filetype == "btm" elseif a:filetype == "btm"
call s:MapDelimiters('::', '') call s:MapDelimiters('::', '')
elseif a:filetype == "bzr"
call s:MapDelimiters('', '')
elseif a:filetype == "caos" elseif a:filetype == "caos"
call s:MapDelimiters('*', '') call s:MapDelimiters('*', '')
elseif a:filetype == "calibre"
call s:MapDelimiters('//','')
elseif a:filetype == "catalog" elseif a:filetype == "catalog"
call s:MapDelimiters('--','--') call s:MapDelimiters('--','--')
elseif a:filetype == "c" elseif a:filetype == "c"
@@ -220,6 +215,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
call s:MapDelimitersWithAlternative('//','', '/*','*/') call s:MapDelimitersWithAlternative('//','', '/*','*/')
elseif a:filetype == "clipper" elseif a:filetype == "clipper"
call s:MapDelimitersWithAlternative('//','', '/*','*/') call s:MapDelimitersWithAlternative('//','', '/*','*/')
elseif a:filetype == "clojure"
call s:MapDelimiters(';', '')
elseif a:filetype == "cmake" elseif a:filetype == "cmake"
call s:MapDelimiters('#','') call s:MapDelimiters('#','')
elseif a:filetype == "cobol" elseif a:filetype == "cobol"
@@ -228,6 +225,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
call s:MapDelimiters('#', '') call s:MapDelimiters('#', '')
elseif a:filetype == "config" elseif a:filetype == "config"
call s:MapDelimiters('dnl ', '') call s:MapDelimiters('dnl ', '')
elseif a:filetype == "conkyrc"
call s:MapDelimiters('#', '')
elseif a:filetype == "context" elseif a:filetype == "context"
call s:MapDelimiters('%','') call s:MapDelimiters('%','')
elseif a:filetype == "cpp" elseif a:filetype == "cpp"
@@ -252,6 +251,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
call s:MapDelimiters('CVS:','') call s:MapDelimiters('CVS:','')
elseif a:filetype == "CVSAnnotate" elseif a:filetype == "CVSAnnotate"
call s:MapDelimiters('','') call s:MapDelimiters('','')
elseif a:filetype == "CVScommit"
call s:MapDelimiters('','')
elseif a:filetype == "d" elseif a:filetype == "d"
call s:MapDelimitersWithAlternative('//','', '/*','*/') call s:MapDelimitersWithAlternative('//','', '/*','*/')
elseif a:filetype == "dcl" elseif a:filetype == "dcl"
@@ -290,6 +291,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
call s:MapDelimiters('<!--','-->') call s:MapDelimiters('<!--','-->')
elseif a:filetype == "dtml" elseif a:filetype == "dtml"
call s:MapDelimiters('<dtml-comment>','</dtml-comment>') call s:MapDelimiters('<dtml-comment>','</dtml-comment>')
elseif a:filetype == "dtrace"
call s:MapDelimiters('/*','*/')
elseif a:filetype == "dylan" elseif a:filetype == "dylan"
call s:MapDelimitersWithAlternative('//','', '/*','*/') call s:MapDelimitersWithAlternative('//','', '/*','*/')
elseif a:filetype == 'ebuild' elseif a:filetype == 'ebuild'
@@ -342,6 +345,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
call s:MapDelimiters('--', '') call s:MapDelimiters('--', '')
elseif a:filetype == "geek" elseif a:filetype == "geek"
call s:MapDelimiters('GEEK_COMMENT:', '') call s:MapDelimiters('GEEK_COMMENT:', '')
elseif a:filetype == "genshi"
call s:MapDelimitersWithAlternative('<!--','-->', '{#', '#}')
elseif a:filetype == "gentoo-conf-d" elseif a:filetype == "gentoo-conf-d"
call s:MapDelimiters('#', '') call s:MapDelimiters('#', '')
elseif a:filetype == "gentoo-env-d" elseif a:filetype == "gentoo-env-d"
@@ -356,34 +361,44 @@ function s:SetUpForNewFiletype(filetype, forceReset)
call s:MapDelimiters('#', '') call s:MapDelimiters('#', '')
elseif a:filetype == 'gentoo-package-use' elseif a:filetype == 'gentoo-package-use'
call s:MapDelimiters('#', '') call s:MapDelimiters('#', '')
elseif a:filetype == 'git'
call s:MapDelimiters('', '')
elseif a:filetype == 'gitAnnotate' elseif a:filetype == 'gitAnnotate'
call s:MapDelimiters('', '') call s:MapDelimiters('', '')
elseif a:filetype == 'gitcommit' elseif a:filetype == 'gitcommit'
call s:MapDelimiters('', '') call s:MapDelimiters('#', '')
elseif a:filetype == 'gitconfig'
call s:MapDelimiters(';', '')
elseif a:filetype == 'gitdiff' elseif a:filetype == 'gitdiff'
call s:MapDelimiters('', '') call s:MapDelimiters('', '')
elseif a:filetype == 'gitrebase'
call s:MapDelimiters('#', '')
elseif a:filetype == "gnuplot" elseif a:filetype == "gnuplot"
call s:MapDelimiters('#','') call s:MapDelimiters('#','')
elseif a:filetype == "groovy" elseif a:filetype == "groovy"
call s:MapDelimitersWithAlternative('//','', '/*','*/') call s:MapDelimitersWithAlternative('//','', '/*','*/')
elseif a:filetype == "group"
call s:MapDelimiters('','')
elseif a:filetype == "grub" elseif a:filetype == "grub"
call s:MapDelimiters('#', '') call s:MapDelimiters('#', '')
elseif a:filetype == "gtkrc" elseif a:filetype == "gtkrc"
call s:MapDelimiters('#', '') call s:MapDelimiters('#', '')
elseif a:filetype == "haskell" elseif a:filetype == "haskell"
call s:MapDelimitersWithAlternative('--','', '{-', '-}') call s:MapDelimitersWithAlternative('{-','-}', '--', '')
elseif a:filetype == "hb" elseif a:filetype == "hb"
call s:MapDelimiters('#', '') call s:MapDelimiters('#', '')
elseif a:filetype == "h" elseif a:filetype == "h"
call s:MapDelimitersWithAlternative('//','', '/*','*/') call s:MapDelimitersWithAlternative('//','', '/*','*/')
elseif a:filetype == "haml" elseif a:filetype == "haml"
call s:MapDelimiters('/', '') call s:MapDelimitersWithAlternative('-#', '', '/', '')
elseif a:filetype == "help" elseif a:filetype == "help"
call s:MapDelimiters('"','') call s:MapDelimiters('"','')
elseif a:filetype == "hercules" elseif a:filetype == "hercules"
call s:MapDelimitersWithAlternative('//','', '/*','*/') call s:MapDelimitersWithAlternative('//','', '/*','*/')
elseif a:filetype == "hog" elseif a:filetype == "hog"
call s:MapDelimiters('#', '') call s:MapDelimiters('#', '')
elseif a:filetype == "hostsaccess"
call s:MapDelimiters('#', '')
elseif a:filetype == "html" elseif a:filetype == "html"
call s:MapDelimitersWithAlternative('<!--','-->', '//', '') call s:MapDelimitersWithAlternative('<!--','-->', '//', '')
elseif a:filetype == "htmldjango" elseif a:filetype == "htmldjango"
@@ -452,6 +467,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
call s:MapDelimitersWithAlternative(';','', '#|', '|#') call s:MapDelimitersWithAlternative(';','', '#|', '|#')
elseif a:filetype == "lite" elseif a:filetype == "lite"
call s:MapDelimiters('/*','*/') call s:MapDelimiters('/*','*/')
elseif a:filetype == "llvm"
call s:MapDelimiters(';','')
elseif a:filetype == "lookupfile" elseif a:filetype == "lookupfile"
call s:MapDelimiters('', '') call s:MapDelimiters('', '')
elseif a:filetype == "lotos" elseif a:filetype == "lotos"
@@ -474,14 +491,24 @@ function s:SetUpForNewFiletype(filetype, forceReset)
call s:MapDelimiters('dnl ', '') call s:MapDelimiters('dnl ', '')
elseif a:filetype == "mail" elseif a:filetype == "mail"
call s:MapDelimiters('> ','') call s:MapDelimiters('> ','')
elseif a:filetype == "mailcap"
call s:MapDelimiters('#','')
elseif a:filetype == "make" elseif a:filetype == "make"
call s:MapDelimiters('#','') call s:MapDelimiters('#','')
elseif a:filetype == "mako"
call s:MapDelimiters('##', '')
elseif a:filetype == "man"
call s:MapDelimiters('."', '')
elseif a:filetype == "map"
call s:MapDelimiters('%', '')
elseif a:filetype == "maple" elseif a:filetype == "maple"
call s:MapDelimiters('#', '') call s:MapDelimiters('#', '')
elseif a:filetype == "markdown" elseif a:filetype == "markdown"
call s:MapDelimiters('<!--', '-->') call s:MapDelimiters('<!--', '-->')
elseif a:filetype == "masm" elseif a:filetype == "masm"
call s:MapDelimiters(';', '') call s:MapDelimiters(';', '')
elseif a:filetype == "mason"
call s:MapDelimiters('<% #', '%>')
elseif a:filetype == "master" elseif a:filetype == "master"
call s:MapDelimiters('$', '') call s:MapDelimiters('$', '')
elseif a:filetype == "matlab" elseif a:filetype == "matlab"
@@ -526,10 +553,14 @@ function s:SetUpForNewFiletype(filetype, forceReset)
call s:MapDelimiters('/*', '') call s:MapDelimiters('/*', '')
elseif a:filetype == "ncf" elseif a:filetype == "ncf"
call s:MapDelimiters(';', '') call s:MapDelimiters(';', '')
elseif a:filetype == "nerdtree"
call s:MapDelimiters('', '')
elseif a:filetype == "netdict" elseif a:filetype == "netdict"
call s:MapDelimiters('', '') call s:MapDelimiters('', '')
elseif a:filetype == "netrw" elseif a:filetype == "netrw"
call s:MapDelimiters('', '') call s:MapDelimiters('', '')
elseif a:filetype == "newlisp"
call s:MapDelimiters(';','')
elseif a:filetype == "nqc" elseif a:filetype == "nqc"
call s:MapDelimiters('/*','*/') call s:MapDelimiters('/*','*/')
elseif a:filetype == "nroff" elseif a:filetype == "nroff"
@@ -540,6 +571,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
call s:MapDelimitersWithAlternative('//','', '/*','*/') call s:MapDelimitersWithAlternative('//','', '/*','*/')
elseif a:filetype == "objcpp" elseif a:filetype == "objcpp"
call s:MapDelimitersWithAlternative('//','', '/*','*/') call s:MapDelimitersWithAlternative('//','', '/*','*/')
elseif a:filetype == "objj"
call s:MapDelimitersWithAlternative('//','', '/*','*/')
elseif a:filetype == "ocaml" elseif a:filetype == "ocaml"
call s:MapDelimiters('(*','*)') call s:MapDelimiters('(*','*)')
elseif a:filetype == "occam" elseif a:filetype == "occam"
@@ -558,6 +591,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
call s:MapDelimiters('', '') call s:MapDelimiters('', '')
elseif a:filetype == "ox" elseif a:filetype == "ox"
call s:MapDelimiters('//', '') call s:MapDelimiters('//', '')
elseif a:filetype == "pamconf"
call s:MapDelimiters('#', '')
elseif a:filetype == "pascal" elseif a:filetype == "pascal"
call s:MapDelimitersWithAlternative('{','}', '(*', '*)') call s:MapDelimitersWithAlternative('{','}', '(*', '*)')
elseif a:filetype == "passwd" elseif a:filetype == "passwd"
@@ -594,6 +629,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
call s:MapDelimiters('#', '') call s:MapDelimiters('#', '')
elseif a:filetype == "postscr" elseif a:filetype == "postscr"
call s:MapDelimiters('%', '') call s:MapDelimiters('%', '')
elseif a:filetype == "potwiki"
call s:MapDelimiters('', '')
elseif a:filetype == "pov" elseif a:filetype == "pov"
call s:MapDelimitersWithAlternative('//','', '/*','*/') call s:MapDelimitersWithAlternative('//','', '/*','*/')
elseif a:filetype == "povini" elseif a:filetype == "povini"
@@ -602,12 +639,16 @@ function s:SetUpForNewFiletype(filetype, forceReset)
call s:MapDelimiters('%', '') call s:MapDelimiters('%', '')
elseif a:filetype == "ppwiz" elseif a:filetype == "ppwiz"
call s:MapDelimiters(';;', '') call s:MapDelimiters(';;', '')
elseif a:filetype == "processing"
call s:MapDelimitersWithAlternative('//','', '/*','*/')
elseif a:filetype == "procmail" elseif a:filetype == "procmail"
call s:MapDelimiters('#', '') call s:MapDelimiters('#', '')
elseif a:filetype == "progress" elseif a:filetype == "progress"
call s:MapDelimiters('/*','*/') call s:MapDelimiters('/*','*/')
elseif a:filetype == "prolog" elseif a:filetype == "prolog"
call s:MapDelimitersWithAlternative('%','','/*','*/') call s:MapDelimitersWithAlternative('%','','/*','*/')
elseif a:filetype == "ps1"
call s:MapDelimiters('#', '')
elseif a:filetype == "psf" elseif a:filetype == "psf"
call s:MapDelimiters('#', '') call s:MapDelimiters('#', '')
elseif a:filetype == "ptcap" elseif a:filetype == "ptcap"
@@ -686,6 +727,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
call s:MapDelimiters('<!--','-->') call s:MapDelimiters('<!--','-->')
elseif a:filetype == "sicad" elseif a:filetype == "sicad"
call s:MapDelimiters('*', '') call s:MapDelimiters('*', '')
elseif a:filetype == "sieve"
call s:MapDelimiters('#', '')
elseif a:filetype == "simula" elseif a:filetype == "simula"
call s:MapDelimitersWithAlternative('%', '', '--', '') call s:MapDelimitersWithAlternative('%', '', '--', '')
elseif a:filetype == "sinda" elseif a:filetype == "sinda"
@@ -738,6 +781,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
call s:MapDelimiters('#', '') call s:MapDelimiters('#', '')
elseif a:filetype == "st" elseif a:filetype == "st"
call s:MapDelimiters('"','') call s:MapDelimiters('"','')
elseif a:filetype == "stata"
call s:MapDelimiters('/*','*/')
elseif a:filetype == "stp" elseif a:filetype == "stp"
call s:MapDelimiters('--', '') call s:MapDelimiters('--', '')
elseif a:filetype == "strace" elseif a:filetype == "strace"
@@ -748,12 +793,18 @@ function s:SetUpForNewFiletype(filetype, forceReset)
call s:MapDelimiters('','') call s:MapDelimiters('','')
elseif a:filetype == "svn" elseif a:filetype == "svn"
call s:MapDelimiters('','') call s:MapDelimiters('','')
elseif a:filetype == "SVNannotate"
call s:MapDelimiters('','')
elseif a:filetype == "SVNAnnotate" elseif a:filetype == "SVNAnnotate"
call s:MapDelimiters('','') call s:MapDelimiters('','')
elseif a:filetype == "SVNcommit"
call s:MapDelimiters('','')
elseif a:filetype == "SVNcommitlog" elseif a:filetype == "SVNcommitlog"
call s:MapDelimiters('','') call s:MapDelimiters('','')
elseif a:filetype == "SVNdiff" elseif a:filetype == "SVNdiff"
call s:MapDelimiters('','') call s:MapDelimiters('','')
elseif a:filetype == "SVNinfo"
call s:MapDelimiters('','')
elseif a:filetype == "systemverilog" elseif a:filetype == "systemverilog"
call s:MapDelimitersWithAlternative('//','', '/*','*/') call s:MapDelimitersWithAlternative('//','', '/*','*/')
elseif a:filetype == "tads" elseif a:filetype == "tads"
@@ -764,6 +815,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
call s:MapDelimiters(';', '') call s:MapDelimiters(';', '')
elseif a:filetype == "tak" elseif a:filetype == "tak"
call s:MapDelimiters('$', '') call s:MapDelimiters('$', '')
elseif a:filetype == "tar"
call s:MapDelimiters('', '')
elseif a:filetype == "tasm" elseif a:filetype == "tasm"
call s:MapDelimiters(';', '') call s:MapDelimiters(';', '')
elseif a:filetype == "tcl" elseif a:filetype == "tcl"
@@ -792,6 +845,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
call s:MapDelimiters('#', '') call s:MapDelimiters('#', '')
elseif a:filetype == "tssgm" elseif a:filetype == "tssgm"
call s:MapDelimiters("comment = '","'") call s:MapDelimiters("comment = '","'")
elseif a:filetype == "txt2tags"
call s:MapDelimiters('%','')
elseif a:filetype == "uc" elseif a:filetype == "uc"
call s:MapDelimitersWithAlternative('//','', '/*','*/') call s:MapDelimitersWithAlternative('//','', '/*','*/')
elseif a:filetype == "uil" elseif a:filetype == "uil"
@@ -866,6 +921,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
call s:MapDelimiters('/*','*/') call s:MapDelimiters('/*','*/')
elseif a:filetype == "yaml" elseif a:filetype == "yaml"
call s:MapDelimiters('#','') call s:MapDelimiters('#','')
elseif a:filetype == "xquery"
call s:MapDelimiters('(:',':)')
elseif a:filetype == "z8a" elseif a:filetype == "z8a"
call s:MapDelimiters(';', '') call s:MapDelimiters(';', '')
@@ -979,13 +1036,13 @@ function s:AppendCommentToLine()
"stick the delimiters down at the end of the line. We have to format the "stick the delimiters down at the end of the line. We have to format the
"comment with spaces as appropriate "comment with spaces as appropriate
execute ":normal " . insOrApp . (isLineEmpty ? '' : ' ') . left . right . " " execute ":normal! " . insOrApp . (isLineEmpty ? '' : ' ') . left . right . " "
" if there is a right delimiter then we gotta move the cursor left " if there is a right delimiter then we gotta move the cursor left
" by the len of the right delimiter so we insert between the delimiters " by the len of the right delimiter so we insert between the delimiters
if lenRight > 0 if lenRight > 0
let leftMoveAmount = lenRight let leftMoveAmount = lenRight
execute ":normal " . leftMoveAmount . "h" execute ":normal! " . leftMoveAmount . "h"
endif endif
startinsert startinsert
endfunction endfunction
@@ -1126,10 +1183,9 @@ endfunction
" Args: " Args:
" -forceNested: a flag indicating whether the called is requesting the comment " -forceNested: a flag indicating whether the called is requesting the comment
" to be nested if need be " to be nested if need be
" -alignRight/alignLeft: 0/1 if the comments delimiters should/shouldnt be " -align: should be "left" or "both" or "none"
" aligned left/right
" -firstLine/lastLine: the top and bottom lines to comment " -firstLine/lastLine: the top and bottom lines to comment
function s:CommentLines(forceNested, alignLeft, alignRight, firstLine, lastLine) function s:CommentLines(forceNested, align, firstLine, lastLine)
" we need to get the left and right indexes of the leftmost char in the " we need to get the left and right indexes of the leftmost char in the
" block of of lines and the right most char so that we can do alignment of " block of of lines and the right most char so that we can do alignment of
" the delimiters if the user has specified " the delimiters if the user has specified
@@ -1161,12 +1217,12 @@ function s:CommentLines(forceNested, alignLeft, alignRight, firstLine, lastLine)
" check if we can comment this line " check if we can comment this line
if !isCommented || g:NERDUsePlaceHolders || s:Multipart() if !isCommented || g:NERDUsePlaceHolders || s:Multipart()
if a:alignLeft if a:align == "left" || a:align == "both"
let theLine = s:AddLeftDelimAligned(s:GetLeft(0,1,0), theLine, leftAlignIndx) let theLine = s:AddLeftDelimAligned(s:GetLeft(0,1,0), theLine, leftAlignIndx)
else else
let theLine = s:AddLeftDelim(s:GetLeft(0,1,0), theLine) let theLine = s:AddLeftDelim(s:GetLeft(0,1,0), theLine)
endif endif
if a:alignRight if a:align == "both"
let theLine = s:AddRightDelimAligned(s:GetRight(0,1,0), theLine, rightAlignIndx) let theLine = s:AddRightDelimAligned(s:GetRight(0,1,0), theLine, rightAlignIndx)
else else
let theLine = s:AddRightDelim(s:GetRight(0,1,0), theLine) let theLine = s:AddRightDelim(s:GetRight(0,1,0), theLine)
@@ -1415,7 +1471,7 @@ function s:CommentRegion(topLine, topCol, bottomLine, bottomCol, forceNested)
let topOfRange = a:topLine+1 let topOfRange = a:topLine+1
let bottomOfRange = a:bottomLine-1 let bottomOfRange = a:bottomLine-1
if topOfRange <= bottomOfRange if topOfRange <= bottomOfRange
call s:CommentLines(a:forceNested, 0, 0, topOfRange, bottomOfRange) call s:CommentLines(a:forceNested, "none", topOfRange, bottomOfRange)
endif endif
"comment the bottom line "comment the bottom line
@@ -1473,15 +1529,15 @@ function s:InvertComment(firstLine, lastLine)
endwhile endwhile
endfunction endfunction
" Function: NERDComment(isVisual, alignLeft, alignRight, type) function {{{2 " Function: NERDComment(isVisual, type) function {{{2
" This function is a Wrapper for the main commenting functions " This function is a Wrapper for the main commenting functions
" "
" Args: " Args:
" -isVisual: a flag indicating whether the comment is requested in visual " -isVisual: a flag indicating whether the comment is requested in visual
" mode or not " mode or not
" -type: the type of commenting requested. Can be 'sexy', 'invert', " -type: the type of commenting requested. Can be 'sexy', 'invert',
" 'minimal', 'toggle', 'alignLeft', 'alignRight', 'alignBoth', 'norm', " 'minimal', 'toggle', 'alignLeft', 'alignBoth', 'norm',
" 'nested', 'toEOL', 'prepend', 'append', 'insert', 'uncomment', 'yank' " 'nested', 'toEOL', 'append', 'insert', 'uncomment', 'yank'
function! NERDComment(isVisual, type) range function! NERDComment(isVisual, type) range
" we want case sensitivity when commenting " we want case sensitivity when commenting
let oldIgnoreCase = &ignorecase let oldIgnoreCase = &ignorecase
@@ -1507,13 +1563,17 @@ function! NERDComment(isVisual, type) range
elseif a:isVisual && visualmode() == "v" && (g:NERDCommentWholeLinesInVMode==0 || (g:NERDCommentWholeLinesInVMode==2 && s:HasMultipartDelims())) elseif a:isVisual && visualmode() == "v" && (g:NERDCommentWholeLinesInVMode==0 || (g:NERDCommentWholeLinesInVMode==2 && s:HasMultipartDelims()))
call s:CommentRegion(firstLine, firstCol, lastLine, lastCol, forceNested) call s:CommentRegion(firstLine, firstCol, lastLine, lastCol, forceNested)
else else
call s:CommentLines(forceNested, 0, 0, firstLine, lastLine) call s:CommentLines(forceNested, "none", firstLine, lastLine)
endif endif
elseif a:type == 'alignLeft' || a:type == 'alignRight' || a:type == 'alignBoth' elseif a:type == 'alignLeft' || a:type == 'alignBoth'
let alignLeft = (a:type == 'alignLeft' || a:type == 'alignBoth') let align = "none"
let alignRight = (a:type == 'alignRight' || a:type == 'alignBoth') if a:type == "alignLeft"
call s:CommentLines(forceNested, alignLeft, alignRight, firstLine, lastLine) let align = "left"
elseif a:type == "alignBoth"
let align = "both"
endif
call s:CommentLines(forceNested, align, firstLine, lastLine)
elseif a:type == 'invert' elseif a:type == 'invert'
call s:InvertComment(firstLine, lastLine) call s:InvertComment(firstLine, lastLine)
@@ -1522,7 +1582,7 @@ function! NERDComment(isVisual, type) range
try try
call s:CommentLinesSexy(firstLine, lastLine) call s:CommentLinesSexy(firstLine, lastLine)
catch /NERDCommenter.Delimiters/ catch /NERDCommenter.Delimiters/
call s:CommentLines(forceNested, 0, 0, firstLine, lastLine) call s:CommentLines(forceNested, "none", firstLine, lastLine)
catch /NERDCommenter.Nesting/ catch /NERDCommenter.Nesting/
call s:NerdEcho("Sexy comment aborted. Nested sexy cannot be nested", 0) call s:NerdEcho("Sexy comment aborted. Nested sexy cannot be nested", 0)
endtry endtry
@@ -1550,9 +1610,6 @@ function! NERDComment(isVisual, type) range
call s:CommentBlock(firstLine, firstLine, col("."), col("$")-1, 1) call s:CommentBlock(firstLine, firstLine, col("."), col("$")-1, 1)
call s:RestoreScreenState() call s:RestoreScreenState()
elseif a:type == 'prepend'
call s:PrependCommentToLine()
elseif a:type == 'append' elseif a:type == 'append'
call s:AppendCommentToLine() call s:AppendCommentToLine()
@@ -1564,11 +1621,11 @@ function! NERDComment(isVisual, type) range
elseif a:type == 'yank' elseif a:type == 'yank'
if a:isVisual if a:isVisual
normal gvy normal! gvy
elseif countWasGiven elseif countWasGiven
execute firstLine .','. lastLine .'yank' execute firstLine .','. lastLine .'yank'
else else
normal Y normal! yy
endif endif
execute firstLine .','. lastLine .'call NERDComment('. a:isVisual .', "norm")' execute firstLine .','. lastLine .'call NERDComment('. a:isVisual .', "norm")'
endif endif
@@ -1605,19 +1662,19 @@ function s:PlaceDelimitersAndInsBetween()
" place the delimiters down. We do it differently depending on whether " place the delimiters down. We do it differently depending on whether
" there is a left AND right delimiter " there is a left AND right delimiter
if lenRight > 0 if lenRight > 0
execute ":normal " . insOrApp . left . right execute ":normal! " . insOrApp . left . right
execute ":normal " . lenRight . "h" execute ":normal! " . lenRight . "h"
else else
execute ":normal " . insOrApp . left execute ":normal! " . insOrApp . left
" if we are tacking the delim on the EOL then we gotta add a space " if we are tacking the delim on the EOL then we gotta add a space
" after it cos when we go out of insert mode the cursor will move back " after it cos when we go out of insert mode the cursor will move back
" one and the user wont be in position to type the comment. " one and the user wont be in position to type the comment.
if isDelimOnEOL if isDelimOnEOL
execute 'normal a ' execute 'normal! a '
endif endif
endif endif
normal l normal! l
"if needed convert spaces back to tabs and adjust the cursors col "if needed convert spaces back to tabs and adjust the cursors col
"accordingly "accordingly
@@ -1630,46 +1687,6 @@ function s:PlaceDelimitersAndInsBetween()
startinsert startinsert
endfunction endfunction
" Function: s:PrependCommentToLine(){{{2
" This function prepends comment delimiters to the start of line and places
" the cursor in position to start typing the comment
function s:PrependCommentToLine()
" get the left and right delimiters without any escape chars in them
let left = s:GetLeft(0, 1, 0)
let right = s:GetRight(0, 1, 0)
" get the len of the right delim
let lenRight = strlen(right)
"if the line is empty then we need to know about this later on
let isLineEmpty = strlen(getline(".")) == 0
"stick the delimiters down at the start of the line. We have to format the
"comment with spaces as appropriate
if lenRight > 0
execute ":normal I" . left . right
else
execute ":normal I" . left
endif
" if there is a right delimiter then we gotta move the cursor left
" by the len of the right delimiter so we insert between the delimiters
if lenRight > 0
let leftMoveAmount = lenRight
execute ":normal " . leftMoveAmount . "h"
endif
normal l
"if the line was empty then we gotta add an extra space on the end because
"the cursor will move back one more at the end of the last "execute"
"command
if isLineEmpty && lenRight == 0
execute ":normal a "
endif
startinsert
endfunction
" Function: s:RemoveDelimiters(left, right, line) {{{2 " Function: s:RemoveDelimiters(left, right, line) {{{2
" this function is called to remove the first left comment delimiter and the " this function is called to remove the first left comment delimiter and the
" last right delimiter of the given line. " last right delimiter of the given line.
@@ -1826,7 +1843,7 @@ function s:UncommentLinesSexy(topline, bottomline)
" if the first line contains only the left delim then just delete it " if the first line contains only the left delim then just delete it
if theLine =~ '^[ \t]*' . left . '[ \t]*$' && !g:NERDCompactSexyComs if theLine =~ '^[ \t]*' . left . '[ \t]*$' && !g:NERDCompactSexyComs
call cursor(a:topline, 1) call cursor(a:topline, 1)
normal dd normal! dd
let bottomline = bottomline - 1 let bottomline = bottomline - 1
" topline contains more than just the left delim " topline contains more than just the left delim
@@ -1850,7 +1867,7 @@ function s:UncommentLinesSexy(topline, bottomline)
" if the bottomline contains only the right delim then just delete it " if the bottomline contains only the right delim then just delete it
if theLine =~ '^[ \t]*' . right . '[ \t]*$' if theLine =~ '^[ \t]*' . right . '[ \t]*$'
call cursor(bottomline, 1) call cursor(bottomline, 1)
normal dd normal! dd
" the last line contains more than the right delim " the last line contains more than the right delim
else else
@@ -3063,7 +3080,7 @@ function s:RestoreScreenState()
endif endif
call cursor(t:NERDComOldTopLine, 0) call cursor(t:NERDComOldTopLine, 0)
normal zt normal! zt
call setpos(".", t:NERDComOldPos) call setpos(".", t:NERDComOldPos)
endfunction endfunction
@@ -3207,67 +3224,90 @@ function s:UntabbedCol(line, col)
endfunction endfunction
" Section: Comment mapping setup {{{1 " Section: Comment mapping setup {{{1
" =========================================================================== " ===========================================================================
" This is where the mappings calls are made that set up the commenting key
" mappings.
" set up the mapping to switch to/from alternative delimiters " switch to/from alternative delimiters
execute 'nnoremap <silent>' . g:NERDAltComMap . ' :call <SID>SwitchToAlternativeDelimiters(1)<cr>' nnoremap <plug>NERDCommenterAltDelims :call <SID>SwitchToAlternativeDelimiters(1)<cr>
" set up the mappings to comment out lines " comment out lines
execute 'nnoremap <silent>' . g:NERDComLineMap . ' :call NERDComment(0, "norm")<cr>' nnoremap <silent> <plug>NERDCommenterComment :call NERDComment(0, "norm")<cr>
execute 'vnoremap <silent>' . g:NERDComLineMap . ' <ESC>:call NERDComment(1, "norm")<cr>' vnoremap <silent> <plug>NERDCommenterComment <ESC>:call NERDComment(1, "norm")<cr>
" set up the mappings to do toggle comments " toggle comments
execute 'nnoremap <silent>' . g:NERDComLineToggleMap . ' :call NERDComment(0, "toggle")<cr>' nnoremap <silent> <plug>NERDCommenterToggle :call NERDComment(0, "toggle")<cr>
execute 'vnoremap <silent>' . g:NERDComLineToggleMap . ' <ESC>:call NERDComment(1, "toggle")<cr>' vnoremap <silent> <plug>NERDCommenterToggle <ESC>:call NERDComment(1, "toggle")<cr>
" set up the mapp to do minimal comments " minimal comments
execute 'nnoremap <silent>' . g:NERDComLineMinimalMap . ' :call NERDComment(0, "minimal")<cr>' nnoremap <silent> <plug>NERDCommenterMinimal :call NERDComment(0, "minimal")<cr>
execute 'vnoremap <silent>' . g:NERDComLineMinimalMap . ' <ESC>:call NERDComment(1, "minimal")<cr>' vnoremap <silent> <plug>NERDCommenterMinimal <ESC>:call NERDComment(1, "minimal")<cr>
" set up the mappings to comment out lines sexily " sexy comments
execute 'nnoremap <silent>' . g:NERDComLineSexyMap . ' :call NERDComment(0, "sexy")<CR>' nnoremap <silent> <plug>NERDCommenterSexy :call NERDComment(0, "sexy")<CR>
execute 'vnoremap <silent>' . g:NERDComLineSexyMap . ' <ESC>:call NERDComment(1, "sexy")<CR>' vnoremap <silent> <plug>NERDCommenterSexy <ESC>:call NERDComment(1, "sexy")<CR>
" set up the mappings to do invert comments " invert comments
execute 'nnoremap <silent>' . g:NERDComLineInvertMap . ' :call NERDComment(0, "invert")<CR>' nnoremap <silent> <plug>NERDCommenterInvert :call NERDComment(0, "invert")<CR>
execute 'vnoremap <silent>' . g:NERDComLineInvertMap . ' <ESC>:call NERDComment(1, "invert")<CR>' vnoremap <silent> <plug>NERDCommenterInvert <ESC>:call NERDComment(1, "invert")<CR>
" set up the mappings to yank then comment out lines " yank then comment
execute 'nmap <silent>' . g:NERDComLineYankMap . ' :call NERDComment(0, "yank")<CR>' nmap <silent> <plug>NERDCommenterYank :call NERDComment(0, "yank")<CR>
execute 'vmap <silent>' . g:NERDComLineYankMap . ' <ESC>:call NERDComment(1, "yank")<CR>' vmap <silent> <plug>NERDCommenterYank <ESC>:call NERDComment(1, "yank")<CR>
" set up the mappings for left aligned comments " left aligned comments
execute 'nnoremap <silent>' . g:NERDComAlignLeftMap . ' :call NERDComment(0, "alignLeft")<cr>' nnoremap <silent> <plug>NERDCommenterAlignLeft :call NERDComment(0, "alignLeft")<cr>
execute 'vnoremap <silent>' . g:NERDComAlignLeftMap . ' <ESC>:call NERDComment(1, "alignLeft")<cr>' vnoremap <silent> <plug>NERDCommenterAlignLeft <ESC>:call NERDComment(1, "alignLeft")<cr>
" set up the mappings for right aligned comments " left and right aligned comments
execute 'nnoremap <silent>' . g:NERDComAlignRightMap . ' :call NERDComment(0, "alignRight")<cr>' nnoremap <silent> <plug>NERDCommenterAlignBoth :call NERDComment(0, "alignBoth")<cr>
execute 'vnoremap <silent>' . g:NERDComAlignRightMap . ' <ESC>:call NERDComment(1, "alignRight")<cr>' vnoremap <silent> <plug>NERDCommenterAlignBoth <ESC>:call NERDComment(1, "alignBoth")<cr>
" set up the mappings for left and right aligned comments " nested comments
execute 'nnoremap <silent>' . g:NERDComAlignBothMap . ' :call NERDComment(0, "alignBoth")<cr>' nnoremap <silent> <plug>NERDCommenterNest :call NERDComment(0, "nested")<cr>
execute 'vnoremap <silent>' . g:NERDComAlignBothMap . ' <ESC>:call NERDComment(1, "alignBoth")<cr>' vnoremap <silent> <plug>NERDCommenterNest <ESC>:call NERDComment(1, "nested")<cr>
" set up the mappings to do nested comments " uncomment
execute 'nnoremap <silent>' . g:NERDComLineNestMap . ' :call NERDComment(0, "nested")<cr>' nnoremap <silent> <plug>NERDCommenterUncomment :call NERDComment(0, "uncomment")<cr>
execute 'vnoremap <silent>' . g:NERDComLineNestMap . ' <ESC>:call NERDComment(1, "nested")<cr>' vnoremap <silent> <plug>NERDCommenterUncomment :call NERDComment(1, "uncomment")<cr>
" set up the mapping to uncomment a line " comment till the end of the line
execute 'nnoremap <silent>' . g:NERDUncomLineMap . ' :call NERDComment(0, "uncomment")<cr>' nnoremap <silent> <plug>NERDCommenterToEOL :call NERDComment(0, "toEOL")<cr>
execute 'vnoremap <silent>' . g:NERDUncomLineMap . ' :call NERDComment(1, "uncomment")<cr>'
" set up the mapping to comment out to the end of the line " append comments
execute 'nnoremap <silent>' . g:NERDComToEOLMap . ' :call NERDComment(0, "toEOL")<cr>' nmap <silent> <plug>NERDCommenterAppend :call NERDComment(0, "append")<cr>
" set up the mappings to append comments to the line " insert comments
execute 'nmap <silent>' . g:NERDAppendComMap . ' :call NERDComment(0, "append")<cr>' inoremap <silent> <plug>NERDCommenterInInsert <SPACE><BS><ESC>:call NERDComment(0, "insert")<CR>
function! s:CreateMaps(target, combo)
if !hasmapto(a:target, 'n')
exec 'nmap ' . a:combo . ' ' . a:target
endif
if !hasmapto(a:target, 'v')
exec 'vmap ' . a:combo . ' ' . a:target
endif
endfunction
if g:NERDCreateDefaultMappings
call s:CreateMaps('<plug>NERDCommenterComment', ',cc')
call s:CreateMaps('<plug>NERDCommenterToggle', ',c<space>')
call s:CreateMaps('<plug>NERDCommenterMinimal', ',cm')
call s:CreateMaps('<plug>NERDCommenterSexy', ',cs')
call s:CreateMaps('<plug>NERDCommenterInvert', ',ci')
call s:CreateMaps('<plug>NERDCommenterYank', ',cy')
call s:CreateMaps('<plug>NERDCommenterAlignLeft', ',cl')
call s:CreateMaps('<plug>NERDCommenterAlignBoth', ',cb')
call s:CreateMaps('<plug>NERDCommenterNest', ',cn')
call s:CreateMaps('<plug>NERDCommenterUncomment', ',cu')
call s:CreateMaps('<plug>NERDCommenterToEOL', ',c$')
call s:CreateMaps('<plug>NERDCommenterAppend', ',cA')
if !hasmapto('<plug>NERDCommenterAltDelims', 'n')
nmap ,ca <plug>NERDCommenterAltDelims
endif
endif
" set up the mappings to append comments to the line
execute 'nmap <silent>' . g:NERDPrependComMap . ' :call NERDComment(0, "prepend")<cr>'
" set up the mapping to insert comment delims at the cursor position in insert mode
execute 'inoremap <silent>' . g:NERDComInInsertMap . ' ' . '<SPACE><BS><ESC>:call NERDComment(0, "insert")<CR>'
" Section: Menu item setup {{{1 " Section: Menu item setup {{{1
" =========================================================================== " ===========================================================================
@@ -3283,57 +3323,27 @@ if g:NERDMenuMode != 0
let menuRoot = '&Plugin.&comment' let menuRoot = '&Plugin.&comment'
endif endif
execute 'nmenu <silent> '. menuRoot .'.Comment<TAB>' . escape(g:NERDComLineMap, '\') . ' :call NERDComment(0, "norm")<CR>' function! s:CreateMenuItems(target, desc, root)
execute 'vmenu <silent> '. menuRoot .'.Comment<TAB>' . escape(g:NERDComLineMap, '\') . ' <ESC>:call NERDComment(1, "norm")<CR>' exec 'nmenu <silent> ' . a:root . '.' . a:desc . ' ' . a:target
exec 'vmenu <silent> ' . a:root . '.' . a:desc . ' ' . a:target
execute 'nmenu <silent> '. menuRoot .'.Comment\ Toggle<TAB>' . escape(g:NERDComLineToggleMap, '\') . ' :call NERDComment(0, "toggle")<CR>' endfunction
execute 'vmenu <silent> '. menuRoot .'.Comment\ Toggle<TAB>' . escape(g:NERDComLineToggleMap, '\') . ' <ESC>:call NERDComment(1, "toggle")<CR>' call s:CreateMenuItems("<plug>NERDCommenterComment", 'Comment', menuRoot)
call s:CreateMenuItems("<plug>NERDCommenterToggle", 'Toggle', menuRoot)
execute 'nmenu <silent> '. menuRoot .'.Comment\ Minimal<TAB>' . escape(g:NERDComLineMinimalMap, '\') . ' :call NERDComment(0, "minimal")<CR>' call s:CreateMenuItems('<plug>NERDCommenterMinimal', 'Minimal', menuRoot)
execute 'vmenu <silent> '. menuRoot .'.Comment\ Minimal<TAB>' . escape(g:NERDComLineMinimalMap, '\') . ' <ESC>:call NERDComment(1, "minimal")<CR>' call s:CreateMenuItems('<plug>NERDCommenterNest', 'Nested', menuRoot)
exec 'nmenu <silent> '. menuRoot .'.To\ EOL <plug>NERDCommenterToEOL'
execute 'nmenu <silent> '. menuRoot .'.Comment\ Nested<TAB>' . escape(g:NERDComLineNestMap, '\') . ' :call NERDComment(0, "nested")<CR>' call s:CreateMenuItems('<plug>NERDCommenterInvert', 'Invert', menuRoot)
execute 'vmenu <silent> '. menuRoot .'.Comment\ Nested<TAB>' . escape(g:NERDComLineNestMap, '\') . ' <ESC>:call NERDComment(1, "nested")<CR>' call s:CreateMenuItems('<plug>NERDCommenterSexy', 'Sexy', menuRoot)
call s:CreateMenuItems('<plug>NERDCommenterYank', 'Yank\ then\ comment', menuRoot)
execute 'nmenu <silent> '. menuRoot .'.Comment\ To\ EOL<TAB>' . escape(g:NERDComToEOLMap, '\') . ' :call NERDComment(0, "toEOL")<cr>' exec 'nmenu <silent> '. menuRoot .'.Append <plug>NERDCommenterAppend'
exec 'menu <silent> '. menuRoot .'.-Sep- :'
execute 'nmenu <silent> '. menuRoot .'.Comment\ Invert<TAB>' . escape(g:NERDComLineInvertMap, '\') . ' :call NERDComment(0,"invert")<CR>' call s:CreateMenuItems('<plug>NERDCommenterAlignLeft', 'Left\ aligned', menuRoot)
execute 'vmenu <silent> '. menuRoot .'.Comment\ Invert<TAB>' . escape(g:NERDComLineInvertMap, '\') . ' <ESC>:call NERDComment(1,"invert")<CR>' call s:CreateMenuItems('<plug>NERDCommenterAlignBoth', 'Left\ and\ right\ aligned', menuRoot)
exec 'menu <silent> '. menuRoot .'.-Sep2- :'
execute 'nmenu <silent> '. menuRoot .'.Comment\ Sexily<TAB>' . escape(g:NERDComLineSexyMap, '\') . ' :call NERDComment(0,"sexy")<CR>' call s:CreateMenuItems('<plug>NERDCommenterUncomment', 'Uncomment', menuRoot)
execute 'vmenu <silent> '. menuRoot .'.Comment\ Sexily<TAB>' . escape(g:NERDComLineSexyMap, '\') . ' <ESC>:call NERDComment(1,"sexy")<CR>' exec 'nmenu <silent> '. menuRoot .'.Switch\ Delimiters <plug>NERDCommenterAltDelims'
exec 'imenu <silent> '. menuRoot .'.Insert\ Comment\ Here <plug>NERDCommenterInInsert'
execute 'nmenu <silent> '. menuRoot .'.Yank\ line(s)\ then\ comment<TAB>' . escape(g:NERDComLineYankMap, '\') . ' "0Y' . g:NERDComLineMap exec 'menu <silent> '. menuRoot .'.-Sep3- :'
execute 'vmenu <silent> '. menuRoot .'.Yank\ line(s)\ then\ comment<TAB>' . escape(g:NERDComLineYankMap, '\') . ' "0ygv' . g:NERDComLineMap exec 'menu <silent>'. menuRoot .'.Help :help NERDCommenterContents<CR>'
execute 'nmenu <silent> '. menuRoot .'.Append\ Comment\ to\ Line<TAB>' . escape(g:NERDAppendComMap, '\') . ' :call NERDComment(0, "append")<cr>'
execute 'nmenu <silent> '. menuRoot .'.Prepend\ Comment\ to\ Line<TAB>' . escape(g:NERDPrependComMap, '\') . ' :call NERDComment(0, "prepend")<cr>'
execute 'menu <silent> '. menuRoot .'.-Sep- :'
execute 'nmenu <silent> '. menuRoot .'.Comment\ Align\ Left\ (nested)<TAB>' . escape(g:NERDComAlignLeftMap, '\') . ' :call NERDComment(0, "alignLeft")<CR>'
execute 'vmenu <silent> '. menuRoot .'.Comment\ Align\ Left\ (nested)<TAB>' . escape(g:NERDComAlignLeftMap, '\') . ' <ESC>:call NERDComment(1, "alignLeft")<CR>'
execute 'nmenu <silent> '. menuRoot .'.Comment\ Align\ Right\ (nested)<TAB>' . escape(g:NERDComAlignRightMap, '\') . ' :call NERDComment(0, "alignRight")<CR>'
execute 'vmenu <silent> '. menuRoot .'.Comment\ Align\ Right\ (nested)<TAB>' . escape(g:NERDComAlignRightMap, '\') . ' <ESC>:call NERDComment(1, "alignRight")<CR>'
execute 'nmenu <silent> '. menuRoot .'.Comment\ Align\ Both\ (nested)<TAB>' . escape(g:NERDComAlignBothMap, '\') . ' :call NERDComment(0, "alignBoth")<CR>'
execute 'vmenu <silent> '. menuRoot .'.Comment\ Align\ Both\ (nested)<TAB>' . escape(g:NERDComAlignBothMap, '\') . ' <ESC>:call NERDComment(1, "alignBoth")<CR>'
execute 'menu <silent> '. menuRoot .'.-Sep2- :'
execute 'menu <silent> '. menuRoot .'.Uncomment<TAB>' . escape(g:NERDUncomLineMap, '\') . ' :call NERDComment(0, "uncomment")<cr>'
execute 'vmenu <silent>' . menuRoot.'.Uncomment<TAB>' . escape(g:NERDUncomLineMap, '\') . ' <esc>:call NERDComment(1, "uncomment")<cr>'
execute 'menu <silent> '. menuRoot .'.-Sep3- :'
execute 'nmenu <silent> '. menuRoot .'.Use\ Alternative\ Delimiters<TAB>' . escape(g:NERDAltComMap, '\') . ' :call <SID>SwitchToAlternativeDelimiters(1)<CR>'
execute 'imenu <silent> '. menuRoot .'.Insert\ Delims<TAB>' . escape(g:NERDComInInsertMap, '\') . ' <SPACE><BS><ESC>:call NERDComment(0, "insert")<CR>'
execute 'menu '. menuRoot .'.-Sep4- :'
execute 'menu <silent>'. menuRoot .'.Help<TAB>:help\ NERDCommenterContents :help NERDCommenterContents<CR>'
endif endif
" vim: set foldmethod=marker : " vim: set foldmethod=marker :