28 Commits

Author SHA1 Message Date
Martin Grenfell
fef5db7e92 change version to 2.1.14 2008-05-17 16:12:27 +12:00
Martin Grenfell
875831209a add support for dtrace 2008-05-17 15:44:36 +12:00
Martin Grenfell
191bb50879 add support for nerdtree 2008-05-17 14:54:44 +12:00
Martin Grenfell
e92b6f60d5 add support for tar 2008-05-15 09:17:51 +12:00
Martin Grenfell
3eea85daa4 add support for gitconfig 2008-05-13 10:51:56 +12:00
Martin Grenfell
62b394aa9b minor doc fix 2008-05-04 13:41:29 +12:00
Martin Grenfell
953fc19af9 added a couple of thx notes for filetypes 2008-05-04 13:33:24 +12:00
Martin Grenfell
ded4e80efe added a note to the thanks section, and tidied it up a bit 2008-05-04 13:30:56 +12:00
Martin Grenfell
890ab3fe2e tidied up the changelog for this release 2008-05-04 13:25:52 +12:00
Martin Grenfell
dd7a0bf471 changed the version to 2.1.13 for the next release 2008-05-04 13:13:30 +12:00
Martin Grenfell
4b0e7a8f1a add support for slice filetype 2008-04-29 22:08:29 +12:00
Martin Grenfell
c5623a31e2 add support for vimperator 2008-04-29 22:03:10 +12:00
Martin Grenfell
06be251c66 bugfix: fixed single line compact sexy comments 2008-04-29 21:38:06 +12:00
Martin Grenfell
3aeaa92dd7 make toggle commenting less picky about which lines it uncomments 2008-04-29 21:23:57 +12:00
Martin Grenfell
4809a9c287 make sexy commenting fall back to normal commenting if sexy comments arent possible with the current filetype 2008-04-28 22:54:37 +12:00
Martin Grenfell
0256b0a18c make the changelog look a bit nicer 2008-04-28 22:54:13 +12:00
Martin Grenfell
148fe82c42 note some sexy comment fixes in changelog 2008-04-28 22:53:43 +12:00
Martin Grenfell
3eb5a0fcde bugfix: fixed another infinite loop when detecting sexy comments 2008-04-28 22:40:51 +12:00
Martin Grenfell
f5092782ee bugfix: stopped infine loop when checking for sexy comment on first/last line of file 2008-04-28 22:27:10 +12:00
Martin Grenfell
75f5b5f275 bugfix: remove extra spaces (if options permit) when uncommenting irregular comments 2008-04-28 22:07:18 +12:00
Martin Grenfell
ebe9dc2a38 add a note about the NERDRemoveExtraSpaces fix to the changelog 2008-04-28 22:06:40 +12:00
Martin Grenfell
f2fa62bd4f correct the default value for NERDRemoveExtraSpaces
previously NERDRemoveExtraSpaces was set to 0 by default even though the
documentation stated the default as 1
2008-04-28 20:56:41 +12:00
Martin Grenfell
7ea2aeea99 updated the changelog 2008-04-28 20:47:23 +12:00
Martin Grenfell
065022b1ee add support for 'gitcommit' filetype 2008-04-28 20:38:51 +12:00
Martin Grenfell
3bccb91e7d added support for 'services' filetype 2008-04-28 20:28:15 +12:00
Martin Grenfell
a24c8b79f8 added support for liquid 2008-04-17 23:26:21 +12:00
Martin Grenfell
f8ce318000 add support for pyrex 2008-04-17 23:18:00 +12:00
Martin Grenfell
f95255e299 added support for rib 2008-04-17 23:13:34 +12:00
2 changed files with 73 additions and 30 deletions

View File

@@ -89,7 +89,7 @@ line that is commented is uncommented and vice versa.
[count],cs |NERDComSexyComment|
Comments out the selected lines ``sexually''
Comments out the selected lines ``sexily''
[count],cy |NERDComYankComment|
@@ -860,6 +860,21 @@ to get illegal syntax when uncommenting them.
==============================================================================
8. Changelog *NERDComChangelog*
2.1.14
- added support for gitconfig, tar, nerdtree
- added support for dtrace, thanks to nicothakis for the post
2.1.13
- added support for rib, pyrex/cython, liquid, services, gitcommit,
vimperator, and slice. Thanks to spookypeanut, Greg Jandl, Christophe
Benz, A Pontus, and Stromnov for emailing me and/or posting issues.
- set the NERDRemoveExtraSpaces option to 1 by default as the doc states
- other fixes: (thanks to Zhang Shuhan for all his emails and testing)
* made the sexy comment mapping fall back to normal commenting if sexy
comments arent possible for the current filetype
* fixed some bugs with sexy comments
* made the uncommenting side of toggle comments slightly more robust
* fixed a bug where some extra spaces werent being removed (although
the currect options were set)
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,
@@ -1168,6 +1183,12 @@ 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.
Not to forget! Thanks to the following people for sending me new filetypes to
support :D
@@ -1217,9 +1238,13 @@ Renald Buter scala
Vladimir Lomov asymptote
Marco mrxvtrc, aap
nicothakis SVNAnnotate, CVSAnnotate, SVKAnnotate,
SVNdiff, gitAnnotate, gitdiff
SVNdiff, gitAnnotate, gitdiff, dtrace
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

View File

@@ -1,7 +1,7 @@
" vim global plugin that provides easy code commenting for various file types
" Last Change: 31 March 2008
" Last Change: 17 May 2008
" Maintainer: Martin Grenfell <martin_grenfell at msn.com>
let s:NERD_commenter_version = 2.1.12
let s:NERD_commenter_version = 2.1.14
" 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
@@ -59,7 +59,7 @@ 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)
@@ -290,6 +290,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'
@@ -358,6 +360,10 @@ function s:SetUpForNewFiletype(filetype, forceReset)
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 == "gnuplot"
@@ -444,6 +450,8 @@ 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"
@@ -522,6 +530,8 @@ 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"
@@ -608,6 +618,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
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 +644,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 +682,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"
@@ -686,6 +702,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"
@@ -752,6 +770,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"
@@ -804,6 +824,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"
@@ -1274,12 +1296,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)
@@ -1436,7 +1460,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
@@ -1506,7 +1530,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, 0, 0, firstLine, lastLine)
catch /NERDCommenter.Nesting/
call s:NerdEcho("Sexy comment aborted. Nested sexy cannot be nested", 0)
endtry
@@ -1515,7 +1539,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
@@ -1544,7 +1568,7 @@ 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
@@ -1703,14 +1727,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 +1766,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
@@ -1901,16 +1919,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 +2333,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