mirror of
https://github.com/preservim/nerdcommenter.git
synced 2025-11-09 18:23:48 -05:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
902faedee2 |
95
README.md
95
README.md
@@ -1,95 +0,0 @@
|
|||||||
# Installation
|
|
||||||
|
|
||||||
_\*For simplicity, let's use **[VIM_ROOT]** which will mean ~/.vim (\*nix) or ~/vimfiles (Windows)_
|
|
||||||
|
|
||||||
The NERD Commenter requires Vim 7 or higher is comprised of 2 files:
|
|
||||||
|
|
||||||
plugin/NERD_commenter.vim
|
|
||||||
doc/NERD_commenter.txt
|
|
||||||
|
|
||||||
### Classic Install
|
|
||||||
|
|
||||||
1. Extract the plugin files into your **[VIM_ROOT]**/plugin and **[VIM_ROOT]**/doc folders respectively.
|
|
||||||
2. Finish the install by updating your help files. Run:
|
|
||||||
|
|
||||||
<pre><code>:helptags [VIM_ROOT]/doc</code></pre>
|
|
||||||
|
|
||||||
See **|add-local-help|** for more details.
|
|
||||||
|
|
||||||
### Pathogen Install
|
|
||||||
1. Navigate to your **[VIM_ROOT]/bundle** directory in your local Vim setup
|
|
||||||
2. `git clone https://github.com/scrooloose/nerdcommenter.git`
|
|
||||||
|
|
||||||
### Vundle Install
|
|
||||||
1. Add `Plugin 'scrooloose/nerdcommenter'` to your .vimrc file.
|
|
||||||
2. Run `:BundleInstall`
|
|
||||||
|
|
||||||
### Post Install
|
|
||||||
After the **'Classic'** or **'Pathogen'** install, make sure that you have filetype plugins enabled, as the script makes use of
|
|
||||||
**|'commentstring'|** where possible (which is usually set in a filetype plugin).
|
|
||||||
See **|filetype-plugin-on|** for details, but basically, stick this in your vimrc:
|
|
||||||
|
|
||||||
filetype plugin on
|
|
||||||
|
|
||||||
# Usage
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
**[count]\<leader\>cc |NERDComComment|**
|
|
||||||
Comment out the current line or text selected in visual mode.
|
|
||||||
|
|
||||||
|
|
||||||
**[count]\<leader\>cn |NERDComNestedComment|**
|
|
||||||
Same as \<leader\>cc but forces nesting.
|
|
||||||
|
|
||||||
|
|
||||||
**[count]\<leader\>c\<space\> |NERDComToggleComment|**
|
|
||||||
Toggles the comment state of the selected line(s). If the topmost selected
|
|
||||||
line is commented, all selected lines are uncommented and vice versa.
|
|
||||||
|
|
||||||
|
|
||||||
**[count]\<leader\>cm |NERDComMinimalComment|**
|
|
||||||
Comments the given lines using only one set of multipart delimiters.
|
|
||||||
|
|
||||||
|
|
||||||
**[count]\<leader\>ci |NERDComInvertComment|**
|
|
||||||
Toggles the comment state of the selected line(s) individually.
|
|
||||||
|
|
||||||
|
|
||||||
**[count]\<leader\>cs |NERDComSexyComment|**
|
|
||||||
Comments out the selected lines ``sexily''
|
|
||||||
|
|
||||||
|
|
||||||
**[count]\<leader\>cy |NERDComYankComment|**
|
|
||||||
Same as \<leader\>cc except that the commented line(s) are yanked first.
|
|
||||||
|
|
||||||
|
|
||||||
**\<leader\>c$ |NERDComEOLComment|**
|
|
||||||
Comments the current line from the cursor to the end of line.
|
|
||||||
|
|
||||||
|
|
||||||
**\<leader\>cA |NERDComAppendComment|**
|
|
||||||
Adds comment delimiters to the end of line and goes into insert mode between
|
|
||||||
them.
|
|
||||||
|
|
||||||
|
|
||||||
**|NERDComInsertComment|**
|
|
||||||
Adds comment delimiters at the current cursor position and inserts between.
|
|
||||||
Disabled by default.
|
|
||||||
|
|
||||||
|
|
||||||
**\<leader\>ca |NERDComAltDelim|**
|
|
||||||
Switches to the alternative set of delimiters.
|
|
||||||
|
|
||||||
|
|
||||||
**[count]\<leader\>cl**
|
|
||||||
**[count]\<leader\>cb |NERDComAlignedComment|**
|
|
||||||
Same as |NERDComComment| except that the delimiters are aligned down the
|
|
||||||
left side (\<leader\>cl) or both sides (\<leader\>cb).
|
|
||||||
|
|
||||||
|
|
||||||
**[count]\<leader\>cu |NERDComUncommentLine|**
|
|
||||||
Uncomments the selected line(s).
|
|
||||||
@@ -83,40 +83,40 @@ See |filetype-plugin-on| for details, but basically, stick this in your vimrc >
|
|||||||
The following key mappings are provided by default (there is also a menu
|
The following key mappings are provided by default (there is also a menu
|
||||||
with items corresponding to all the mappings below):
|
with items corresponding to all the mappings below):
|
||||||
|
|
||||||
[count]|<Leader>|cc |NERDComComment|
|
[count]<leader>cc |NERDComComment|
|
||||||
Comment out the current line or text selected in visual mode.
|
Comment out the current line or text selected in visual mode.
|
||||||
|
|
||||||
|
|
||||||
[count]|<Leader>|cn |NERDComNestedComment|
|
[count]<leader>cn |NERDComNestedComment|
|
||||||
Same as |<Leader>|cc but forces nesting.
|
Same as <leader>cc but forces nesting.
|
||||||
|
|
||||||
|
|
||||||
[count]|<Leader>|c<space> |NERDComToggleComment|
|
[count]<leader>c<space> |NERDComToggleComment|
|
||||||
Toggles the comment state of the selected line(s). If the topmost selected
|
Toggles the comment state of the selected line(s). If the topmost selected
|
||||||
line is commented, all selected lines are uncommented and vice versa.
|
line is commented, all selected lines are uncommented and vice versa.
|
||||||
|
|
||||||
|
|
||||||
[count]|<Leader>|cm |NERDComMinimalComment|
|
[count]<leader>cm |NERDComMinimalComment|
|
||||||
Comments the given lines using only one set of multipart delimiters.
|
Comments the given lines using only one set of multipart delimiters.
|
||||||
|
|
||||||
|
|
||||||
[count]|<Leader>|ci |NERDComInvertComment|
|
[count]<leader>ci |NERDComInvertComment|
|
||||||
Toggles the comment state of the selected line(s) individually.
|
Toggles the comment state of the selected line(s) individually.
|
||||||
|
|
||||||
|
|
||||||
[count]|<Leader>|cs |NERDComSexyComment|
|
[count]<leader>cs |NERDComSexyComment|
|
||||||
Comments out the selected lines ``sexily''
|
Comments out the selected lines ``sexily''
|
||||||
|
|
||||||
|
|
||||||
[count]|<Leader>|cy |NERDComYankComment|
|
[count]<leader>cy |NERDComYankComment|
|
||||||
Same as |<Leader>|cc except that the commented line(s) are yanked first.
|
Same as <leader>cc except that the commented line(s) are yanked first.
|
||||||
|
|
||||||
|
|
||||||
|<Leader>|c$ |NERDComEOLComment|
|
<leader>c$ |NERDComEOLComment|
|
||||||
Comments the current line from the cursor to the end of line.
|
Comments the current line from the cursor to the end of line.
|
||||||
|
|
||||||
|
|
||||||
|<Leader>|cA |NERDComAppendComment|
|
<leader>cA |NERDComAppendComment|
|
||||||
Adds comment delimiters to the end of line and goes into insert mode between
|
Adds comment delimiters to the end of line and goes into insert mode between
|
||||||
them.
|
them.
|
||||||
|
|
||||||
@@ -126,30 +126,26 @@ Adds comment delimiters at the current cursor position and inserts between.
|
|||||||
Disabled by default.
|
Disabled by default.
|
||||||
|
|
||||||
|
|
||||||
|<Leader>|ca |NERDComAltDelim|
|
<leader>ca |NERDComAltDelim|
|
||||||
Switches to the alternative set of delimiters.
|
Switches to the alternative set of delimiters.
|
||||||
|
|
||||||
|
|
||||||
[count]|<Leader>|cl
|
[count]<leader>cl
|
||||||
[count]|<Leader>|cb |NERDComAlignedComment|
|
[count]<leader>cb |NERDComAlignedComment|
|
||||||
Same as |NERDComComment| except that the delimiters are aligned down the
|
Same as |NERDComComment| except that the delimiters are aligned down the
|
||||||
left side (|<Leader>|cl) or both sides (|<Leader>|cb).
|
left side (<leader>cl) or both sides (<leader>cb).
|
||||||
|
|
||||||
|
|
||||||
[count]|<Leader>|cu |NERDComUncommentLine|
|
[count]<leader>cu |NERDComUncommentLine|
|
||||||
Uncomments the selected line(s).
|
Uncomments the selected line(s).
|
||||||
|
|
||||||
|
|
||||||
With the optional repeat.vim plugin (vimscript #2136), the mappings can also
|
|
||||||
be repeated via |.|
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
3.2 Functionality details *NERDComFunctionalityDetails*
|
3.2 Functionality details *NERDComFunctionalityDetails*
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
3.2.1 Comment map *NERDComComment*
|
3.2.1 Comment map *NERDComComment*
|
||||||
|
|
||||||
Default mapping: [count]|<Leader>|cc
|
Default mapping: [count]<leader>cc
|
||||||
Mapped to: <plug>NERDCommenterComment
|
Mapped to: <plug>NERDCommenterComment
|
||||||
Applicable modes: normal visual visual-line visual-block.
|
Applicable modes: normal visual visual-line visual-block.
|
||||||
|
|
||||||
@@ -165,11 +161,11 @@ lines were selected in visual-line mode.
|
|||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
3.2.2 Nested comment map *NERDComNestedComment*
|
3.2.2 Nested comment map *NERDComNestedComment*
|
||||||
|
|
||||||
Default mapping: [count]|<Leader>|cn
|
Default mapping: [count]<leader>cn
|
||||||
Mapped to: <plug>NERDCommenterNested
|
Mapped to: <plug>NERDCommenterNest
|
||||||
Applicable modes: normal visual visual-line visual-block.
|
Applicable modes: normal visual visual-line visual-block.
|
||||||
|
|
||||||
Performs nested commenting. Works the same as |<Leader>|cc except that if a line
|
Performs nested commenting. Works the same as <leader>cc except that if a line
|
||||||
is already commented then it will be commented again.
|
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
|
||||||
@@ -186,7 +182,7 @@ Related options:
|
|||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
3.2.3 Toggle comment map *NERDComToggleComment*
|
3.2.3 Toggle comment map *NERDComToggleComment*
|
||||||
|
|
||||||
Default mapping: [count]|<Leader>|c<space>
|
Default mapping: [count]<leader>c<space>
|
||||||
Mapped to: <plug>NERDCommenterToggle
|
Mapped to: <plug>NERDCommenterToggle
|
||||||
Applicable modes: normal visual-line.
|
Applicable modes: normal visual-line.
|
||||||
|
|
||||||
@@ -203,14 +199,14 @@ lines were selected in visual-line mode.
|
|||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
3.2.4 Minimal comment map *NERDComMinimalComment*
|
3.2.4 Minimal comment map *NERDComMinimalComment*
|
||||||
|
|
||||||
Default mapping: [count]|<Leader>|cm
|
Default mapping: [count]<leader>cm
|
||||||
Mapped to: <plug>NERDCommenterMinimal
|
Mapped to: <plug>NERDCommenterMinimal
|
||||||
Applicable modes: normal visual-line.
|
Applicable modes: normal visual-line.
|
||||||
|
|
||||||
Comments the selected lines using one set of multipart delimiters if possible.
|
Comments the selected lines using one set of multipart delimiters if possible.
|
||||||
|
|
||||||
For example: if you are programming in c and you select 5 lines and press
|
For example: if you are programming in c and you select 5 lines and press
|
||||||
|<Leader>|cm then a '/*' will be placed at the start of the top line and a '*/'
|
<leader>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.
|
will be placed at the end of the last line.
|
||||||
|
|
||||||
Sets of multipart comment delimiters that are between the top and bottom
|
Sets of multipart comment delimiters that are between the top and bottom
|
||||||
@@ -225,11 +221,11 @@ lines were selected in visual-line mode.
|
|||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
3.2.5 Invert comment map *NERDComInvertComment*
|
3.2.5 Invert comment map *NERDComInvertComment*
|
||||||
|
|
||||||
Default mapping: |<Leader>|ci
|
Default mapping: <leader>ci
|
||||||
Mapped to: <plug>NERDCommenterInvert
|
Mapped to: <plug>NERDCommenterInvert
|
||||||
Applicable modes: normal visual-line.
|
Applicable modes: normal visual-line.
|
||||||
|
|
||||||
Inverts the commented state of each selected line. If the selected line is
|
Inverts the commented state of each selected line. If the a selected line is
|
||||||
commented then it is uncommented and vice versa. Each line is examined and
|
commented then it is uncommented and vice versa. Each line is examined and
|
||||||
commented/uncommented individually.
|
commented/uncommented individually.
|
||||||
|
|
||||||
@@ -242,11 +238,11 @@ lines were selected in visual-line mode.
|
|||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
3.2.6 Sexy comment map *NERDComSexyComment*
|
3.2.6 Sexy comment map *NERDComSexyComment*
|
||||||
|
|
||||||
Default mapping: [count]|<Leader>|cs
|
Default mapping: [count]<leader>cs
|
||||||
Mapped to: <plug>NERDCommenterSexy
|
Mapped to: <plug>NERDCommenterSexy
|
||||||
Applicable modes: normal, visual-line.
|
Applicable modes: normal, visual-line.
|
||||||
|
|
||||||
Comments the selected line(s) ``sexily''. See |NERDComSexyComments| for
|
Comments the selected line(s) ``sexily''... see |NERDComSexyComments| for
|
||||||
a description of what sexy comments are. Can only be done on filetypes for
|
a description of what sexy comments are. Can only be done on filetypes for
|
||||||
which there is at least one set of multipart comment delimiters specified.
|
which there is at least one set of multipart comment delimiters specified.
|
||||||
|
|
||||||
@@ -262,16 +258,16 @@ Related options:
|
|||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
3.2.7 Yank comment map *NERDComYankComment*
|
3.2.7 Yank comment map *NERDComYankComment*
|
||||||
|
|
||||||
Default mapping: [count]|<Leader>|cy
|
Default mapping: [count]<leader>cy
|
||||||
Mapped to: <plug>NERDCommenterYank
|
Mapped to: <plug>NERDCommenterYank
|
||||||
Applicable modes: normal visual visual-line visual-block.
|
Applicable modes: normal visual visual-line visual-block.
|
||||||
|
|
||||||
Same as |<Leader>|cc except that it yanks the line(s) that are commented first.
|
Same as <leader>cc except that it yanks the line(s) that are commented first.
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
3.2.8 Comment to EOL map *NERDComEOLComment*
|
3.2.8 Comment to EOL map *NERDComEOLComment*
|
||||||
|
|
||||||
Default mapping: |<Leader>|c$
|
Default mapping: <leader>c$
|
||||||
Mapped to: <plug>NERDCommenterToEOL
|
Mapped to: <plug>NERDCommenterToEOL
|
||||||
Applicable modes: normal.
|
Applicable modes: normal.
|
||||||
|
|
||||||
@@ -281,7 +277,7 @@ the line.
|
|||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
3.2.9 Append com to line map *NERDComAppendComment*
|
3.2.9 Append com to line map *NERDComAppendComment*
|
||||||
|
|
||||||
Default mapping: |<Leader>|cA
|
Default mapping: <leader>cA
|
||||||
Mapped to: <plug>NERDCommenterAppend
|
Mapped to: <plug>NERDCommenterAppend
|
||||||
Applicable modes: normal.
|
Applicable modes: normal.
|
||||||
|
|
||||||
@@ -292,27 +288,27 @@ to insert mode between the new delimiters.
|
|||||||
3.2.10 Insert comment map *NERDComInsertComment*
|
3.2.10 Insert comment map *NERDComInsertComment*
|
||||||
|
|
||||||
Default mapping: disabled by default.
|
Default mapping: disabled by default.
|
||||||
Map it to: <plug>NERDCommenterInsert
|
Map it to: <plug>NERDCommenterInInsert
|
||||||
Applicable modes: insert.
|
Applicable modes: insert.
|
||||||
|
|
||||||
Adds comment delimiters at the current cursor position and inserts
|
Adds comment delimiters at the current cursor position and inserts
|
||||||
between them.
|
between them.
|
||||||
|
|
||||||
NOTE: prior to version 2.1.17 this was mapped to <C-c>. To restore this
|
NOTE: prior to version 2.1.17 this was mapped to ctrl-c. To restore this
|
||||||
mapping add >
|
mapping add >
|
||||||
imap <C-c> <plug>NERDCommenterInsert
|
let NERDComInsertMap='<c-c>'
|
||||||
<
|
<
|
||||||
to your vimrc.
|
to your vimrc.
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
3.2.11 Use alternate delims map *NERDComAltDelim*
|
3.2.11 Use alternate delims map *NERDComAltDelim*
|
||||||
|
|
||||||
Default mapping: |<Leader>|ca
|
Default mapping: <leader>ca
|
||||||
Mapped to: <plug>NERDCommenterAltDelims
|
Mapped to: <plug>NERDCommenterAltDelims
|
||||||
Applicable modes: normal.
|
Applicable modes: normal.
|
||||||
|
|
||||||
Changes to the alternative commenting style if one is available. For example,
|
Changes to the alternative commenting style if one is available. For example,
|
||||||
if the user is editing a c++ file using // comments and they hit |<Leader>|ca
|
if the user is editing a c++ file using // comments and they hit <leader>ca
|
||||||
then they will be switched over to /**/ comments.
|
then they will be switched over to /**/ comments.
|
||||||
|
|
||||||
See also |NERDComDefaultDelims|
|
See also |NERDComDefaultDelims|
|
||||||
@@ -320,12 +316,12 @@ See also |NERDComDefaultDelims|
|
|||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
3.2.12 Comment aligned maps *NERDComAlignedComment*
|
3.2.12 Comment aligned maps *NERDComAlignedComment*
|
||||||
|
|
||||||
Default mappings: [count]|<Leader>|cl [count]|<Leader>|cb
|
Default mappings: [count]<leader>cl [count]<leader>cb
|
||||||
Mapped to: <plug>NERDCommenterAlignLeft
|
Mapped to: <plug>NERDCommenterAlignLeft
|
||||||
<plug>NERDCommenterAlignBoth
|
<plug>NERDCommenterAlignBoth
|
||||||
Applicable modes: normal visual-line.
|
Applicable modes: normal visual-line.
|
||||||
|
|
||||||
Same as |<Leader>|cc except that the comment delimiters are aligned on the left
|
Same as <leader>cc except that the comment delimiters are aligned on the left
|
||||||
side or both sides respectively. These comments are always nested if the
|
side or both sides respectively. These comments are always nested if the
|
||||||
line(s) are already commented.
|
line(s) are already commented.
|
||||||
|
|
||||||
@@ -335,7 +331,7 @@ lines were selected in visual-line mode.
|
|||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
3.2.13 Uncomment line map *NERDComUncommentLine*
|
3.2.13 Uncomment line map *NERDComUncommentLine*
|
||||||
|
|
||||||
Default mapping: [count]|<Leader>|cu
|
Default mapping: [count]<leader>cu
|
||||||
Mapped to: <plug>NERDCommenterUncomment
|
Mapped to: <plug>NERDCommenterUncomment
|
||||||
Applicable modes: normal visual visual-line visual-block.
|
Applicable modes: normal visual visual-line visual-block.
|
||||||
|
|
||||||
@@ -343,9 +339,9 @@ Uncomments the current line. If multiple lines are selected in
|
|||||||
visual mode then they are all uncommented.
|
visual mode then they are all uncommented.
|
||||||
|
|
||||||
When uncommenting, if the line contains multiple sets of delimiters then the
|
When uncommenting, if the line contains multiple sets of delimiters then the
|
||||||
``outermost'' pair of delimiters will be removed.
|
``outtermost'' pair of delimiters will be removed.
|
||||||
|
|
||||||
The script uses a set of heuristics to distinguish ``real'' delimiters from
|
The script uses a set of heurisics to distinguish ``real'' delimiters from
|
||||||
``fake'' ones when uncommenting. See |NERDComIssues| for details.
|
``fake'' ones when uncommenting. See |NERDComIssues| for details.
|
||||||
|
|
||||||
If a [count] is given in normal mode, the mapping works as though that many
|
If a [count] is given in normal mode, the mapping works as though that many
|
||||||
@@ -376,14 +372,16 @@ Here the multipart delimiters are /* and */ and the marker is *.
|
|||||||
All of the NERD commenter mappings and menu items invoke a single function
|
All of the NERD commenter mappings and menu items invoke a single function
|
||||||
which delegates the commenting work to other functions. This function is
|
which delegates the commenting work to other functions. This function is
|
||||||
public and has the prototype: >
|
public and has the prototype: >
|
||||||
function! NERDComment(mode, type)
|
function! NERDComment(isVisual, type)
|
||||||
<
|
<
|
||||||
The arguments to this function are simple:
|
The arguments to this function are simple:
|
||||||
- mode: a character indicating the mode in which the comment is requested:
|
- isVisual: if you wish to do any kind of visual comment then set this to
|
||||||
'n' for Normal mode, 'x' for Visual mode
|
1 and the function will use the '< and '> marks to find the comment
|
||||||
|
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
|
- type: is used to specify what type of commenting operation is to be
|
||||||
performed, and it can be one of the following: "sexy", "invert",
|
performed, and it can be one of the following: "sexy", "invert",
|
||||||
"minimal", "toggle", "alignLeft", "alignBoth", "comment", "nested",
|
"minimal", "toggle", "alignLeft", "alignBoth", "norm", "nested",
|
||||||
"toEOL", "append", "insert", "uncomment", "yank"
|
"toEOL", "append", "insert", "uncomment", "yank"
|
||||||
|
|
||||||
For example, if you typed >
|
For example, if you typed >
|
||||||
@@ -399,15 +397,13 @@ then the script would do a sexy comment on the last visual selection.
|
|||||||
4.1 Options summary *NERDComOptionsSummary*
|
4.1 Options summary *NERDComOptionsSummary*
|
||||||
|
|
||||||
|'loaded_nerd_comments'| Turns off the script.
|
|'loaded_nerd_comments'| Turns off the script.
|
||||||
|'NERDAllowAnyVisualDelims'| Allows multipart alternative delimiters
|
|'NERDAllowAnyVisualDelims'| Allows multipart alternative delims to
|
||||||
to be used when commenting in
|
be used when commenting in
|
||||||
visual/visual-block mode.
|
visual/visual-block mode.
|
||||||
|'NERDBlockComIgnoreEmpty'| Forces right delimiters to be placed
|
|'NERDBlockComIgnoreEmpty'| Forces right delims to be placed when
|
||||||
when doing visual-block comments.
|
doing visual-block comments.
|
||||||
|'NERDCommentWholeLinesInVMode'| Changes behaviour of visual comments.
|
|'NERDCommentWholeLinesInVMode'| Changes behaviour of visual comments.
|
||||||
|'NERDCreateDefaultMappings'| Turn the default mappings on/off.
|
|'NERDCreateDefaultMappings'| Turn the default mappings on/off.
|
||||||
|'NERDCustomDelimiters'| Add or override delimiters for any
|
|
||||||
filetypes.
|
|
||||||
|'NERDDefaultNesting'| Tells the script to use nested comments
|
|'NERDDefaultNesting'| Tells the script to use nested comments
|
||||||
by default.
|
by default.
|
||||||
|'NERDMenuMode'| Specifies how the NERD commenter menu
|
|'NERDMenuMode'| Specifies how the NERD commenter menu
|
||||||
@@ -433,9 +429,6 @@ then the script would do a sexy comment on the last visual selection.
|
|||||||
uncommenting.
|
uncommenting.
|
||||||
|'NERDCompactSexyComs'| Specifies whether to use the compact
|
|'NERDCompactSexyComs'| Specifies whether to use the compact
|
||||||
style sexy comments.
|
style sexy comments.
|
||||||
|'NERDDefaultAlign'| Specifies the default alignment to use,
|
|
||||||
one of 'none', 'left', 'start', or
|
|
||||||
'both'.
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
4.3 Options details *NERDComOptionsDetails*
|
4.3 Options details *NERDComOptionsDetails*
|
||||||
@@ -464,8 +457,8 @@ example if we are editing the following java code: >
|
|||||||
<
|
<
|
||||||
If we are using // comments and select the "foo" and "bar" in visual-block
|
If we are using // comments and select the "foo" and "bar" in visual-block
|
||||||
mode, as shown left below (where '|'s are used to represent the visual-block
|
mode, as shown left below (where '|'s are used to represent the visual-block
|
||||||
boundary), and comment it then the script will use the alternative delimiters
|
boundary), and comment it then the script will use the alternative delims as
|
||||||
as shown on the right: >
|
shown on the right: >
|
||||||
|
|
||||||
float |foo| = 1221; float /*foo*/ = 1221;
|
float |foo| = 1221; float /*foo*/ = 1221;
|
||||||
float |bar| = 324; float /*bar*/ = 324;
|
float |bar| = 324; float /*bar*/ = 324;
|
||||||
@@ -541,7 +534,7 @@ If you prefer the second option then stick this line in your vimrc: >
|
|||||||
<
|
<
|
||||||
|
|
||||||
If the filetype you are editing only has no multipart delimiters (for example
|
If the filetype you are editing only has no multipart delimiters (for example
|
||||||
a shell script) and you hadn't set this option then the above would become >
|
a shell script) and you hadnt set this option then the above would become >
|
||||||
in#t foo = 3;
|
in#t foo = 3;
|
||||||
#int bar = 9;
|
#int bar = 9;
|
||||||
<
|
<
|
||||||
@@ -557,7 +550,7 @@ Note that this option does not affect the behaviour of commenting in
|
|||||||
|visual-block| mode.
|
|visual-block| mode.
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
*'NERDCreateDefaultMappings'*
|
*'NERDCreateDefaultMappings'*
|
||||||
Values: 0 or 1.
|
Values: 0 or 1.
|
||||||
Default: 1.
|
Default: 1.
|
||||||
|
|
||||||
@@ -565,25 +558,6 @@ If set to 0, none of the default mappings will be created.
|
|||||||
|
|
||||||
See also |NERDComMappings|.
|
See also |NERDComMappings|.
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
*'NERDCustomDelimiters'*
|
|
||||||
Values: A map (format specified below).
|
|
||||||
Default: {}
|
|
||||||
|
|
||||||
Use this option if you have new filetypes you want the script to handle, or if
|
|
||||||
you want to override the default delimiters of a filetype.
|
|
||||||
|
|
||||||
Example: >
|
|
||||||
let g:NERDCustomDelimiters = {
|
|
||||||
\ 'ruby': { 'left': '#', 'leftAlt': 'FOO', 'rightAlt': 'BAR' },
|
|
||||||
\ 'grondle': { 'left': '{{', 'right': '}}' }
|
|
||||||
\ }
|
|
||||||
<
|
|
||||||
|
|
||||||
Here we override the delimiter settings for ruby and add FOO/BAR as alternative
|
|
||||||
delimiters. We also add {{ and }} as delimiters for a new filetype called
|
|
||||||
'grondle'.
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
*'NERDRemoveAltComs'*
|
*'NERDRemoveAltComs'*
|
||||||
Values: 0 or 1.
|
Values: 0 or 1.
|
||||||
@@ -594,7 +568,7 @@ this option tells the script whether to look for, and remove, comment
|
|||||||
delimiters of the alternative style.
|
delimiters of the alternative style.
|
||||||
|
|
||||||
For example, if you are editing a c++ file using // style comments and you go
|
For example, if you are editing a c++ file using // style comments and you go
|
||||||
|<Leader>|cu on this line: >
|
<leader>cu on this line: >
|
||||||
/* This is a c++ comment baby! */
|
/* This is a c++ comment baby! */
|
||||||
<
|
<
|
||||||
It will not be uncommented if the NERDRemoveAltComs is set to 0.
|
It will not be uncommented if the NERDRemoveAltComs is set to 0.
|
||||||
@@ -602,7 +576,7 @@ It will not be uncommented if the NERDRemoveAltComs is set to 0.
|
|||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
*'NERDRemoveExtraSpaces'*
|
*'NERDRemoveExtraSpaces'*
|
||||||
Values: 0 or 1.
|
Values: 0 or 1.
|
||||||
Default: 0.
|
Default: 1.
|
||||||
|
|
||||||
By default, the NERD commenter will remove spaces around comment delimiters if
|
By default, the NERD commenter will remove spaces around comment delimiters if
|
||||||
either:
|
either:
|
||||||
@@ -625,14 +599,8 @@ Otherwise they would become: >
|
|||||||
int bar = 10;
|
int bar = 10;
|
||||||
int baz = foo + bar
|
int baz = foo + bar
|
||||||
<
|
<
|
||||||
|
If you want the spaces to be removed only if |'NERDSpaceDelims'| is set then
|
||||||
Note: When using 'start' as the default alignment, the enabling of
|
set NERDRemoveExtraSpaces to 0.
|
||||||
NERDRemoveExtraSpaces will still result in the removal of a space after the
|
|
||||||
delimiter. This can be undesirable since aligning the delimiters at the very
|
|
||||||
start of the line (index 0) will usually result in spaces between the comment
|
|
||||||
delimiters and the text which probably shouldn't be removed. So when using
|
|
||||||
'start' as the default alignment, take care to also disable
|
|
||||||
NERDRemoveExtraSpaces.
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
*'NERDLPlace'*
|
*'NERDLPlace'*
|
||||||
@@ -652,7 +620,7 @@ To set these options use lines like: >
|
|||||||
Following the above example, if we have line of c code: >
|
Following the above example, if we have line of c code: >
|
||||||
/* int horse */
|
/* int horse */
|
||||||
<
|
<
|
||||||
and we comment it with |<Leader>|cn it will be changed to: >
|
and we comment it with <leader>cn it will be changed to: >
|
||||||
/*FOO int horse BAR*/
|
/*FOO int horse BAR*/
|
||||||
<
|
<
|
||||||
When we uncomment this line it will go back to what it was.
|
When we uncomment this line it will go back to what it was.
|
||||||
@@ -665,7 +633,7 @@ Default: 3
|
|||||||
This option can take 4 values:
|
This option can take 4 values:
|
||||||
"0": Turns the menu off.
|
"0": Turns the menu off.
|
||||||
"1": Turns the 'comment' menu on with no menu shortcut.
|
"1": Turns the 'comment' menu on with no menu shortcut.
|
||||||
"2": Turns the 'comment' menu on with <alt>-c as the shortcut.
|
"2": Turns the 'comment 'menu on with <alt>-c as the shortcut.
|
||||||
"3": Turns the 'Plugin -> comment' menu on with <alt>-c as the shortcut.
|
"3": Turns the 'Plugin -> comment' menu on with <alt>-c as the shortcut.
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
@@ -692,17 +660,6 @@ If you want spaces to be added then set NERDSpaceDelims to 1 in your vimrc.
|
|||||||
|
|
||||||
See also |'NERDRemoveExtraSpaces'|.
|
See also |'NERDRemoveExtraSpaces'|.
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
*'NERDDefaultAlign'*
|
|
||||||
Values: 'none', 'left', 'start', 'both'
|
|
||||||
Default 'none'.
|
|
||||||
|
|
||||||
Specifies the default alignment to use when inserting comments.
|
|
||||||
|
|
||||||
Note: When using 'start' as the default alignment be sure to disable
|
|
||||||
NERDRemoveExtraSpaces. See the note at the bottom of |NERDRemoveExtraSpaces|
|
|
||||||
for more details.
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
*'NERDCompactSexyComs'*
|
*'NERDCompactSexyComs'*
|
||||||
Values: 0 or 1.
|
Values: 0 or 1.
|
||||||
@@ -728,7 +685,7 @@ Values: 0 or 1.
|
|||||||
Default 1.
|
Default 1.
|
||||||
|
|
||||||
When this option is set to 1, comments are nested automatically. That is, if
|
When this option is set to 1, comments are nested automatically. That is, if
|
||||||
you hit |<Leader>|cc on a line that is already commented it will be commented
|
you hit <leader>cc on a line that is already commented it will be commented
|
||||||
again.
|
again.
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
@@ -771,7 +728,7 @@ Heuristics are used to distinguish the real comment delimiters
|
|||||||
|
|
||||||
Because we have comment mappings that place delimiters in the middle of lines,
|
Because we have comment mappings that place delimiters in the middle of lines,
|
||||||
removing comment delimiters is a bit tricky. This is because if comment
|
removing comment delimiters is a bit tricky. This is because if comment
|
||||||
delimiters appear in a line doesn't mean they really ARE delimiters. For
|
delimiters appear in a line doesnt mean they really ARE delimiters. For
|
||||||
example, Java uses // comments but the line >
|
example, Java uses // comments but the line >
|
||||||
System.out.println("//");
|
System.out.println("//");
|
||||||
<
|
<
|
||||||
@@ -791,11 +748,11 @@ If we have some line of code like this: >
|
|||||||
/*int foo */ = /*5 + 9;*/
|
/*int foo */ = /*5 + 9;*/
|
||||||
<
|
<
|
||||||
This will not be uncommented legally. The NERD commenter will remove the
|
This will not be uncommented legally. The NERD commenter will remove the
|
||||||
"outer most" delimiters so the line will become: >
|
"outter most" delimiters so the line will become: >
|
||||||
int foo */ = /*5 + 9;
|
int foo */ = /*5 + 9;
|
||||||
<
|
<
|
||||||
which almost certainly will not be what you want. Nested sets of comments will
|
which almost certainly will not be what you want. Nested sets of comments will
|
||||||
uncomment fine though. E.g.: >
|
uncomment fine though. Eg: >
|
||||||
/*int/* foo =*/ 5 + 9;*/
|
/*int/* foo =*/ 5 + 9;*/
|
||||||
<
|
<
|
||||||
will become: >
|
will become: >
|
||||||
@@ -809,10 +766,10 @@ for simplicity)
|
|||||||
|
|
||||||
The author of the NERD commenter is Martyzillatron --- the half robot, half
|
The author of the NERD commenter is Martyzillatron --- the half robot, half
|
||||||
dinosaur bastard son of Megatron and Godzilla. He enjoys destroying
|
dinosaur bastard son of Megatron and Godzilla. He enjoys destroying
|
||||||
metropolises and eating tourist buses.
|
metropolises and eating tourist busses.
|
||||||
|
|
||||||
Drop him a line at martin_grenfell at msn.com. He would love to hear from you.
|
Drop him a line at martin_grenfell at msn.com. He would love to hear from you.
|
||||||
It's a lonely life being the worlds premier terror machine. How would you feel
|
its a lonely life being the worlds premier terror machine. How would you feel
|
||||||
if your face looked like a toaster and a t-rex put together? :(
|
if your face looked like a toaster and a t-rex put together? :(
|
||||||
|
|
||||||
The latest stable versions can be found at
|
The latest stable versions can be found at
|
||||||
@@ -824,12 +781,12 @@ The latest dev versions are on github
|
|||||||
==============================================================================
|
==============================================================================
|
||||||
8. Changelog *NERDComChangelog*
|
8. Changelog *NERDComChangelog*
|
||||||
|
|
||||||
2.3.0
|
2.2.3
|
||||||
- remove all filetypes which have a &commentstring in the standard vim
|
- remove all filetypes which have a &commentstring in the standard vim
|
||||||
runtime for vim > 7.0 unless the script stores an alternate set of
|
runtime for vim > 7.0 unless the script stores an alternate set of
|
||||||
delimiters
|
delimiters
|
||||||
- make the script complain if the user doesn't have filetype plugins enabled
|
- make the script complain if the user doesnt have filetype plugins enabled
|
||||||
- use |<Leader>| instead of comma to start the default mappings
|
- use <leader> instead of comma to start the default mappings
|
||||||
- fix a couple of bugs with sexy comments - thanks to Tim Smart
|
- fix a couple of bugs with sexy comments - thanks to Tim Smart
|
||||||
- lots of refactoring
|
- lots of refactoring
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user