6 Commits
2.5.1 ... 2.5.2

Author SHA1 Message Date
fcying
9a32fd2534 Add NERDToggleCheckAllLines option to NERDCommenterToggle (#334) 2018-06-21 11:06:22 +03:00
Jiaobuzuji
e679d8a341 Add support for 'sdc' filetype (#327) 2018-03-03 15:16:47 +03:00
dandersson
670dba1bb5 Add support for Robot Framework files (#323) 2018-02-07 12:19:12 +03:00
Sean
2f973bd4fa Fix Markdown formatting 2018-02-02 12:56:54 +03:00
tlsvc
ff3d8d7d7c Add support for ANSYS Parametric Design Language (apdl) (#317) 2018-01-13 11:47:04 +03:00
Alec Shaw
af8bb4258d Add support for Praat scripting language (#316)
[Praat][1] is a program for phonetics research which has a scripting interface.

[1]: http://www.fon.hum.uva.nl/praat/
2017-12-26 11:02:19 +03:00
3 changed files with 42 additions and 5 deletions

View File

@@ -22,7 +22,7 @@ Comment functions so powerful—no comment necessary.
1. Add `NeoBundle 'scrooloose/nerdcommenter'` to your vimrc file.
2. Reload your vimrc or restart
3. Run `:NeoUpdate``
3. Run `:NeoUpdate`
#### [Pathogen](https://github.com/tpope/vim-pathogen)
@@ -94,6 +94,9 @@ let g:NERDCommentEmptyLines = 1
" Enable trimming of trailing whitespace when uncommenting
let g:NERDTrimTrailingWhitespace = 1
" Enable NERDCommenterToggle to check all selected lines is commented or not
let g:NERDToggleCheckAllLines = 1
```
### Default mappings

View File

@@ -488,6 +488,9 @@ change the filetype back: >
one of 'none', 'left', 'start', or
'both'.
|'NERDToggleCheckAllLines'| Enable NERDCommenterToggle to check
all selected lines is commented or not.
------------------------------------------------------------------------------
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
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*

View File

@@ -65,6 +65,7 @@ call s:InitVariable("g:NERDRPlace", "<]")
call s:InitVariable("g:NERDSpaceDelims", 0)
call s:InitVariable("g:NERDDefaultAlign", "none")
call s:InitVariable("g:NERDTrimTrailingWhitespace", 0)
call s:InitVariable("g:NERDToggleCheckAllLines", 0)
let s:NERDFileNameEscape="[]#*$%'\" ?`!&();<>\\"
@@ -82,6 +83,7 @@ let s:delimiterMap = {
\ 'ansible': { 'left': '#' },
\ 'apache': { 'left': '#' },
\ 'apachestyle': { 'left': '#' },
\ 'apdl': { 'left': '!' },
\ 'applescript': { 'left': '--', 'leftAlt': '(*', 'rightAlt': '*)' },
\ 'armasm': { 'left': ';' },
\ 'asciidoc': { 'left': '//' },
@@ -335,6 +337,7 @@ let s:delimiterMap = {
\ 'povini': { 'left': ';' },
\ 'ppd': { 'left': '%' },
\ 'ppwiz': { 'left': ';;' },
\ 'praat': { 'left': '#' },
\ 'privoxy': { 'left': '#' },
\ 'processing': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
\ 'prolog': { 'left': '%', 'leftAlt': '/*', 'rightAlt': '*/' },
@@ -358,6 +361,7 @@ let s:delimiterMap = {
\ 'rgb': { 'left': '!' },
\ 'rib': { 'left': '#' },
\ 'rmd': { 'left': '#' },
\ 'robot': { 'left': '#' },
\ 'robots': { 'left': '#' },
\ 'rspec': { 'left': '#' },
\ 'ruby': { 'left': '#', 'leftAlt': '=begin', 'rightAlt': '=end' },
@@ -372,6 +376,7 @@ let s:delimiterMap = {
\ 'scons': { 'left': '#' },
\ 'scsh': { 'left': ';' },
\ 'scss': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' },
\ 'sdc': { 'left': '#' },
\ 'sed': { 'left': '#' },
\ 'sgmldecl': { 'left': '--', 'right': '--' },
\ 'sgmllnx': { 'left': '<!--', 'right': '-->' },
@@ -1254,12 +1259,29 @@ function! NERDComment(mode, type) range
endtry
elseif a:type ==? 'Toggle'
let theLine = getline(firstLine)
if s:IsInSexyComment(firstLine) || s:IsCommentedFromStartOfLine(s:Left(), theLine) || s:IsCommentedFromStartOfLine(s:Left({'alt': 1}), theLine)
call s:UncommentLines(firstLine, lastLine)
if g:NERDToggleCheckAllLines ==# 0
let theLine = getline(firstLine)
if s:IsInSexyComment(firstLine) || s:IsCommentedFromStartOfLine(s:Left(), theLine) || s:IsCommentedFromStartOfLine(s:Left({'alt': 1}), theLine)
call s:UncommentLines(firstLine, lastLine)
else
call s:CommentLinesToggle(forceNested, firstLine, lastLine)
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'