mirror of
https://github.com/preservim/nerdcommenter.git
synced 2025-02-01 02:07:14 +08:00
make the mappings to being with <leader>
This commit is contained in:
parent
d868eae71b
commit
02c726c6d1
|
@ -62,40 +62,40 @@ taste.
|
|||
The following key mappings are provided by default (there is also a menu
|
||||
with items corresponding to all the mappings below):
|
||||
|
||||
[count],cc |NERDComComment|
|
||||
[count]<leader>cc |NERDComComment|
|
||||
Comment out the current line or text selected in visual mode.
|
||||
|
||||
|
||||
[count],cn |NERDComNestedComment|
|
||||
Same as ,cc but forces nesting.
|
||||
[count]<leader>cn |NERDComNestedComment|
|
||||
Same as <leader>cc but forces nesting.
|
||||
|
||||
|
||||
[count],c<space> |NERDComToggleComment|
|
||||
[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],cm |NERDComMinimalComment|
|
||||
[count]<leader>cm |NERDComMinimalComment|
|
||||
Comments the given lines using only one set of multipart delimiters.
|
||||
|
||||
|
||||
[count],ci |NERDComInvertComment|
|
||||
[count]<leader>ci |NERDComInvertComment|
|
||||
Toggles the comment state of the selected line(s) individually.
|
||||
|
||||
|
||||
[count],cs |NERDComSexyComment|
|
||||
[count]<leader>cs |NERDComSexyComment|
|
||||
Comments out the selected lines ``sexily''
|
||||
|
||||
|
||||
[count],cy |NERDComYankComment|
|
||||
Same as ,cc except that the commented line(s) are yanked first.
|
||||
[count]<leader>cy |NERDComYankComment|
|
||||
Same as <leader>cc except that the commented line(s) are yanked first.
|
||||
|
||||
|
||||
,c$ |NERDComEOLComment|
|
||||
<leader>c$ |NERDComEOLComment|
|
||||
Comments the current line from the cursor to the end of line.
|
||||
|
||||
|
||||
,cA |NERDComAppendComment|
|
||||
<leader>cA |NERDComAppendComment|
|
||||
Adds comment delimiters to the end of line and goes into insert mode between
|
||||
them.
|
||||
|
||||
|
@ -105,17 +105,17 @@ Adds comment delimiters at the current cursor position and inserts between.
|
|||
Disabled by default.
|
||||
|
||||
|
||||
,ca |NERDComAltDelim|
|
||||
<leader>ca |NERDComAltDelim|
|
||||
Switches to the alternative set of delimiters.
|
||||
|
||||
|
||||
[count],cl
|
||||
[count],cb |NERDComAlignedComment|
|
||||
[count]<leader>cl
|
||||
[count]<leader>cb |NERDComAlignedComment|
|
||||
Same as |NERDComComment| except that the delimiters are aligned down the
|
||||
left side (,cl) or both sides (,cb).
|
||||
left side (<leader>cl) or both sides (<leader>cb).
|
||||
|
||||
|
||||
[count],cu |NERDComUncommentLine|
|
||||
[count]<leader>cu |NERDComUncommentLine|
|
||||
Uncomments the selected line(s).
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
@ -124,7 +124,7 @@ Uncomments the selected line(s).
|
|||
------------------------------------------------------------------------------
|
||||
2.2.1 Comment map *NERDComComment*
|
||||
|
||||
Default mapping: [count],cc
|
||||
Default mapping: [count]<leader>cc
|
||||
Mapped to: <plug>NERDCommenterComment
|
||||
Applicable modes: normal visual visual-line visual-block.
|
||||
|
||||
|
@ -140,12 +140,12 @@ lines were selected in visual-line mode.
|
|||
------------------------------------------------------------------------------
|
||||
2.2.2 Nested comment map *NERDComNestedComment*
|
||||
|
||||
Default mapping: [count],cn
|
||||
Default mapping: [count]<leader>cn
|
||||
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 <leader>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
|
||||
be replaced by place-holder delimiters if needed. Otherwise the nested
|
||||
|
@ -161,7 +161,7 @@ Related options:
|
|||
------------------------------------------------------------------------------
|
||||
2.2.3 Toggle comment map *NERDComToggleComment*
|
||||
|
||||
Default mapping: [count],c<space>
|
||||
Default mapping: [count]<leader>c<space>
|
||||
Mapped to: <plug>NERDCommenterToggle
|
||||
Applicable modes: normal visual-line.
|
||||
|
||||
|
@ -178,15 +178,15 @@ lines were selected in visual-line mode.
|
|||
------------------------------------------------------------------------------
|
||||
2.2.4 Minimal comment map *NERDComMinimalComment*
|
||||
|
||||
Default mapping: [count],cm
|
||||
Default mapping: [count]<leader>cm
|
||||
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
|
||||
<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.
|
||||
|
||||
Sets of multipart comment delimiters that are between the top and bottom
|
||||
selected lines are replaced with place holders (see |'NERDLPlace'|) if
|
||||
|
@ -200,7 +200,7 @@ lines were selected in visual-line mode.
|
|||
------------------------------------------------------------------------------
|
||||
2.2.5 Invert comment map *NERDComInvertComment*
|
||||
|
||||
Default mapping: ,ci
|
||||
Default mapping: <leader>ci
|
||||
Mapped to: <plug>NERDCommenterInvert
|
||||
Applicable modes: normal visual-line.
|
||||
|
||||
|
@ -217,7 +217,7 @@ lines were selected in visual-line mode.
|
|||
------------------------------------------------------------------------------
|
||||
2.2.6 Sexy comment map *NERDComSexyComment*
|
||||
|
||||
Default mapping: [count],cs
|
||||
Default mapping: [count]<leader>cs
|
||||
Mapped to: <plug>NERDCommenterSexy
|
||||
Applicable modes: normal, visual-line.
|
||||
|
||||
|
@ -237,16 +237,16 @@ Related options:
|
|||
------------------------------------------------------------------------------
|
||||
2.2.7 Yank comment map *NERDComYankComment*
|
||||
|
||||
Default mapping: [count],cy
|
||||
Default mapping: [count]<leader>cy
|
||||
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.
|
||||
Same as <leader>cc except that it yanks the line(s) that are commented first.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
2.2.8 Comment to EOL map *NERDComEOLComment*
|
||||
|
||||
Default mapping: ,c$
|
||||
Default mapping: <leader>c$
|
||||
Mapped to: <plug>NERDCommenterToEOL
|
||||
Applicable modes: normal.
|
||||
|
||||
|
@ -256,7 +256,7 @@ the line.
|
|||
------------------------------------------------------------------------------
|
||||
2.2.9 Append com to line map *NERDComAppendComment*
|
||||
|
||||
Default mapping: ,cA
|
||||
Default mapping: <leader>cA
|
||||
Mapped to: <plug>NERDCommenterAppend
|
||||
Applicable modes: normal.
|
||||
|
||||
|
@ -282,12 +282,12 @@ to your vimrc.
|
|||
------------------------------------------------------------------------------
|
||||
2.2.11 Use alternate delims map *NERDComAltDelim*
|
||||
|
||||
Default mapping: ,ca
|
||||
Default mapping: <leader>ca
|
||||
Mapped to: <plug>NERDCommenterAltDelims
|
||||
Applicable modes: normal.
|
||||
|
||||
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 ,ca
|
||||
if the user is editing a c++ file using // comments and they hit <leader>ca
|
||||
then they will be switched over to /**/ comments.
|
||||
|
||||
See also |NERDComDefaultDelims|
|
||||
|
@ -295,14 +295,14 @@ See also |NERDComDefaultDelims|
|
|||
------------------------------------------------------------------------------
|
||||
2.2.12 Comment aligned maps *NERDComAlignedComment*
|
||||
|
||||
Default mappings: [count],cl [count],cb
|
||||
Default mappings: [count]<leader>cl [count]<leader>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 or
|
||||
both sides respectively. These comments are always nested if the line(s) are
|
||||
already commented.
|
||||
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
|
||||
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.
|
||||
|
@ -310,7 +310,7 @@ lines were selected in visual-line mode.
|
|||
------------------------------------------------------------------------------
|
||||
2.2.13 Uncomment line map *NERDComUncommentLine*
|
||||
|
||||
Default mapping: [count],cu
|
||||
Default mapping: [count]<leader>cu
|
||||
Mapped to: <plug>NERDCommenterUncomment
|
||||
Applicable modes: normal visual visual-line visual-block.
|
||||
|
||||
|
@ -581,7 +581,7 @@ 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
|
||||
,cu on this line: >
|
||||
<leader>cu on this line: >
|
||||
/* This is a c++ comment baby! */
|
||||
<
|
||||
It will not be uncommented if the NERDRemoveAltComs is set to 0.
|
||||
|
@ -633,7 +633,7 @@ To set these options use lines like: >
|
|||
Following the above example, if we have line of c code: >
|
||||
/* int horse */
|
||||
<
|
||||
and we comment it with ,cn it will be changed to: >
|
||||
and we comment it with <leader>cn it will be changed to: >
|
||||
/*FOO int horse BAR*/
|
||||
<
|
||||
When we uncomment this line it will go back to what it was.
|
||||
|
@ -698,7 +698,8 @@ 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 <leader>cc on a line that is already commented it will be commented
|
||||
again.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
3.3 Default delimiter customisation *NERDComDefaultDelims*
|
||||
|
|
|
@ -2725,21 +2725,21 @@ function! s:CreateMaps(target, combo)
|
|||
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')
|
||||
call s:CreateMaps('<plug>NERDCommenterComment', '<leader>cc')
|
||||
call s:CreateMaps('<plug>NERDCommenterToggle', '<leader>c<space>')
|
||||
call s:CreateMaps('<plug>NERDCommenterMinimal', '<leader>cm')
|
||||
call s:CreateMaps('<plug>NERDCommenterSexy', '<leader>cs')
|
||||
call s:CreateMaps('<plug>NERDCommenterInvert', '<leader>ci')
|
||||
call s:CreateMaps('<plug>NERDCommenterYank', '<leader>cy')
|
||||
call s:CreateMaps('<plug>NERDCommenterAlignLeft', '<leader>cl')
|
||||
call s:CreateMaps('<plug>NERDCommenterAlignBoth', '<leader>cb')
|
||||
call s:CreateMaps('<plug>NERDCommenterNest', '<leader>cn')
|
||||
call s:CreateMaps('<plug>NERDCommenterUncomment', '<leader>cu')
|
||||
call s:CreateMaps('<plug>NERDCommenterToEOL', '<leader>c$')
|
||||
call s:CreateMaps('<plug>NERDCommenterAppend', '<leader>cA')
|
||||
|
||||
if !hasmapto('<plug>NERDCommenterAltDelims', 'n')
|
||||
nmap ,ca <plug>NERDCommenterAltDelims
|
||||
nmap <leader>ca <plug>NERDCommenterAltDelims
|
||||
endif
|
||||
endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user