mirror of
https://github.com/preservim/nerdcommenter.git
synced 2025-11-09 10:13:48 -05:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9a32fd2534 | ||
|
|
e679d8a341 | ||
|
|
670dba1bb5 | ||
|
|
2f973bd4fa | ||
|
|
ff3d8d7d7c | ||
|
|
af8bb4258d |
@@ -22,7 +22,7 @@ Comment functions so powerful—no comment necessary.
|
|||||||
|
|
||||||
1. Add `NeoBundle 'scrooloose/nerdcommenter'` to your vimrc file.
|
1. Add `NeoBundle 'scrooloose/nerdcommenter'` to your vimrc file.
|
||||||
2. Reload your vimrc or restart
|
2. Reload your vimrc or restart
|
||||||
3. Run `:NeoUpdate``
|
3. Run `:NeoUpdate`
|
||||||
|
|
||||||
#### [Pathogen](https://github.com/tpope/vim-pathogen)
|
#### [Pathogen](https://github.com/tpope/vim-pathogen)
|
||||||
|
|
||||||
@@ -94,6 +94,9 @@ let g:NERDCommentEmptyLines = 1
|
|||||||
|
|
||||||
" Enable trimming of trailing whitespace when uncommenting
|
" Enable trimming of trailing whitespace when uncommenting
|
||||||
let g:NERDTrimTrailingWhitespace = 1
|
let g:NERDTrimTrailingWhitespace = 1
|
||||||
|
|
||||||
|
" Enable NERDCommenterToggle to check all selected lines is commented or not
|
||||||
|
let g:NERDToggleCheckAllLines = 1
|
||||||
```
|
```
|
||||||
|
|
||||||
### Default mappings
|
### Default mappings
|
||||||
|
|||||||
@@ -488,6 +488,9 @@ change the filetype back: >
|
|||||||
one of 'none', 'left', 'start', or
|
one of 'none', 'left', 'start', or
|
||||||
'both'.
|
'both'.
|
||||||
|
|
||||||
|
|'NERDToggleCheckAllLines'| Enable NERDCommenterToggle to check
|
||||||
|
all selected lines is commented or not.
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
4.3 Options details *NERDComOptionsDetails*
|
4.3 Options details *NERDComOptionsDetails*
|
||||||
|
|
||||||
@@ -800,6 +803,15 @@ 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.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
*'NERDToggleCheckAllLines'*
|
||||||
|
Values: 0 or 1.
|
||||||
|
Default 0.
|
||||||
|
|
||||||
|
When this option is set to 1, NERDCommenterToggle will check all selected line,
|
||||||
|
if there have oneline not be commented, then comment all lines.
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
3.3 Default delimiter customisation *NERDComDefaultDelims*
|
3.3 Default delimiter customisation *NERDComDefaultDelims*
|
||||||
|
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ call s:InitVariable("g:NERDRPlace", "<]")
|
|||||||
call s:InitVariable("g:NERDSpaceDelims", 0)
|
call s:InitVariable("g:NERDSpaceDelims", 0)
|
||||||
call s:InitVariable("g:NERDDefaultAlign", "none")
|
call s:InitVariable("g:NERDDefaultAlign", "none")
|
||||||
call s:InitVariable("g:NERDTrimTrailingWhitespace", 0)
|
call s:InitVariable("g:NERDTrimTrailingWhitespace", 0)
|
||||||
|
call s:InitVariable("g:NERDToggleCheckAllLines", 0)
|
||||||
|
|
||||||
let s:NERDFileNameEscape="[]#*$%'\" ?`!&();<>\\"
|
let s:NERDFileNameEscape="[]#*$%'\" ?`!&();<>\\"
|
||||||
|
|
||||||
@@ -82,6 +83,7 @@ let s:delimiterMap = {
|
|||||||
\ 'ansible': { 'left': '#' },
|
\ 'ansible': { 'left': '#' },
|
||||||
\ 'apache': { 'left': '#' },
|
\ 'apache': { 'left': '#' },
|
||||||
\ 'apachestyle': { 'left': '#' },
|
\ 'apachestyle': { 'left': '#' },
|
||||||
|
\ 'apdl': { 'left': '!' },
|
||||||
\ 'applescript': { 'left': '--', 'leftAlt': '(*', 'rightAlt': '*)' },
|
\ 'applescript': { 'left': '--', 'leftAlt': '(*', 'rightAlt': '*)' },
|
||||||
\ 'armasm': { 'left': ';' },
|
\ 'armasm': { 'left': ';' },
|
||||||
\ 'asciidoc': { 'left': '//' },
|
\ 'asciidoc': { 'left': '//' },
|
||||||
@@ -335,6 +337,7 @@ let s:delimiterMap = {
|
|||||||
\ 'povini': { 'left': ';' },
|
\ 'povini': { 'left': ';' },
|
||||||
\ 'ppd': { 'left': '%' },
|
\ 'ppd': { 'left': '%' },
|
||||||
\ 'ppwiz': { 'left': ';;' },
|
\ 'ppwiz': { 'left': ';;' },
|
||||||
|
\ 'praat': { 'left': '#' },
|
||||||
\ 'privoxy': { 'left': '#' },
|
\ 'privoxy': { 'left': '#' },
|
||||||
\ 'processing': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
|
\ 'processing': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||||
\ 'prolog': { 'left': '%', 'leftAlt': '/*', 'rightAlt': '*/' },
|
\ 'prolog': { 'left': '%', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||||
@@ -358,6 +361,7 @@ let s:delimiterMap = {
|
|||||||
\ 'rgb': { 'left': '!' },
|
\ 'rgb': { 'left': '!' },
|
||||||
\ 'rib': { 'left': '#' },
|
\ 'rib': { 'left': '#' },
|
||||||
\ 'rmd': { 'left': '#' },
|
\ 'rmd': { 'left': '#' },
|
||||||
|
\ 'robot': { 'left': '#' },
|
||||||
\ 'robots': { 'left': '#' },
|
\ 'robots': { 'left': '#' },
|
||||||
\ 'rspec': { 'left': '#' },
|
\ 'rspec': { 'left': '#' },
|
||||||
\ 'ruby': { 'left': '#', 'leftAlt': '=begin', 'rightAlt': '=end' },
|
\ 'ruby': { 'left': '#', 'leftAlt': '=begin', 'rightAlt': '=end' },
|
||||||
@@ -372,6 +376,7 @@ let s:delimiterMap = {
|
|||||||
\ 'scons': { 'left': '#' },
|
\ 'scons': { 'left': '#' },
|
||||||
\ 'scsh': { 'left': ';' },
|
\ 'scsh': { 'left': ';' },
|
||||||
\ 'scss': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
|
\ 'scss': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
|
||||||
|
\ 'sdc': { 'left': '#' },
|
||||||
\ 'sed': { 'left': '#' },
|
\ 'sed': { 'left': '#' },
|
||||||
\ 'sgmldecl': { 'left': '--', 'right': '--' },
|
\ 'sgmldecl': { 'left': '--', 'right': '--' },
|
||||||
\ 'sgmllnx': { 'left': '<!--', 'right': '-->' },
|
\ 'sgmllnx': { 'left': '<!--', 'right': '-->' },
|
||||||
@@ -1254,13 +1259,30 @@ function! NERDComment(mode, type) range
|
|||||||
endtry
|
endtry
|
||||||
|
|
||||||
elseif a:type ==? 'Toggle'
|
elseif a:type ==? 'Toggle'
|
||||||
|
if g:NERDToggleCheckAllLines ==# 0
|
||||||
let theLine = getline(firstLine)
|
let theLine = getline(firstLine)
|
||||||
|
|
||||||
if s:IsInSexyComment(firstLine) || s:IsCommentedFromStartOfLine(s:Left(), theLine) || s:IsCommentedFromStartOfLine(s:Left({'alt': 1}), theLine)
|
if s:IsInSexyComment(firstLine) || s:IsCommentedFromStartOfLine(s:Left(), theLine) || s:IsCommentedFromStartOfLine(s:Left({'alt': 1}), theLine)
|
||||||
call s:UncommentLines(firstLine, lastLine)
|
call s:UncommentLines(firstLine, lastLine)
|
||||||
else
|
else
|
||||||
call s:CommentLinesToggle(forceNested, firstLine, lastLine)
|
call s:CommentLinesToggle(forceNested, firstLine, lastLine)
|
||||||
endif
|
endif
|
||||||
|
else
|
||||||
|
let l:commentAllLines = 0
|
||||||
|
for i in range(firstLine, lastLine)
|
||||||
|
let theLine = getline(i)
|
||||||
|
" if have one line no comment, then comment all lines
|
||||||
|
if !s:IsInSexyComment(firstLine) && !s:IsCommentedFromStartOfLine(s:Left(), theLine) && !s:IsCommentedFromStartOfLine(s:Left({'alt': 1}), theLine)
|
||||||
|
let l:commentAllLines = 1
|
||||||
|
break
|
||||||
|
else
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
if l:commentAllLines ==# 1
|
||||||
|
call s:CommentLinesToggle(forceNested, firstLine, lastLine)
|
||||||
|
else
|
||||||
|
call s:UncommentLines(firstLine, lastLine)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
elseif a:type ==? 'Minimal'
|
elseif a:type ==? 'Minimal'
|
||||||
try
|
try
|
||||||
|
|||||||
Reference in New Issue
Block a user