mirror of
https://github.com/preservim/nerdcommenter.git
synced 2025-11-08 09:53:47 -05:00
Compare commits
93 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ee14557c87 | ||
|
|
8098fea8d9 | ||
|
|
7e3f47ed8d | ||
|
|
06683e3311 | ||
|
|
dda8510e0c | ||
|
|
a0003bc926 | ||
|
|
ca94c70dba | ||
|
|
44b4c26b86 | ||
|
|
5d8bb28113 | ||
|
|
f65d86fea3 | ||
|
|
1d92203107 | ||
|
|
fe73c80dc8 | ||
|
|
cc9f986514 | ||
|
|
03d9562db8 | ||
|
|
1301323179 | ||
|
|
842055ae43 | ||
|
|
68bf65fcd2 | ||
|
|
aaf2471da7 | ||
|
|
e14bdb0735 | ||
|
|
8dda3f17e0 | ||
|
|
ddd235757b | ||
|
|
d6ca231ac9 | ||
|
|
fe71371c15 | ||
|
|
226063bfc1 | ||
|
|
d6282ef7a3 | ||
|
|
c2a3f093ae | ||
|
|
b8c5a4443c | ||
|
|
6bf14ce062 | ||
|
|
e6a36fb8aa | ||
|
|
5bf567d75e | ||
|
|
1ae6bd4870 | ||
|
|
6835cfe090 | ||
|
|
b54d3bbc92 | ||
|
|
27e8727a35 | ||
|
|
e164c00246 | ||
|
|
134acc595e | ||
|
|
d3718d9d21 | ||
|
|
53558869a9 | ||
|
|
0370366572 | ||
|
|
a4453c01ee | ||
|
|
377a04eeec | ||
|
|
709d01d074 | ||
|
|
2e9b7ca58e | ||
|
|
01d6c8c7f6 | ||
|
|
89c008b644 | ||
|
|
1b9033c7ee | ||
|
|
165d1e3686 | ||
|
|
4567fae10f | ||
|
|
2ea675da5e | ||
|
|
865d928a1f | ||
|
|
8a0056a610 | ||
|
|
e466dd9418 | ||
|
|
a84365f174 | ||
|
|
1fc1decbe9 | ||
|
|
dc8275ffa0 | ||
|
|
64f0798984 | ||
|
|
01f8df684c | ||
|
|
7c830eb223 | ||
|
|
af0d51d8b3 | ||
|
|
650396b1fc | ||
|
|
cf54bfc7c4 | ||
|
|
6b2cc6c41d | ||
|
|
e52840527a | ||
|
|
dee2021b8f | ||
|
|
2da9787ff1 | ||
|
|
fef5db7e92 | ||
|
|
875831209a | ||
|
|
191bb50879 | ||
|
|
e92b6f60d5 | ||
|
|
3eea85daa4 | ||
|
|
62b394aa9b | ||
|
|
953fc19af9 | ||
|
|
ded4e80efe | ||
|
|
890ab3fe2e | ||
|
|
dd7a0bf471 | ||
|
|
4b0e7a8f1a | ||
|
|
c5623a31e2 | ||
|
|
06be251c66 | ||
|
|
3aeaa92dd7 | ||
|
|
4809a9c287 | ||
|
|
0256b0a18c | ||
|
|
148fe82c42 | ||
|
|
3eb5a0fcde | ||
|
|
f5092782ee | ||
|
|
75f5b5f275 | ||
|
|
ebe9dc2a38 | ||
|
|
f2fa62bd4f | ||
|
|
7ea2aeea99 | ||
|
|
065022b1ee | ||
|
|
3bccb91e7d | ||
|
|
a24c8b79f8 | ||
|
|
f8ce318000 | ||
|
|
f95255e299 |
@@ -23,11 +23,10 @@ CONTENTS *NERDCommenterContents*
|
||||
2.2.7 Yank comment map............|NERDComYankComment|
|
||||
2.2.8 Comment to EOL map..........|NERDComEOLComment|
|
||||
2.2.9 Append com to line map......|NERDComAppendComment|
|
||||
2.2.10 Prepend com to line map....|NERDComPrependComment|
|
||||
2.2.11 Insert comment map.........|NERDComInsertComment|
|
||||
2.2.12 Use alternate delims map...|NERDComAltDelim|
|
||||
2.2.13 Comment aligned maps.......|NERDComAlignedComment|
|
||||
2.2.14 Uncomment line map.........|NERDComUncommentLine|
|
||||
2.2.10 Insert comment map.........|NERDComInsertComment|
|
||||
2.2.11 Use alternate delims map...|NERDComAltDelim|
|
||||
2.2.12 Comment aligned maps.......|NERDComAlignedComment|
|
||||
2.2.13 Uncomment line map.........|NERDComUncommentLine|
|
||||
2.3 Supported filetypes...............|NERDComFiletypes|
|
||||
2.4 Sexy Comments.....................|NERDComSexyComments|
|
||||
2.5 The NERDComment function..........|NERDComNERDComment|
|
||||
@@ -35,24 +34,24 @@ CONTENTS *NERDCommenterContents*
|
||||
3.1 Options summary...................|NERDComOptionsSummary|
|
||||
3.2 Options details...................|NERDComOptionsDetails|
|
||||
3.3 Default delimiter Options.........|NERDComDefaultDelims|
|
||||
3.4 Key mapping Options...............|NERDComMappings|
|
||||
4.Issues with the script..................|NERDComIssues|
|
||||
4.1 Delimiter detection heuristics....|NERDComHeuristics|
|
||||
4.2 Nesting issues....................|NERDComNesting|
|
||||
5.The author..............................|NERDComAuthor|
|
||||
6.TODO list...............................|NERDComTodo|
|
||||
4. Customising key mappings...............|NERDComMappings|
|
||||
5. Issues with the script.................|NERDComIssues|
|
||||
5.1 Delimiter detection heuristics....|NERDComHeuristics|
|
||||
5.2 Nesting issues....................|NERDComNesting|
|
||||
6.The author..............................|NERDComAuthor|
|
||||
7.Changelog...............................|NERDComChangelog|
|
||||
8.Credits.................................|NERDComCredits|
|
||||
9.License.................................|NERDComLicense|
|
||||
|
||||
==============================================================================
|
||||
1. Intro *NERDCommenter*
|
||||
|
||||
The NERD commenter provides many different commenting operations and styles
|
||||
which may be invoked via key mappings and a commenting menu. These operations
|
||||
are available for most filetypes.
|
||||
which are invoked via key mappings and a menu. These operations are available
|
||||
for most filetypes.
|
||||
|
||||
There are also options available that allow you to tweak the commenting engine
|
||||
to you taste.
|
||||
There are also options that allow to tweak the commenting engine to your
|
||||
taste.
|
||||
|
||||
==============================================================================
|
||||
2. Functionality provided *NERDComFunctionality*
|
||||
@@ -61,17 +60,15 @@ to you taste.
|
||||
2.1 Functionality summary *NERDComFunctionalitySummary*
|
||||
|
||||
The following key mappings are provided by default (there is also a menu
|
||||
provided that contains menu items corresponding to all the below mappings):
|
||||
|
||||
Most of the following mappings are for normal/visual mode only. The
|
||||
|NERDComInsertComment| mapping is for insert mode only.
|
||||
with items corresponding to all the mappings below):
|
||||
|
||||
[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|
|
||||
Same as |NERDComComment| but forces nesting.
|
||||
Same as ,cc but forces nesting.
|
||||
|
||||
|
||||
[count],c<space> |NERDComToggleComment|
|
||||
Toggles the comment state of the selected line(s). If the topmost selected
|
||||
@@ -79,22 +76,19 @@ line is commented, all selected lines are uncommented and vice versa.
|
||||
|
||||
|
||||
[count],cm |NERDComMinimalComment|
|
||||
Comments the given lines using only one set of multipart delimiters if
|
||||
possible.
|
||||
Comments the given lines using only one set of multipart delimiters.
|
||||
|
||||
|
||||
[count],ci |NERDComInvertComment|
|
||||
Toggles the comment state of the selected line(s) individually. Each selected
|
||||
line that is commented is uncommented and vice versa.
|
||||
Toggles the comment state of the selected line(s) individually.
|
||||
|
||||
|
||||
[count],cs |NERDComSexyComment|
|
||||
Comments out the selected lines ``sexually''
|
||||
Comments out the selected lines ``sexily''
|
||||
|
||||
|
||||
[count],cy |NERDComYankComment|
|
||||
Same as |NERDComComment| except that the commented line(s) are yanked
|
||||
before commenting.
|
||||
Same as ,cc except that the commented line(s) are yanked first.
|
||||
|
||||
|
||||
,c$ |NERDComEOLComment|
|
||||
@@ -106,13 +100,9 @@ Adds comment delimiters to the end of line and goes into insert mode between
|
||||
them.
|
||||
|
||||
|
||||
,cI |NERDComPrependComment|
|
||||
Adds comment delimiters to the start of line and goes into insert mode between
|
||||
them.
|
||||
|
||||
|
||||
<C-c> |NERDComInsertComment|
|
||||
|NERDComInsertComment|
|
||||
Adds comment delimiters at the current cursor position and inserts between.
|
||||
Disabled by default.
|
||||
|
||||
|
||||
,ca |NERDComAltDelim|
|
||||
@@ -120,11 +110,9 @@ Switches to the alternative set of delimiters.
|
||||
|
||||
|
||||
[count],cl
|
||||
[count],cr
|
||||
[count],cb |NERDComAlignedComment|
|
||||
Same as |NERDComComment| except that the delimiters are aligned down the
|
||||
left side (,cl), the right side (,cr) or both sides
|
||||
(,cb).
|
||||
left side (,cl) or both sides (,cb).
|
||||
|
||||
|
||||
[count],cu |NERDComUncommentLine|
|
||||
@@ -137,7 +125,7 @@ Uncomments the selected line(s).
|
||||
2.2.1 Comment map *NERDComComment*
|
||||
|
||||
Default mapping: [count],cc
|
||||
Change the mapping with: NERDComLineMap.
|
||||
Mapped to: <plug>NERDCommenterComment
|
||||
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*
|
||||
|
||||
Default mapping: [count],cn
|
||||
Change the mapping with: NERDComLineNestMap.
|
||||
Mapped to: <plug>NERDCommenterNest
|
||||
Applicable modes: normal visual visual-line visual-block.
|
||||
|
||||
Performs nested commenting. Works the same as ,cc except that if a
|
||||
line is already commented then it will be commented again.
|
||||
Performs nested commenting. Works the same as ,cc except that if a line is
|
||||
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
|
||||
comment will only be added if the current commenting delimiters have no right
|
||||
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.
|
||||
|
||||
Related options:
|
||||
|NERDDefaultNesting|
|
||||
|'NERDDefaultNesting'|
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
2.2.3 Toggle comment map *NERDComToggleComment*
|
||||
|
||||
Default mapping: [count],c<space>
|
||||
Change the mapping with: NERDComLineToggleMap.
|
||||
Mapped to: <plug>NERDCommenterToggle
|
||||
Applicable modes: normal visual-line.
|
||||
|
||||
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*
|
||||
|
||||
Default mapping: [count],cm
|
||||
Change the mapping with: NERDComLineMinimalMap
|
||||
Mapped to: <plug>NERDCommenterMinimal
|
||||
Applicable modes: normal visual-line.
|
||||
|
||||
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
|
||||
,cm then a '/*' will be placed at the start of the top line and a '*/'
|
||||
will be placed at the end of the last line.
|
||||
For example: if you are programming in c and you select 5 lines and press ,cm
|
||||
then a '/*' will be placed at the start of the top line and a '*/' will be
|
||||
placed at the end of the last line.
|
||||
|
||||
Sets of multipart comment delimiters that are between the top and bottom
|
||||
selected lines are replaced with place holders (see |NERDLPlace|) if
|
||||
|NERDUsePlaceHolders| is set for the current filetype. If it is not, then
|
||||
selected lines are replaced with place holders (see |'NERDLPlace'|) if
|
||||
|'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
|
||||
syntax.
|
||||
|
||||
@@ -213,7 +201,7 @@ lines were selected in visual-line mode.
|
||||
2.2.5 Invert comment map *NERDComInvertComment*
|
||||
|
||||
Default mapping: ,ci
|
||||
Change the mapping with: NERDComLineInvertMap.
|
||||
Mapped to: <plug>NERDCommenterInvert
|
||||
Applicable modes: normal visual-line.
|
||||
|
||||
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*
|
||||
|
||||
Default mapping: [count],cs
|
||||
Change the mapping with: NERDComLineSexyMap
|
||||
Mapped to: <plug>NERDCommenterSexy
|
||||
Applicable modes: normal, visual-line.
|
||||
|
||||
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.
|
||||
|
||||
Related options:
|
||||
|NERDCompactSexyComs|
|
||||
|'NERDCompactSexyComs'|
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
2.2.7 Yank comment map *NERDComYankComment*
|
||||
|
||||
Default mapping: [count],cy
|
||||
Change the mapping with: NERDComLineYankMap
|
||||
Mapped to: <plug>NERDCommenterYank
|
||||
Applicable modes: normal visual visual-line visual-block.
|
||||
|
||||
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*
|
||||
|
||||
Default mapping: ,c$
|
||||
Change the mapping with: NERDComToEOLMap
|
||||
Mapped to: <plug>NERDCommenterToEOL
|
||||
Applicable modes: normal.
|
||||
|
||||
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*
|
||||
|
||||
Default mapping: ,cA
|
||||
Change the mapping with: NERDAppendComMap.
|
||||
Mapped to: <plug>NERDCommenterAppend
|
||||
Applicable modes: normal.
|
||||
|
||||
Appends comment delimiters to the end of the current line and goes
|
||||
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
|
||||
Change the mapping with: NERDPrependComMap.
|
||||
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.
|
||||
Default mapping: disabled by default.
|
||||
Map it to: <plug>NERDCommenterInInsert
|
||||
Applicable modes: insert.
|
||||
|
||||
Adds comment delimiters at the current cursor position and inserts
|
||||
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
|
||||
Change the mapping with: NERDAltComMap
|
||||
Mapped to: <plug>NERDCommenterAltDelims
|
||||
Applicable modes: normal.
|
||||
|
||||
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|
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
2.2.13 Comment aligned maps *NERDComAlignedComment*
|
||||
2.2.12 Comment aligned maps *NERDComAlignedComment*
|
||||
|
||||
Default mappings: [count],cl [count],cr [count],cb
|
||||
Change the mappings with: NERDComAlignLeftMap, NERDComAlignRightMap and
|
||||
NERDComAlignBothMap.
|
||||
Default mappings: [count],cl [count],cb
|
||||
Mapped to: <plug>NERDCommenterAlignLeft
|
||||
<plug>NERDCommenterAlignBoth
|
||||
Applicable modes: normal visual-line.
|
||||
|
||||
Same as ,cc except that the comment delimiters are aligned on the left
|
||||
side, right side or both sides respectively. These comments are always nested
|
||||
if the line(s) are already commented.
|
||||
Same as ,cc except that the comment delimiters are aligned on the left side or
|
||||
both sides respectively. These comments are always nested if the line(s) are
|
||||
already commented.
|
||||
|
||||
If a [count] is given in normal mode, the mapping works as though that many
|
||||
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
|
||||
Change the mapping with: NERDUncomLineMap.
|
||||
Mapped to: <plug>NERDCommenterUncomment
|
||||
Applicable modes: normal visual visual-line visual-block.
|
||||
|
||||
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.
|
||||
|
||||
Related options:
|
||||
|NERDRemoveAltComs|
|
||||
|NERDRemoveExtraSpaces|
|
||||
|'NERDRemoveAltComs'|
|
||||
|'NERDRemoveExtraSpaces'|
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
2.3 Supported filetypes *NERDComFiletypes*
|
||||
@@ -393,8 +377,7 @@ one other marker symbol. For example: >
|
||||
* So there!
|
||||
* But this one is ``compact'' style */
|
||||
<
|
||||
Here the multipart delimiters are /* and */ and the marker is *. The NERD
|
||||
commenter is capable of adding and removing comments of this type.
|
||||
Here the multipart delimiters are /* and */ and the marker is *.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
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
|
||||
line.
|
||||
- type: is used to specify what type of commenting operation is to be
|
||||
performed, and it can be one of the following: 'sexy', 'invert',
|
||||
'minimal', 'toggle', 'alignLeft', 'alignRight', 'alignBoth', 'norm',
|
||||
'nested', 'toEOL', 'prepend', 'append', 'insert', 'uncomment', 'yank'
|
||||
performed, and it can be one of the following: "sexy", "invert",
|
||||
"minimal", "toggle", "alignLeft", "alignBoth", "norm", "nested",
|
||||
"toEOL", "append", "insert", "uncomment", "yank"
|
||||
|
||||
For example, if you typed >
|
||||
: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*
|
||||
|
||||
|loaded_nerd_comments| Turns off the script.
|
||||
|NERDAllowAnyVisualDelims| Allows multipart alternative delims to
|
||||
|'loaded_nerd_comments'| Turns off the script.
|
||||
|'NERDAllowAnyVisualDelims'| Allows multipart alternative delims to
|
||||
be used when commenting in
|
||||
visual/visual-block mode.
|
||||
|NERDBlockComIgnoreEmpty| Forces right delims to be placed when
|
||||
|'NERDBlockComIgnoreEmpty'| Forces right delims to be placed when
|
||||
doing visual-block comments.
|
||||
|NERDCommentWholeLinesInVMode| Changes behaviour of visual comments.
|
||||
|NERDDefaultNesting| Tells the script to use nested comments
|
||||
|'NERDCommentWholeLinesInVMode'| Changes behaviour of visual comments.
|
||||
|'NERDCreateDefaultMappings'| Turn the default mappings on/off.
|
||||
|'NERDDefaultNesting'| Tells the script to use nested comments
|
||||
by default.
|
||||
|NERDMenuMode| Specifies how the NERD commenter menu
|
||||
|'NERDMenuMode'| Specifies how the NERD commenter menu
|
||||
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
|
||||
comments.
|
||||
|NERDMapleader| Specifies what all the commenting key
|
||||
mappings will begin with.
|
||||
|NERDUsePlaceHolders| Specifies which filetypes may use
|
||||
|'NERDUsePlaceHolders'| Specifies which filetypes may use
|
||||
placeholders when nesting comments.
|
||||
|NERDRemoveAltComs| Tells the script whether to remove
|
||||
|'NERDRemoveAltComs'| Tells the script whether to remove
|
||||
alternative comment delimiters when
|
||||
uncommenting.
|
||||
|NERDRemoveExtraSpaces| Tells the script to always remove the
|
||||
|'NERDRemoveExtraSpaces'| Tells the script to always remove the
|
||||
extra spaces when uncommenting
|
||||
(regardless of whether NERDSpaceDelims
|
||||
is set)
|
||||
|NERDRPlace| Specifies what to use as the right
|
||||
|'NERDRPlace'| Specifies what to use as the right
|
||||
delimiter placeholder when nesting
|
||||
comments.
|
||||
|NERDShutUp| Stops "Unknown filetype" output from the
|
||||
|'NERDShutUp'| Stops "Unknown filetype" output from the
|
||||
script
|
||||
|NERDSpaceDelims| Specifies whether to add extra spaces
|
||||
|'NERDSpaceDelims'| Specifies whether to add extra spaces
|
||||
around delimiters when commenting, and
|
||||
whether to remove them when
|
||||
uncommenting.
|
||||
|NERDCompactSexyComs| Specifies whether to use the compact
|
||||
|'NERDCompactSexyComs'| Specifies whether to use the compact
|
||||
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
|
||||
~/.vimrc
|
||||
|
||||
*loaded_nerd_comments*
|
||||
*'loaded_nerd_comments'*
|
||||
If this script is driving you insane you can turn it off by setting this
|
||||
option >
|
||||
let loaded_nerd_comments=1
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
*NERDAllowAnyVisualDelims*
|
||||
*'NERDAllowAnyVisualDelims'*
|
||||
Values: 0 or 1.
|
||||
Default: 1.
|
||||
|
||||
@@ -498,7 +480,7 @@ shown on the right: >
|
||||
System.out.println(foo * bar); System.out.println(foo * bar);
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
*NERDBlockComIgnoreEmpty*
|
||||
*'NERDBlockComIgnoreEmpty'*
|
||||
Values: 0 or 1.
|
||||
Default: 1.
|
||||
|
||||
@@ -541,7 +523,7 @@ Otherwise, the code block would become: >
|
||||
/*} */
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
*NERDCommentWholeLinesInVMode*
|
||||
*'NERDCommentWholeLinesInVMode'*
|
||||
Values: 0, 1 or 2.
|
||||
Default: 0.
|
||||
|
||||
@@ -579,15 +561,25 @@ then stick the following line in your vimrc: >
|
||||
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.
|
||||
Default: 1.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*NERDRemoveExtraSpaces*
|
||||
*'NERDRemoveExtraSpaces'*
|
||||
Values: 0 or 1.
|
||||
Default: 1.
|
||||
|
||||
By default, the NERD commenter will remove spaces around comment delimiters if
|
||||
either:
|
||||
1. |NERDSpaceDelims| is set to 1.
|
||||
1. |'NERDSpaceDelims'| is set to 1.
|
||||
2. NERDRemoveExtraSpaces is set to 1.
|
||||
|
||||
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 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.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*NERDLPlace*
|
||||
*NERDRPlace*
|
||||
*'NERDLPlace'*
|
||||
*'NERDRPlace'*
|
||||
Values: arbitrary string.
|
||||
Default:
|
||||
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.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*NERDMapleader*
|
||||
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*
|
||||
*'NERDMenuMode'*
|
||||
Values: 0, 1, 2, 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.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*NERDUsePlaceHolders*
|
||||
*'NERDUsePlaceHolders'*
|
||||
Values: 0 or 1.
|
||||
Default 1.
|
||||
|
||||
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.
|
||||
Default 1.
|
||||
|
||||
@@ -707,7 +669,7 @@ messages. Stick this line in your vimrc: >
|
||||
let NERDShutUp=1
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
*NERDSpaceDelims*
|
||||
*'NERDSpaceDelims'*
|
||||
Values: 0 or 1.
|
||||
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.
|
||||
|
||||
See also |NERDRemoveExtraSpaces|.
|
||||
See also |'NERDRemoveExtraSpaces'|.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*NERDCompactSexyComs*
|
||||
*'NERDCompactSexyComs'*
|
||||
Values: 0 or 1.
|
||||
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.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*NERDDefaultNesting*
|
||||
*'NERDDefaultNesting'*
|
||||
Values: 0 or 1.
|
||||
Default 1.
|
||||
|
||||
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
|
||||
again
|
||||
you hit ,cc on a line that is already commented it will be commented again
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
3.3 Default delimiter customisation *NERDComDefaultDelims*
|
||||
|
||||
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: >
|
||||
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
|
||||
/* */ 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.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
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
|
||||
commenting mappings. Their values must be set to strings. As an example: if
|
||||
you wanted to use the mapping ,foo to uncomment lines of code then
|
||||
you would place this line in your vimrc >
|
||||
let NERDUncomLineMap=",foo"
|
||||
To change a mapping just map another key combo to the internal <plug> mapping.
|
||||
For example, to remap the |NERDComComment| mapping to ",omg" you would put
|
||||
this line in your vimrc: >
|
||||
map ,omg <plug>NERDCommenterComment
|
||||
<
|
||||
Check out |NERDComFunctionality| for details about what the following
|
||||
mappings do.
|
||||
This will stop the corresponding default mappings from being created.
|
||||
|
||||
Default Mapping Option to override~
|
||||
See the help for the mapping in question to see which <plug> mapping to
|
||||
map to.
|
||||
|
||||
,ca NERDAltComMap
|
||||
,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
|
||||
See also |'NERDCreateDefaultMappings'|.
|
||||
|
||||
==============================================================================
|
||||
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
|
||||
|
||||
@@ -819,7 +765,7 @@ string. These heuristics, while usually pretty accurate, will not work for all
|
||||
cases.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
4.2 Nesting issues *NERDComNesting*
|
||||
5.2 Nesting issues *NERDComNesting*
|
||||
|
||||
If we have some line of code like this: >
|
||||
/*int foo */ = /*5 + 9;*/
|
||||
@@ -849,203 +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
|
||||
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*
|
||||
|
||||
2.1.12
|
||||
- added support for patran and dakota, thx to Jacobo Diaz for the email
|
||||
- added support for gentoo-env-d, gentoo-init-d, gentoo-make-conf, grub,
|
||||
modconf and sudoers filetypes, thx to Li Jin for the patch.
|
||||
- added support for SVNdiff, gitAnnotate, gitdiff. Thx to nicothakis for
|
||||
posting the issue
|
||||
2.2.1
|
||||
- add support for newlisp and clojure, thanks to Matthew Lee Hinman.
|
||||
- fix automake comments, thanks to Elias Pipping
|
||||
- make haml comments default to -# with / as the alternative delimiter,
|
||||
thanks to tpope
|
||||
- add support for actionscript and processing thanks to Edwin Benavides
|
||||
- add support for ps1 (powershell), thanks to Jason Mills
|
||||
- add support for hostsaccess, thanks to Thomas Rowe
|
||||
- add support for CVScommit
|
||||
- add support for asciidoc, git and gitrebase. Thanks to Simon Ruderich.
|
||||
- use # for gitcommit comments, thanks to Simon Ruderich.
|
||||
- add support for mako and genshi, thanks to Keitheis.
|
||||
- add support for conkyrc, thanks to David
|
||||
- add support for SVNannotate, thanks to Miguel Jaque Barbero.
|
||||
- add support for sieve, thanks to Stefan Walk
|
||||
- add support for objj, thanks to Adam Thorsen.
|
||||
|
||||
2.1.11
|
||||
- fixed a bug with the selection option and visual commenting (again).
|
||||
Thanks to Ingo Karkat (again).
|
||||
|
||||
2.1.10
|
||||
- added support for Wikipedia (thanks to Chen Xing)
|
||||
- added support for mplayerconf
|
||||
- bugfixes (thanks to Ingo Karkat for the bug report/patch)
|
||||
- added support for mkd (thanks to Stefano Zacchiroli)
|
||||
|
||||
2.1.9
|
||||
- added support for mrxvtrc and aap, thx to Marco for the emails
|
||||
- added dummy support for SVNAnnotate, SVKAnnotate and CVSAnnotate, thx to
|
||||
nicothakis for posting the issue
|
||||
|
||||
2.1.8
|
||||
- fixed a couple of bugs with the NERDSpaceDelims option, thx to
|
||||
David Miani and Jeremy Hinegardner
|
||||
- added dummy support for lhaskell, thx to pipp for posting the issue
|
||||
- added an alternative set of delims for the plsql filetype, thx to Kuchma
|
||||
Michael
|
||||
- added support for spectre, thx to Brett Warneke
|
||||
- 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.
|
||||
2.2.0
|
||||
- rewrote the mappings system to be more "standard".
|
||||
- removed all the mapping options. Now, mappings to <plug> mappings are
|
||||
used
|
||||
- see :help NERDComMappings, and :help NERDCreateDefaultMappings for
|
||||
more info
|
||||
- remove "prepend comments" and "right aligned comments".
|
||||
- add support for applescript, calbire, man, SVNcommit, potwiki, txt2tags and SVNinfo.
|
||||
Thanks to nicothakis, timberke, sgronblo, mntnoe, Bernhard Grotz, John
|
||||
O'Shea, François and Giacomo Mariani respectively.
|
||||
- bugfix for haskell delimiters. Thanks to mntnoe.
|
||||
2.1.18
|
||||
- add support for llvm. Thanks to nicothakis.
|
||||
- add support for xquery. Thanks to Phillip Kovalev.
|
||||
2.1.17
|
||||
- fixed haskell delimiters (hackily). Thanks to Elias Pipping.
|
||||
- add support for mailcap. Thanks to Pascal Brueckner.
|
||||
- add support for stata. Thanks to Jerónimo Carballo.
|
||||
- applied a patch from ewfalor to fix an error in the help file with the
|
||||
NERDMapleader doc
|
||||
- disable the insert mode ctrl-c mapping by default, see :help
|
||||
NERDComInsertComment if you wish to restore it
|
||||
|
||||
==============================================================================
|
||||
8. Credits *NERDComCredits*
|
||||
@@ -1168,6 +959,21 @@ Thanks to marco for suggesting NERDDefaultNesting be set by default.
|
||||
|
||||
Thanks to Ingo Karkat for the bug reports and the bugfix patch.
|
||||
|
||||
Thanks to Zhang Shuhan for sending me a report about spaces not being removed
|
||||
properly in some circumstances. Also, thanks for emailing me a bunch of bug
|
||||
reports about sexy/toggle comments and for testing my fixes.
|
||||
|
||||
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
|
||||
support :D
|
||||
|
||||
@@ -1179,7 +985,7 @@ Michael Brunner kconfig
|
||||
Antono Vasiljev netdict
|
||||
Melissa Reid omlet
|
||||
Ilia N Ternovich quickfix
|
||||
John O'Shea RTF, SVNcommitlog and vcscommit
|
||||
John O'Shea RTF, SVNcommitlog and vcscommit, SVNCommit
|
||||
Anders occam
|
||||
Mark Woodward csv
|
||||
fREW gentoo-package-mask,
|
||||
@@ -1194,7 +1000,7 @@ Stefano Zacchiroli debcontrol, debchangelog, mkd
|
||||
Alex Tarkovsky ebuild and eclass
|
||||
Jorge Rodrigues gams
|
||||
Rainer Müller Objective C
|
||||
Jason Mills Groovy
|
||||
Jason Mills Groovy, ps1
|
||||
Normandie Azucena vera
|
||||
Florian Apolloner ldif
|
||||
David Fishburn lookupfile
|
||||
@@ -1207,9 +1013,9 @@ Nicolas Weber markdown, objcpp
|
||||
tinoucas gentoo-conf-d
|
||||
Greg Weber D, haml
|
||||
Bruce Sherrod velocity
|
||||
timberke cobol
|
||||
timberke cobol, calibre
|
||||
Aaron Schaefer factor
|
||||
Laurent ARNOUD asterisk, mplayerconf
|
||||
Mr X asterisk, mplayerconf
|
||||
Kuchma Michael plsql
|
||||
Brett Warneke spectre
|
||||
Pipp lhaskell
|
||||
@@ -1217,9 +1023,41 @@ Renald Buter scala
|
||||
Vladimir Lomov asymptote
|
||||
Marco mrxvtrc, aap
|
||||
nicothakis SVNAnnotate, CVSAnnotate, SVKAnnotate,
|
||||
SVNdiff, gitAnnotate, gitdiff
|
||||
SVNdiff, gitAnnotate, gitdiff, dtrace
|
||||
llvm, applescript
|
||||
Chen Xing Wikipedia
|
||||
Jacobo Diaz dakota, patran
|
||||
Li Jin gentoo-env-d, gentoo-init-d,
|
||||
gentoo-make-conf, grub, modconf, sudoers
|
||||
SpookeyPeanut rib
|
||||
Greg Jandl pyrex/cython
|
||||
Christophe Benz services, gitcommit
|
||||
A Pontus vimperator
|
||||
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.
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
" vim global plugin that provides easy code commenting for various file types
|
||||
" Last Change: 31 March 2008
|
||||
" Maintainer: Martin Grenfell <martin_grenfell at msn.com>
|
||||
let s:NERD_commenter_version = 2.1.12
|
||||
|
||||
" For help documentation type :help NERDCommenter. If this fails, Restart vim
|
||||
" and try again. If it sill doesnt work... the help page is at the bottom
|
||||
" of this file.
|
||||
" ============================================================================
|
||||
" File: NERD_commenter.vim
|
||||
" Description: vim global plugin that provides easy code commenting
|
||||
" Maintainer: Martin Grenfell <martin_grenfell at msn dot com>
|
||||
" Version: 2.2.1
|
||||
" Last Change: 13th November, 2008
|
||||
" License: This program is free software. It comes without any warranty,
|
||||
" 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
|
||||
if exists("loaded_nerd_comments")
|
||||
@@ -54,35 +59,20 @@ call s:InitVariable("g:NERDAllowAnyVisualDelims", 1)
|
||||
call s:InitVariable("g:NERDBlockComIgnoreEmpty", 0)
|
||||
call s:InitVariable("g:NERDCommentWholeLinesInVMode", 0)
|
||||
call s:InitVariable("g:NERDCompactSexyComs", 0)
|
||||
call s:InitVariable("g:NERDCreateDefaultMappings", 1)
|
||||
call s:InitVariable("g:NERDDefaultNesting", 1)
|
||||
call s:InitVariable("g:NERDMenuMode", 3)
|
||||
call s:InitVariable("g:NERDLPlace", "[>")
|
||||
call s:InitVariable("g:NERDUsePlaceHolders", 1)
|
||||
call s:InitVariable("g:NERDRemoveAltComs", 1)
|
||||
call s:InitVariable("g:NERDRemoveExtraSpaces", 0)
|
||||
call s:InitVariable("g:NERDRemoveExtraSpaces", 1)
|
||||
call s:InitVariable("g:NERDRPlace", "<]")
|
||||
call s:InitVariable("g:NERDShutUp", '0')
|
||||
call s:InitVariable("g:NERDSpaceDelims", 0)
|
||||
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="[]#*$%'\" ?`!&();<>\\"
|
||||
|
||||
" Section: Comment mapping functions, autocommands and commands {{{1
|
||||
@@ -90,21 +80,16 @@ let s:NERDFileNameEscape="[]#*$%'\" ?`!&();<>\\"
|
||||
" Section: Comment enabler autocommands {{{2
|
||||
" ============================================================================
|
||||
|
||||
if !exists("nerd_autocmds_loaded")
|
||||
let nerd_autocmds_loaded=1
|
||||
augroup commentEnablers
|
||||
|
||||
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
|
||||
"the comment delimiters for that new filetype
|
||||
autocmd BufEnter,BufRead * :call s:SetUpForNewFiletype(&filetype, 0)
|
||||
|
||||
"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
|
||||
"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
|
||||
|
||||
|
||||
" Function: s:SetUpForNewFiletype(filetype) function {{{2
|
||||
@@ -140,6 +125,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
call s:MapDelimiters('%', '')
|
||||
elseif a:filetype == "acedb"
|
||||
call s:MapDelimitersWithAlternative('//','', '/*','*/')
|
||||
elseif a:filetype == "actionscript"
|
||||
call s:MapDelimitersWithAlternative('//','', '/*','*/')
|
||||
elseif a:filetype == "ada"
|
||||
call s:MapDelimitersWithAlternative('--','', '-- ', '')
|
||||
elseif a:filetype == "ahdl"
|
||||
@@ -158,6 +145,10 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "apachestyle"
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "asciidoc"
|
||||
call s:MapDelimiters('//', '')
|
||||
elseif a:filetype == "applescript"
|
||||
call s:MapDelimitersWithAlternative('--', '', '(*', '*)')
|
||||
elseif a:filetype == "asm68k"
|
||||
call s:MapDelimiters(';', '')
|
||||
elseif a:filetype == "asm"
|
||||
@@ -177,7 +168,7 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
elseif a:filetype == "autoit"
|
||||
call s:MapDelimiters(';','')
|
||||
elseif a:filetype == "automake"
|
||||
call s:MapDelimitersWithAlternative('#','', 'dnl ', '')
|
||||
call s:MapDelimiters('##','')
|
||||
elseif a:filetype == "ave"
|
||||
call s:MapDelimiters("'",'')
|
||||
elseif a:filetype == "awk"
|
||||
@@ -200,8 +191,12 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
call s:MapDelimiters('%', '')
|
||||
elseif a:filetype == "btm"
|
||||
call s:MapDelimiters('::', '')
|
||||
elseif a:filetype == "bzr"
|
||||
call s:MapDelimiters('', '')
|
||||
elseif a:filetype == "caos"
|
||||
call s:MapDelimiters('*', '')
|
||||
elseif a:filetype == "calibre"
|
||||
call s:MapDelimiters('//','')
|
||||
elseif a:filetype == "catalog"
|
||||
call s:MapDelimiters('--','--')
|
||||
elseif a:filetype == "c"
|
||||
@@ -220,6 +215,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
call s:MapDelimitersWithAlternative('//','', '/*','*/')
|
||||
elseif a:filetype == "clipper"
|
||||
call s:MapDelimitersWithAlternative('//','', '/*','*/')
|
||||
elseif a:filetype == "clojure"
|
||||
call s:MapDelimiters(';', '')
|
||||
elseif a:filetype == "cmake"
|
||||
call s:MapDelimiters('#','')
|
||||
elseif a:filetype == "cobol"
|
||||
@@ -228,6 +225,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "config"
|
||||
call s:MapDelimiters('dnl ', '')
|
||||
elseif a:filetype == "conkyrc"
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "context"
|
||||
call s:MapDelimiters('%','')
|
||||
elseif a:filetype == "cpp"
|
||||
@@ -252,6 +251,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
call s:MapDelimiters('CVS:','')
|
||||
elseif a:filetype == "CVSAnnotate"
|
||||
call s:MapDelimiters('','')
|
||||
elseif a:filetype == "CVScommit"
|
||||
call s:MapDelimiters('','')
|
||||
elseif a:filetype == "d"
|
||||
call s:MapDelimitersWithAlternative('//','', '/*','*/')
|
||||
elseif a:filetype == "dcl"
|
||||
@@ -290,6 +291,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
call s:MapDelimiters('<!--','-->')
|
||||
elseif a:filetype == "dtml"
|
||||
call s:MapDelimiters('<dtml-comment>','</dtml-comment>')
|
||||
elseif a:filetype == "dtrace"
|
||||
call s:MapDelimiters('/*','*/')
|
||||
elseif a:filetype == "dylan"
|
||||
call s:MapDelimitersWithAlternative('//','', '/*','*/')
|
||||
elseif a:filetype == 'ebuild'
|
||||
@@ -342,6 +345,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
call s:MapDelimiters('--', '')
|
||||
elseif a:filetype == "geek"
|
||||
call s:MapDelimiters('GEEK_COMMENT:', '')
|
||||
elseif a:filetype == "genshi"
|
||||
call s:MapDelimitersWithAlternative('<!--','-->', '{#', '#}')
|
||||
elseif a:filetype == "gentoo-conf-d"
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "gentoo-env-d"
|
||||
@@ -356,32 +361,44 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == 'gentoo-package-use'
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == 'git'
|
||||
call s:MapDelimiters('', '')
|
||||
elseif a:filetype == 'gitAnnotate'
|
||||
call s:MapDelimiters('', '')
|
||||
elseif a:filetype == 'gitcommit'
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == 'gitconfig'
|
||||
call s:MapDelimiters(';', '')
|
||||
elseif a:filetype == 'gitdiff'
|
||||
call s:MapDelimiters('', '')
|
||||
elseif a:filetype == 'gitrebase'
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "gnuplot"
|
||||
call s:MapDelimiters('#','')
|
||||
elseif a:filetype == "groovy"
|
||||
call s:MapDelimitersWithAlternative('//','', '/*','*/')
|
||||
elseif a:filetype == "group"
|
||||
call s:MapDelimiters('','')
|
||||
elseif a:filetype == "grub"
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "gtkrc"
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "haskell"
|
||||
call s:MapDelimitersWithAlternative('--','', '{-', '-}')
|
||||
call s:MapDelimitersWithAlternative('{-','-}', '--', '')
|
||||
elseif a:filetype == "hb"
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "h"
|
||||
call s:MapDelimitersWithAlternative('//','', '/*','*/')
|
||||
elseif a:filetype == "haml"
|
||||
call s:MapDelimiters('/', '')
|
||||
call s:MapDelimitersWithAlternative('-#', '', '/', '')
|
||||
elseif a:filetype == "help"
|
||||
call s:MapDelimiters('"','')
|
||||
elseif a:filetype == "hercules"
|
||||
call s:MapDelimitersWithAlternative('//','', '/*','*/')
|
||||
elseif a:filetype == "hog"
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "hostsaccess"
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "html"
|
||||
call s:MapDelimitersWithAlternative('<!--','-->', '//', '')
|
||||
elseif a:filetype == "htmldjango"
|
||||
@@ -444,10 +461,14 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "lilypond"
|
||||
call s:MapDelimiters('%', '')
|
||||
elseif a:filetype == "liquid"
|
||||
call s:MapDelimiters('{%', '%}')
|
||||
elseif a:filetype == "lisp"
|
||||
call s:MapDelimitersWithAlternative(';','', '#|', '|#')
|
||||
elseif a:filetype == "lite"
|
||||
call s:MapDelimiters('/*','*/')
|
||||
elseif a:filetype == "llvm"
|
||||
call s:MapDelimiters(';','')
|
||||
elseif a:filetype == "lookupfile"
|
||||
call s:MapDelimiters('', '')
|
||||
elseif a:filetype == "lotos"
|
||||
@@ -470,14 +491,24 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
call s:MapDelimiters('dnl ', '')
|
||||
elseif a:filetype == "mail"
|
||||
call s:MapDelimiters('> ','')
|
||||
elseif a:filetype == "mailcap"
|
||||
call s:MapDelimiters('#','')
|
||||
elseif a:filetype == "make"
|
||||
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"
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "markdown"
|
||||
call s:MapDelimiters('<!--', '-->')
|
||||
elseif a:filetype == "masm"
|
||||
call s:MapDelimiters(';', '')
|
||||
elseif a:filetype == "mason"
|
||||
call s:MapDelimiters('<% #', '%>')
|
||||
elseif a:filetype == "master"
|
||||
call s:MapDelimiters('$', '')
|
||||
elseif a:filetype == "matlab"
|
||||
@@ -522,10 +553,14 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
call s:MapDelimiters('/*', '')
|
||||
elseif a:filetype == "ncf"
|
||||
call s:MapDelimiters(';', '')
|
||||
elseif a:filetype == "nerdtree"
|
||||
call s:MapDelimiters('', '')
|
||||
elseif a:filetype == "netdict"
|
||||
call s:MapDelimiters('', '')
|
||||
elseif a:filetype == "netrw"
|
||||
call s:MapDelimiters('', '')
|
||||
elseif a:filetype == "newlisp"
|
||||
call s:MapDelimiters(';','')
|
||||
elseif a:filetype == "nqc"
|
||||
call s:MapDelimiters('/*','*/')
|
||||
elseif a:filetype == "nroff"
|
||||
@@ -536,6 +571,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
call s:MapDelimitersWithAlternative('//','', '/*','*/')
|
||||
elseif a:filetype == "objcpp"
|
||||
call s:MapDelimitersWithAlternative('//','', '/*','*/')
|
||||
elseif a:filetype == "objj"
|
||||
call s:MapDelimitersWithAlternative('//','', '/*','*/')
|
||||
elseif a:filetype == "ocaml"
|
||||
call s:MapDelimiters('(*','*)')
|
||||
elseif a:filetype == "occam"
|
||||
@@ -554,6 +591,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
call s:MapDelimiters('', '')
|
||||
elseif a:filetype == "ox"
|
||||
call s:MapDelimiters('//', '')
|
||||
elseif a:filetype == "pamconf"
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "pascal"
|
||||
call s:MapDelimitersWithAlternative('{','}', '(*', '*)')
|
||||
elseif a:filetype == "passwd"
|
||||
@@ -590,6 +629,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "postscr"
|
||||
call s:MapDelimiters('%', '')
|
||||
elseif a:filetype == "potwiki"
|
||||
call s:MapDelimiters('', '')
|
||||
elseif a:filetype == "pov"
|
||||
call s:MapDelimitersWithAlternative('//','', '/*','*/')
|
||||
elseif a:filetype == "povini"
|
||||
@@ -598,16 +639,22 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
call s:MapDelimiters('%', '')
|
||||
elseif a:filetype == "ppwiz"
|
||||
call s:MapDelimiters(';;', '')
|
||||
elseif a:filetype == "processing"
|
||||
call s:MapDelimitersWithAlternative('//','', '/*','*/')
|
||||
elseif a:filetype == "procmail"
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "progress"
|
||||
call s:MapDelimiters('/*','*/')
|
||||
elseif a:filetype == "prolog"
|
||||
call s:MapDelimitersWithAlternative('%','','/*','*/')
|
||||
elseif a:filetype == "ps1"
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "psf"
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "ptcap"
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "pyrex"
|
||||
call s:MapDelimiters('#','')
|
||||
elseif a:filetype == "python"
|
||||
call s:MapDelimiters('#','')
|
||||
elseif a:filetype == "qf"
|
||||
@@ -632,6 +679,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "rexx"
|
||||
call s:MapDelimiters('/*','*/')
|
||||
elseif a:filetype == "rib"
|
||||
call s:MapDelimiters('#','')
|
||||
elseif a:filetype == "robots"
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "rpl"
|
||||
@@ -668,6 +717,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "selectbuf"
|
||||
call s:MapDelimiters('', '')
|
||||
elseif a:filetype == "services"
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "sgml"
|
||||
call s:MapDelimiters('<!','>')
|
||||
elseif a:filetype == "sgmldecl"
|
||||
@@ -676,6 +727,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
call s:MapDelimiters('<!--','-->')
|
||||
elseif a:filetype == "sicad"
|
||||
call s:MapDelimiters('*', '')
|
||||
elseif a:filetype == "sieve"
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "simula"
|
||||
call s:MapDelimitersWithAlternative('%', '', '--', '')
|
||||
elseif a:filetype == "sinda"
|
||||
@@ -686,6 +739,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
call s:MapDelimiters('%', '')
|
||||
elseif a:filetype == "sl"
|
||||
call s:MapDelimiters('/*','*/')
|
||||
elseif a:filetype == "slice"
|
||||
call s:MapDelimitersWithAlternative('//','', '/*','*/')
|
||||
elseif a:filetype == "slrnrc"
|
||||
call s:MapDelimiters('%', '')
|
||||
elseif a:filetype == "sm"
|
||||
@@ -726,6 +781,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "st"
|
||||
call s:MapDelimiters('"','')
|
||||
elseif a:filetype == "stata"
|
||||
call s:MapDelimiters('/*','*/')
|
||||
elseif a:filetype == "stp"
|
||||
call s:MapDelimiters('--', '')
|
||||
elseif a:filetype == "strace"
|
||||
@@ -736,12 +793,18 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
call s:MapDelimiters('','')
|
||||
elseif a:filetype == "svn"
|
||||
call s:MapDelimiters('','')
|
||||
elseif a:filetype == "SVNannotate"
|
||||
call s:MapDelimiters('','')
|
||||
elseif a:filetype == "SVNAnnotate"
|
||||
call s:MapDelimiters('','')
|
||||
elseif a:filetype == "SVNcommit"
|
||||
call s:MapDelimiters('','')
|
||||
elseif a:filetype == "SVNcommitlog"
|
||||
call s:MapDelimiters('','')
|
||||
elseif a:filetype == "SVNdiff"
|
||||
call s:MapDelimiters('','')
|
||||
elseif a:filetype == "SVNinfo"
|
||||
call s:MapDelimiters('','')
|
||||
elseif a:filetype == "systemverilog"
|
||||
call s:MapDelimitersWithAlternative('//','', '/*','*/')
|
||||
elseif a:filetype == "tads"
|
||||
@@ -752,6 +815,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
call s:MapDelimiters(';', '')
|
||||
elseif a:filetype == "tak"
|
||||
call s:MapDelimiters('$', '')
|
||||
elseif a:filetype == "tar"
|
||||
call s:MapDelimiters('', '')
|
||||
elseif a:filetype == "tasm"
|
||||
call s:MapDelimiters(';', '')
|
||||
elseif a:filetype == "tcl"
|
||||
@@ -780,6 +845,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "tssgm"
|
||||
call s:MapDelimiters("comment = '","'")
|
||||
elseif a:filetype == "txt2tags"
|
||||
call s:MapDelimiters('%','')
|
||||
elseif a:filetype == "uc"
|
||||
call s:MapDelimitersWithAlternative('//','', '/*','*/')
|
||||
elseif a:filetype == "uil"
|
||||
@@ -804,6 +871,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
call s:MapDelimiters('"','')
|
||||
elseif a:filetype == "viminfo"
|
||||
call s:MapDelimiters('','')
|
||||
elseif a:filetype == "vimperator"
|
||||
call s:MapDelimiters('"','')
|
||||
elseif a:filetype == "virata"
|
||||
call s:MapDelimiters('%', '')
|
||||
elseif a:filetype == "vo_base"
|
||||
@@ -852,6 +921,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
call s:MapDelimiters('/*','*/')
|
||||
elseif a:filetype == "yaml"
|
||||
call s:MapDelimiters('#','')
|
||||
elseif a:filetype == "xquery"
|
||||
call s:MapDelimiters('(:',':)')
|
||||
elseif a:filetype == "z8a"
|
||||
call s:MapDelimiters(';', '')
|
||||
|
||||
@@ -965,13 +1036,13 @@ function s:AppendCommentToLine()
|
||||
|
||||
"stick the delimiters down at the end of the line. We have to format the
|
||||
"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
|
||||
" by the len of the right delimiter so we insert between the delimiters
|
||||
if lenRight > 0
|
||||
let leftMoveAmount = lenRight
|
||||
execute ":normal " . leftMoveAmount . "h"
|
||||
execute ":normal! " . leftMoveAmount . "h"
|
||||
endif
|
||||
startinsert
|
||||
endfunction
|
||||
@@ -1112,10 +1183,9 @@ endfunction
|
||||
" Args:
|
||||
" -forceNested: a flag indicating whether the called is requesting the comment
|
||||
" to be nested if need be
|
||||
" -alignRight/alignLeft: 0/1 if the comments delimiters should/shouldnt be
|
||||
" aligned left/right
|
||||
" -align: should be "left" or "both" or "none"
|
||||
" -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
|
||||
" block of of lines and the right most char so that we can do alignment of
|
||||
" the delimiters if the user has specified
|
||||
@@ -1147,12 +1217,12 @@ function s:CommentLines(forceNested, alignLeft, alignRight, firstLine, lastLine)
|
||||
|
||||
" check if we can comment this line
|
||||
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)
|
||||
else
|
||||
let theLine = s:AddLeftDelim(s:GetLeft(0,1,0), theLine)
|
||||
endif
|
||||
if a:alignRight
|
||||
if a:align == "both"
|
||||
let theLine = s:AddRightDelimAligned(s:GetRight(0,1,0), theLine, rightAlignIndx)
|
||||
else
|
||||
let theLine = s:AddRightDelim(s:GetRight(0,1,0), theLine)
|
||||
@@ -1274,12 +1344,14 @@ function s:CommentLinesSexy(topline, bottomline)
|
||||
call setline(a:topline, theLine)
|
||||
|
||||
"comment the bottom line
|
||||
let theLine = getline(a:bottomline)
|
||||
let lineHasTabs = s:HasLeadingTabs(theLine)
|
||||
if lineHasTabs
|
||||
let theLine = s:ConvertLeadingTabsToSpaces(theLine)
|
||||
if a:bottomline != a:topline
|
||||
let theLine = getline(a:bottomline)
|
||||
let lineHasTabs = s:HasLeadingTabs(theLine)
|
||||
if lineHasTabs
|
||||
let theLine = s:ConvertLeadingTabsToSpaces(theLine)
|
||||
endif
|
||||
let theLine = s:SwapOutterMultiPartDelimsForPlaceHolders(theLine)
|
||||
endif
|
||||
let theLine = s:SwapOutterMultiPartDelimsForPlaceHolders(theLine)
|
||||
let theLine = s:AddRightDelim(spaceString . right, theLine)
|
||||
if lineHasTabs
|
||||
let theLine = s:ConvertLeadingSpacesToTabs(theLine)
|
||||
@@ -1399,7 +1471,7 @@ function s:CommentRegion(topLine, topCol, bottomLine, bottomCol, forceNested)
|
||||
let topOfRange = a:topLine+1
|
||||
let bottomOfRange = a:bottomLine-1
|
||||
if topOfRange <= bottomOfRange
|
||||
call s:CommentLines(a:forceNested, 0, 0, topOfRange, bottomOfRange)
|
||||
call s:CommentLines(a:forceNested, "none", topOfRange, bottomOfRange)
|
||||
endif
|
||||
|
||||
"comment the bottom line
|
||||
@@ -1436,7 +1508,7 @@ function s:InvertComment(firstLine, lastLine)
|
||||
|
||||
" if the line is commented normally, uncomment it
|
||||
if s:IsCommentedFromStartOfLine(b:left, theLine) || s:IsCommentedFromStartOfLine(b:leftAlt, theLine)
|
||||
call s:UncommentLines(1, currentLine, currentLine)
|
||||
call s:UncommentLines(currentLine, currentLine)
|
||||
let currentLine = currentLine + 1
|
||||
|
||||
" check if the line is commented sexually
|
||||
@@ -1457,15 +1529,15 @@ function s:InvertComment(firstLine, lastLine)
|
||||
endwhile
|
||||
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
|
||||
"
|
||||
" Args:
|
||||
" -isVisual: a flag indicating whether the comment is requested in visual
|
||||
" mode or not
|
||||
" -type: the type of commenting requested. Can be 'sexy', 'invert',
|
||||
" 'minimal', 'toggle', 'alignLeft', 'alignRight', 'alignBoth', 'norm',
|
||||
" 'nested', 'toEOL', 'prepend', 'append', 'insert', 'uncomment', 'yank'
|
||||
" 'minimal', 'toggle', 'alignLeft', 'alignBoth', 'norm',
|
||||
" 'nested', 'toEOL', 'append', 'insert', 'uncomment', 'yank'
|
||||
function! NERDComment(isVisual, type) range
|
||||
" we want case sensitivity when commenting
|
||||
let oldIgnoreCase = &ignorecase
|
||||
@@ -1491,13 +1563,17 @@ function! NERDComment(isVisual, type) range
|
||||
elseif a:isVisual && visualmode() == "v" && (g:NERDCommentWholeLinesInVMode==0 || (g:NERDCommentWholeLinesInVMode==2 && s:HasMultipartDelims()))
|
||||
call s:CommentRegion(firstLine, firstCol, lastLine, lastCol, forceNested)
|
||||
else
|
||||
call s:CommentLines(forceNested, 0, 0, firstLine, lastLine)
|
||||
call s:CommentLines(forceNested, "none", firstLine, lastLine)
|
||||
endif
|
||||
|
||||
elseif a:type == 'alignLeft' || a:type == 'alignRight' || a:type == 'alignBoth'
|
||||
let alignLeft = (a:type == 'alignLeft' || a:type == 'alignBoth')
|
||||
let alignRight = (a:type == 'alignRight' || a:type == 'alignBoth')
|
||||
call s:CommentLines(forceNested, alignLeft, alignRight, firstLine, lastLine)
|
||||
elseif a:type == 'alignLeft' || a:type == 'alignBoth'
|
||||
let align = "none"
|
||||
if a:type == "alignLeft"
|
||||
let align = "left"
|
||||
elseif a:type == "alignBoth"
|
||||
let align = "both"
|
||||
endif
|
||||
call s:CommentLines(forceNested, align, firstLine, lastLine)
|
||||
|
||||
elseif a:type == 'invert'
|
||||
call s:InvertComment(firstLine, lastLine)
|
||||
@@ -1506,7 +1582,7 @@ function! NERDComment(isVisual, type) range
|
||||
try
|
||||
call s:CommentLinesSexy(firstLine, lastLine)
|
||||
catch /NERDCommenter.Delimiters/
|
||||
call s:NerdEcho("Sexy comments cannot be done with the available delimiters", 0)
|
||||
call s:CommentLines(forceNested, "none", firstLine, lastLine)
|
||||
catch /NERDCommenter.Nesting/
|
||||
call s:NerdEcho("Sexy comment aborted. Nested sexy cannot be nested", 0)
|
||||
endtry
|
||||
@@ -1515,7 +1591,7 @@ function! NERDComment(isVisual, type) range
|
||||
let theLine = getline(firstLine)
|
||||
|
||||
if s:IsInSexyComment(firstLine) || s:IsCommentedFromStartOfLine(b:left, theLine) || s:IsCommentedFromStartOfLine(b:leftAlt, theLine)
|
||||
call s:UncommentLines(1, firstLine, lastLine)
|
||||
call s:UncommentLines(firstLine, lastLine)
|
||||
else
|
||||
call s:CommentLinesToggle(forceNested, firstLine, lastLine)
|
||||
endif
|
||||
@@ -1534,9 +1610,6 @@ function! NERDComment(isVisual, type) range
|
||||
call s:CommentBlock(firstLine, firstLine, col("."), col("$")-1, 1)
|
||||
call s:RestoreScreenState()
|
||||
|
||||
elseif a:type == 'prepend'
|
||||
call s:PrependCommentToLine()
|
||||
|
||||
elseif a:type == 'append'
|
||||
call s:AppendCommentToLine()
|
||||
|
||||
@@ -1544,15 +1617,15 @@ function! NERDComment(isVisual, type) range
|
||||
call s:PlaceDelimitersAndInsBetween()
|
||||
|
||||
elseif a:type == 'uncomment'
|
||||
call s:UncommentLines(0, firstLine, lastLine)
|
||||
call s:UncommentLines(firstLine, lastLine)
|
||||
|
||||
elseif a:type == 'yank'
|
||||
if a:isVisual
|
||||
normal gvy
|
||||
normal! gvy
|
||||
elseif countWasGiven
|
||||
execute firstLine .','. lastLine .'yank'
|
||||
else
|
||||
normal Y
|
||||
normal! yy
|
||||
endif
|
||||
execute firstLine .','. lastLine .'call NERDComment('. a:isVisual .', "norm")'
|
||||
endif
|
||||
@@ -1589,19 +1662,19 @@ function s:PlaceDelimitersAndInsBetween()
|
||||
" place the delimiters down. We do it differently depending on whether
|
||||
" there is a left AND right delimiter
|
||||
if lenRight > 0
|
||||
execute ":normal " . insOrApp . left . right
|
||||
execute ":normal " . lenRight . "h"
|
||||
execute ":normal! " . insOrApp . left . right
|
||||
execute ":normal! " . lenRight . "h"
|
||||
else
|
||||
execute ":normal " . insOrApp . left
|
||||
execute ":normal! " . insOrApp . left
|
||||
|
||||
" 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
|
||||
" one and the user wont be in position to type the comment.
|
||||
if isDelimOnEOL
|
||||
execute 'normal a '
|
||||
execute 'normal! a '
|
||||
endif
|
||||
endif
|
||||
normal l
|
||||
normal! l
|
||||
|
||||
"if needed convert spaces back to tabs and adjust the cursors col
|
||||
"accordingly
|
||||
@@ -1614,46 +1687,6 @@ function s:PlaceDelimitersAndInsBetween()
|
||||
startinsert
|
||||
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
|
||||
" this function is called to remove the first left comment delimiter and the
|
||||
" last right delimiter of the given line.
|
||||
@@ -1703,14 +1736,13 @@ function s:RemoveDelimiters(left, right, line)
|
||||
return line
|
||||
endfunction
|
||||
|
||||
" Function: s:UncommentLines(onlyWholeLineComs, topLine, bottomLine) {{{2
|
||||
" Function: s:UncommentLines(topLine, bottomLine) {{{2
|
||||
" This function uncomments the given lines
|
||||
"
|
||||
" Args:
|
||||
" onlyWholeLineComs: should be 1 for toggle style uncommenting
|
||||
" topLine: the top line of the visual selection to uncomment
|
||||
" bottomLine: the bottom line of the visual selection to uncomment
|
||||
function s:UncommentLines(onlyWholeLineComs, topLine, bottomLine)
|
||||
function s:UncommentLines(topLine, bottomLine)
|
||||
"make local copies of a:firstline and a:lastline and, if need be, swap
|
||||
"them around if the top line is below the bottom
|
||||
let l:firstline = a:topLine
|
||||
@@ -1743,12 +1775,7 @@ function s:UncommentLines(onlyWholeLineComs, topLine, bottomLine)
|
||||
|
||||
"no sexy com was detected so uncomment the line as normal
|
||||
else
|
||||
let theLine = getline(currentLine)
|
||||
if a:onlyWholeLineComs && (s:IsCommentedFromStartOfLine(b:left, theLine) || s:IsCommentedFromStartOfLine(b:leftAlt, theLine))
|
||||
call s:UncommentLinesNormal(currentLine, currentLine)
|
||||
elseif !a:onlyWholeLineComs
|
||||
call s:UncommentLinesNormal(currentLine, currentLine)
|
||||
endif
|
||||
call s:UncommentLinesNormal(currentLine, currentLine)
|
||||
let currentLine = currentLine + 1
|
||||
endif
|
||||
endwhile
|
||||
@@ -1816,7 +1843,7 @@ function s:UncommentLinesSexy(topline, bottomline)
|
||||
" if the first line contains only the left delim then just delete it
|
||||
if theLine =~ '^[ \t]*' . left . '[ \t]*$' && !g:NERDCompactSexyComs
|
||||
call cursor(a:topline, 1)
|
||||
normal dd
|
||||
normal! dd
|
||||
let bottomline = bottomline - 1
|
||||
|
||||
" topline contains more than just the left delim
|
||||
@@ -1840,7 +1867,7 @@ function s:UncommentLinesSexy(topline, bottomline)
|
||||
" if the bottomline contains only the right delim then just delete it
|
||||
if theLine =~ '^[ \t]*' . right . '[ \t]*$'
|
||||
call cursor(bottomline, 1)
|
||||
normal dd
|
||||
normal! dd
|
||||
|
||||
" the last line contains more than the right delim
|
||||
else
|
||||
@@ -1901,16 +1928,16 @@ function s:UncommentLineNormal(line)
|
||||
|
||||
"remove the outter most left comment delim
|
||||
if indxLeft != -1 && (indxLeft < indxLeftAlt || indxLeftAlt == -1)
|
||||
let line = s:ReplaceLeftMostDelim(b:left, '', line)
|
||||
let line = s:RemoveDelimiters(b:left, '', line)
|
||||
elseif indxLeftAlt != -1
|
||||
let line = s:ReplaceLeftMostDelim(b:leftAlt, '', line)
|
||||
let line = s:RemoveDelimiters(b:leftAlt, '', line)
|
||||
endif
|
||||
|
||||
"remove the outter most right comment delim
|
||||
if indxRight != -1 && (indxRight < indxRightAlt || indxRightAlt == -1)
|
||||
let line = s:ReplaceRightMostDelim(b:right, '', line)
|
||||
let line = s:RemoveDelimiters('', b:right, line)
|
||||
elseif indxRightAlt != -1
|
||||
let line = s:ReplaceRightMostDelim(b:rightAlt, '', line)
|
||||
let line = s:RemoveDelimiters('', b:rightAlt, line)
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -2315,12 +2342,12 @@ function s:FindBoundingLinesOfSexyCom(lineNum)
|
||||
let theLine = getline(currentLine)
|
||||
|
||||
"check if the current line is the top of the sexy comment
|
||||
if theLine =~ '^[ \t]*' . left && theLine !~ '.*' . right
|
||||
if currentLine <= a:lineNum && theLine =~ '^[ \t]*' . left && theLine !~ '.*' . right && currentLine < s:NumLinesInBuf()
|
||||
let top = currentLine
|
||||
let currentLine = a:lineNum
|
||||
|
||||
"check if the current line is the bottom of the sexy comment
|
||||
elseif theLine =~ '^[ \t]*' . right && theLine !~ '.*' . left
|
||||
elseif theLine =~ '^[ \t]*' . right && theLine !~ '.*' . left && currentLine > 1
|
||||
let bottom = currentLine
|
||||
|
||||
"the right delimiter is on the same line as the last sexyComMarker
|
||||
@@ -3053,7 +3080,7 @@ function s:RestoreScreenState()
|
||||
endif
|
||||
|
||||
call cursor(t:NERDComOldTopLine, 0)
|
||||
normal zt
|
||||
normal! zt
|
||||
call setpos(".", t:NERDComOldPos)
|
||||
endfunction
|
||||
|
||||
@@ -3197,67 +3224,90 @@ function s:UntabbedCol(line, col)
|
||||
endfunction
|
||||
" 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
|
||||
execute 'nnoremap <silent>' . g:NERDAltComMap . ' :call <SID>SwitchToAlternativeDelimiters(1)<cr>'
|
||||
" switch to/from alternative delimiters
|
||||
nnoremap <plug>NERDCommenterAltDelims :call <SID>SwitchToAlternativeDelimiters(1)<cr>
|
||||
|
||||
" set up the mappings to comment out lines
|
||||
execute 'nnoremap <silent>' . g:NERDComLineMap . ' :call NERDComment(0, "norm")<cr>'
|
||||
execute 'vnoremap <silent>' . g:NERDComLineMap . ' <ESC>:call NERDComment(1, "norm")<cr>'
|
||||
" comment out lines
|
||||
nnoremap <silent> <plug>NERDCommenterComment :call NERDComment(0, "norm")<cr>
|
||||
vnoremap <silent> <plug>NERDCommenterComment <ESC>:call NERDComment(1, "norm")<cr>
|
||||
|
||||
" set up the mappings to do toggle comments
|
||||
execute 'nnoremap <silent>' . g:NERDComLineToggleMap . ' :call NERDComment(0, "toggle")<cr>'
|
||||
execute 'vnoremap <silent>' . g:NERDComLineToggleMap . ' <ESC>:call NERDComment(1, "toggle")<cr>'
|
||||
" toggle comments
|
||||
nnoremap <silent> <plug>NERDCommenterToggle :call NERDComment(0, "toggle")<cr>
|
||||
vnoremap <silent> <plug>NERDCommenterToggle <ESC>:call NERDComment(1, "toggle")<cr>
|
||||
|
||||
" set up the mapp to do minimal comments
|
||||
execute 'nnoremap <silent>' . g:NERDComLineMinimalMap . ' :call NERDComment(0, "minimal")<cr>'
|
||||
execute 'vnoremap <silent>' . g:NERDComLineMinimalMap . ' <ESC>:call NERDComment(1, "minimal")<cr>'
|
||||
" minimal comments
|
||||
nnoremap <silent> <plug>NERDCommenterMinimal :call NERDComment(0, "minimal")<cr>
|
||||
vnoremap <silent> <plug>NERDCommenterMinimal <ESC>:call NERDComment(1, "minimal")<cr>
|
||||
|
||||
" set up the mappings to comment out lines sexily
|
||||
execute 'nnoremap <silent>' . g:NERDComLineSexyMap . ' :call NERDComment(0, "sexy")<CR>'
|
||||
execute 'vnoremap <silent>' . g:NERDComLineSexyMap . ' <ESC>:call NERDComment(1, "sexy")<CR>'
|
||||
" sexy comments
|
||||
nnoremap <silent> <plug>NERDCommenterSexy :call NERDComment(0, "sexy")<CR>
|
||||
vnoremap <silent> <plug>NERDCommenterSexy <ESC>:call NERDComment(1, "sexy")<CR>
|
||||
|
||||
" set up the mappings to do invert comments
|
||||
execute 'nnoremap <silent>' . g:NERDComLineInvertMap . ' :call NERDComment(0, "invert")<CR>'
|
||||
execute 'vnoremap <silent>' . g:NERDComLineInvertMap . ' <ESC>:call NERDComment(1, "invert")<CR>'
|
||||
" invert comments
|
||||
nnoremap <silent> <plug>NERDCommenterInvert :call NERDComment(0, "invert")<CR>
|
||||
vnoremap <silent> <plug>NERDCommenterInvert <ESC>:call NERDComment(1, "invert")<CR>
|
||||
|
||||
" set up the mappings to yank then comment out lines
|
||||
execute 'nmap <silent>' . g:NERDComLineYankMap . ' :call NERDComment(0, "yank")<CR>'
|
||||
execute 'vmap <silent>' . g:NERDComLineYankMap . ' <ESC>:call NERDComment(1, "yank")<CR>'
|
||||
" yank then comment
|
||||
nmap <silent> <plug>NERDCommenterYank :call NERDComment(0, "yank")<CR>
|
||||
vmap <silent> <plug>NERDCommenterYank <ESC>:call NERDComment(1, "yank")<CR>
|
||||
|
||||
" set up the mappings for left aligned comments
|
||||
execute 'nnoremap <silent>' . g:NERDComAlignLeftMap . ' :call NERDComment(0, "alignLeft")<cr>'
|
||||
execute 'vnoremap <silent>' . g:NERDComAlignLeftMap . ' <ESC>:call NERDComment(1, "alignLeft")<cr>'
|
||||
" left aligned comments
|
||||
nnoremap <silent> <plug>NERDCommenterAlignLeft :call NERDComment(0, "alignLeft")<cr>
|
||||
vnoremap <silent> <plug>NERDCommenterAlignLeft <ESC>:call NERDComment(1, "alignLeft")<cr>
|
||||
|
||||
" set up the mappings for right aligned comments
|
||||
execute 'nnoremap <silent>' . g:NERDComAlignRightMap . ' :call NERDComment(0, "alignRight")<cr>'
|
||||
execute 'vnoremap <silent>' . g:NERDComAlignRightMap . ' <ESC>:call NERDComment(1, "alignRight")<cr>'
|
||||
" left and right aligned comments
|
||||
nnoremap <silent> <plug>NERDCommenterAlignBoth :call NERDComment(0, "alignBoth")<cr>
|
||||
vnoremap <silent> <plug>NERDCommenterAlignBoth <ESC>:call NERDComment(1, "alignBoth")<cr>
|
||||
|
||||
" set up the mappings for left and right aligned comments
|
||||
execute 'nnoremap <silent>' . g:NERDComAlignBothMap . ' :call NERDComment(0, "alignBoth")<cr>'
|
||||
execute 'vnoremap <silent>' . g:NERDComAlignBothMap . ' <ESC>:call NERDComment(1, "alignBoth")<cr>'
|
||||
" nested comments
|
||||
nnoremap <silent> <plug>NERDCommenterNest :call NERDComment(0, "nested")<cr>
|
||||
vnoremap <silent> <plug>NERDCommenterNest <ESC>:call NERDComment(1, "nested")<cr>
|
||||
|
||||
" set up the mappings to do nested comments
|
||||
execute 'nnoremap <silent>' . g:NERDComLineNestMap . ' :call NERDComment(0, "nested")<cr>'
|
||||
execute 'vnoremap <silent>' . g:NERDComLineNestMap . ' <ESC>:call NERDComment(1, "nested")<cr>'
|
||||
" uncomment
|
||||
nnoremap <silent> <plug>NERDCommenterUncomment :call NERDComment(0, "uncomment")<cr>
|
||||
vnoremap <silent> <plug>NERDCommenterUncomment :call NERDComment(1, "uncomment")<cr>
|
||||
|
||||
" set up the mapping to uncomment a line
|
||||
execute 'nnoremap <silent>' . g:NERDUncomLineMap . ' :call NERDComment(0, "uncomment")<cr>'
|
||||
execute 'vnoremap <silent>' . g:NERDUncomLineMap . ' :call NERDComment(1, "uncomment")<cr>'
|
||||
" comment till the end of the line
|
||||
nnoremap <silent> <plug>NERDCommenterToEOL :call NERDComment(0, "toEOL")<cr>
|
||||
|
||||
" set up the mapping to comment out to the end of the line
|
||||
execute 'nnoremap <silent>' . g:NERDComToEOLMap . ' :call NERDComment(0, "toEOL")<cr>'
|
||||
" append comments
|
||||
nmap <silent> <plug>NERDCommenterAppend :call NERDComment(0, "append")<cr>
|
||||
|
||||
" set up the mappings to append comments to the line
|
||||
execute 'nmap <silent>' . g:NERDAppendComMap . ' :call NERDComment(0, "append")<cr>'
|
||||
" insert comments
|
||||
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
|
||||
" ===========================================================================
|
||||
@@ -3273,57 +3323,27 @@ if g:NERDMenuMode != 0
|
||||
let menuRoot = '&Plugin.&comment'
|
||||
endif
|
||||
|
||||
execute 'nmenu <silent> '. menuRoot .'.Comment<TAB>' . escape(g:NERDComLineMap, '\') . ' :call NERDComment(0, "norm")<CR>'
|
||||
execute 'vmenu <silent> '. menuRoot .'.Comment<TAB>' . escape(g:NERDComLineMap, '\') . ' <ESC>:call NERDComment(1, "norm")<CR>'
|
||||
|
||||
execute 'nmenu <silent> '. menuRoot .'.Comment\ Toggle<TAB>' . escape(g:NERDComLineToggleMap, '\') . ' :call NERDComment(0, "toggle")<CR>'
|
||||
execute 'vmenu <silent> '. menuRoot .'.Comment\ Toggle<TAB>' . escape(g:NERDComLineToggleMap, '\') . ' <ESC>:call NERDComment(1, "toggle")<CR>'
|
||||
|
||||
execute 'nmenu <silent> '. menuRoot .'.Comment\ Minimal<TAB>' . escape(g:NERDComLineMinimalMap, '\') . ' :call NERDComment(0, "minimal")<CR>'
|
||||
execute 'vmenu <silent> '. menuRoot .'.Comment\ Minimal<TAB>' . escape(g:NERDComLineMinimalMap, '\') . ' <ESC>:call NERDComment(1, "minimal")<CR>'
|
||||
|
||||
execute 'nmenu <silent> '. menuRoot .'.Comment\ Nested<TAB>' . escape(g:NERDComLineNestMap, '\') . ' :call NERDComment(0, "nested")<CR>'
|
||||
execute 'vmenu <silent> '. menuRoot .'.Comment\ Nested<TAB>' . escape(g:NERDComLineNestMap, '\') . ' <ESC>:call NERDComment(1, "nested")<CR>'
|
||||
|
||||
execute 'nmenu <silent> '. menuRoot .'.Comment\ To\ EOL<TAB>' . escape(g:NERDComToEOLMap, '\') . ' :call NERDComment(0, "toEOL")<cr>'
|
||||
|
||||
execute 'nmenu <silent> '. menuRoot .'.Comment\ Invert<TAB>' . escape(g:NERDComLineInvertMap, '\') . ' :call NERDComment(0,"invert")<CR>'
|
||||
execute 'vmenu <silent> '. menuRoot .'.Comment\ Invert<TAB>' . escape(g:NERDComLineInvertMap, '\') . ' <ESC>:call NERDComment(1,"invert")<CR>'
|
||||
|
||||
execute 'nmenu <silent> '. menuRoot .'.Comment\ Sexily<TAB>' . escape(g:NERDComLineSexyMap, '\') . ' :call NERDComment(0,"sexy")<CR>'
|
||||
execute 'vmenu <silent> '. menuRoot .'.Comment\ Sexily<TAB>' . escape(g:NERDComLineSexyMap, '\') . ' <ESC>:call NERDComment(1,"sexy")<CR>'
|
||||
|
||||
execute 'nmenu <silent> '. menuRoot .'.Yank\ line(s)\ then\ comment<TAB>' . escape(g:NERDComLineYankMap, '\') . ' "0Y' . g:NERDComLineMap
|
||||
execute 'vmenu <silent> '. menuRoot .'.Yank\ line(s)\ then\ comment<TAB>' . escape(g:NERDComLineYankMap, '\') . ' "0ygv' . g:NERDComLineMap
|
||||
|
||||
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>'
|
||||
function! s:CreateMenuItems(target, desc, root)
|
||||
exec 'nmenu <silent> ' . a:root . '.' . a:desc . ' ' . a:target
|
||||
exec 'vmenu <silent> ' . a:root . '.' . a:desc . ' ' . a:target
|
||||
endfunction
|
||||
call s:CreateMenuItems("<plug>NERDCommenterComment", 'Comment', menuRoot)
|
||||
call s:CreateMenuItems("<plug>NERDCommenterToggle", 'Toggle', menuRoot)
|
||||
call s:CreateMenuItems('<plug>NERDCommenterMinimal', 'Minimal', menuRoot)
|
||||
call s:CreateMenuItems('<plug>NERDCommenterNest', 'Nested', menuRoot)
|
||||
exec 'nmenu <silent> '. menuRoot .'.To\ EOL <plug>NERDCommenterToEOL'
|
||||
call s:CreateMenuItems('<plug>NERDCommenterInvert', 'Invert', menuRoot)
|
||||
call s:CreateMenuItems('<plug>NERDCommenterSexy', 'Sexy', menuRoot)
|
||||
call s:CreateMenuItems('<plug>NERDCommenterYank', 'Yank\ then\ comment', menuRoot)
|
||||
exec 'nmenu <silent> '. menuRoot .'.Append <plug>NERDCommenterAppend'
|
||||
exec 'menu <silent> '. menuRoot .'.-Sep- :'
|
||||
call s:CreateMenuItems('<plug>NERDCommenterAlignLeft', 'Left\ aligned', menuRoot)
|
||||
call s:CreateMenuItems('<plug>NERDCommenterAlignBoth', 'Left\ and\ right\ aligned', menuRoot)
|
||||
exec 'menu <silent> '. menuRoot .'.-Sep2- :'
|
||||
call s:CreateMenuItems('<plug>NERDCommenterUncomment', 'Uncomment', menuRoot)
|
||||
exec 'nmenu <silent> '. menuRoot .'.Switch\ Delimiters <plug>NERDCommenterAltDelims'
|
||||
exec 'imenu <silent> '. menuRoot .'.Insert\ Comment\ Here <plug>NERDCommenterInInsert'
|
||||
exec 'menu <silent> '. menuRoot .'.-Sep3- :'
|
||||
exec 'menu <silent>'. menuRoot .'.Help :help NERDCommenterContents<CR>'
|
||||
endif
|
||||
" vim: set foldmethod=marker :
|
||||
|
||||
Reference in New Issue
Block a user