mirror of
https://github.com/preservim/nerdcommenter.git
synced 2025-11-08 09:53:47 -05:00
Compare commits
25 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6a9764f39a | ||
|
|
6304c65434 | ||
|
|
6089d08ed3 | ||
|
|
c53ae79ca3 | ||
|
|
432fe6b156 | ||
|
|
aafe01e4e9 | ||
|
|
4f05d713b4 | ||
|
|
59735a2904 | ||
|
|
f8c60c7bd8 | ||
|
|
2783e3639d | ||
|
|
6337d56893 | ||
|
|
a24534c6f1 | ||
|
|
122490be95 | ||
|
|
d1af8af555 | ||
|
|
08d14e7342 | ||
|
|
532c58db62 | ||
|
|
fb93d5869d | ||
|
|
78f182a601 | ||
|
|
b6882e5d23 | ||
|
|
574f2841cc | ||
|
|
023a62224e | ||
|
|
443eb8045e | ||
|
|
13b0f4ee27 | ||
|
|
ee3106ad45 | ||
|
|
3161d57792 |
18
Rakefile
Normal file
18
Rakefile
Normal file
@@ -0,0 +1,18 @@
|
||||
desc "Copy the vim/doc files into ~/.vim"
|
||||
task :deploy_local do
|
||||
run "cp plugin/NERD_commenter.vim ~/.vim/plugin"
|
||||
run "cp doc/NERD_commenter.txt ~/.vim/doc"
|
||||
end
|
||||
|
||||
|
||||
desc "Create a zip archive for release to vim.org"
|
||||
task :zip do
|
||||
abort "NERD_commenter.zip already exists, aborting" if File.exist?("NERD_commenter.zip")
|
||||
run "zip NERD_commenter.zip plugin/NERD_commenter.vim doc/NERD_commenter.txt"
|
||||
end
|
||||
|
||||
def run(cmd)
|
||||
puts "Executing: #{cmd}"
|
||||
system cmd
|
||||
end
|
||||
|
||||
@@ -744,7 +744,7 @@ If this option is set to 1 then the top style will be used.
|
||||
------------------------------------------------------------------------------
|
||||
*NERDDefaultNesting*
|
||||
Values: 0 or 1.
|
||||
Default 0.
|
||||
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
|
||||
@@ -860,6 +860,41 @@ to get illegal syntax when uncommenting them.
|
||||
==============================================================================
|
||||
8. Changelog *NERDComChangelog*
|
||||
|
||||
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,
|
||||
modconf and sudoers filetypes, thx to Li Jin for the patch.
|
||||
- added support for SVNdiff, gitAnnotate, gitdiff. Thx to nicothakis for
|
||||
posting the issue
|
||||
|
||||
2.1.11
|
||||
- fixed a bug with the selection option and visual commenting (again).
|
||||
Thanks to Ingo Karkat (again).
|
||||
|
||||
2.1.10
|
||||
- added support for Wikipedia (thanks to Chen Xing)
|
||||
- added support for mplayerconf
|
||||
- bugfixes (thanks to Ingo Karkat for the bug report/patch)
|
||||
- added support for mkd (thanks to Stefano Zacchiroli)
|
||||
|
||||
2.1.9
|
||||
- added support for mrxvtrc and aap, thx to Marco for the emails
|
||||
- added dummy support for SVNAnnotate, SVKAnnotate and CVSAnnotate, thx to
|
||||
nicothakis for posting the issue
|
||||
|
||||
2.1.8
|
||||
- fixed a couple of bugs with the NERDSpaceDelims option, thx to
|
||||
David Miani and Jeremy Hinegardner
|
||||
- added dummy support for lhaskell, thx to pipp for posting the issue
|
||||
- added an alternative set of delims for the plsql filetype, thx to Kuchma
|
||||
Michael
|
||||
- added support for spectre, thx to Brett Warneke
|
||||
- added support for scala, thx to Renald Buter
|
||||
- added support for asymptote, thx to Vladimir Lomov
|
||||
- made NERDDefaultNesting enabled by default as this seems more intuitive,
|
||||
thx to marco for the suggestion
|
||||
|
||||
|
||||
2.1.7
|
||||
- added support for haml, thx to Greb Weber
|
||||
- added support for asterisk, thx to Laurent ARNOUD
|
||||
@@ -1123,6 +1158,16 @@ Cheers to Cheng Fang for the bug reports :D
|
||||
|
||||
Cheers to Yongwei Wu for a bug report about the passwd filetype.
|
||||
|
||||
Thanks to David Miani for reporting a space-removal bug when using the
|
||||
NERDSpaceDelims option.
|
||||
|
||||
Thanks to Jeremy Hinegardner for emailing me about a bug with aligned
|
||||
comments and the NERDSpaceDelims option.
|
||||
|
||||
Thanks to marco for suggesting NERDDefaultNesting be set by default.
|
||||
|
||||
Thanks to Ingo Karkat for the bug reports and the bugfix patch.
|
||||
|
||||
Not to forget! Thanks to the following people for sending me new filetypes to
|
||||
support :D
|
||||
|
||||
@@ -1145,7 +1190,7 @@ Lizendir fstab
|
||||
Michael Böhler autoit, autohotkey and docbk
|
||||
Aaron Small cmake
|
||||
Ramiro htmldjango and django
|
||||
Stefano Zacchiroli debcontrol and debchangelog
|
||||
Stefano Zacchiroli debcontrol, debchangelog, mkd
|
||||
Alex Tarkovsky ebuild and eclass
|
||||
Jorge Rodrigues gams
|
||||
Rainer Müller Objective C
|
||||
@@ -1164,4 +1209,17 @@ Greg Weber D, haml
|
||||
Bruce Sherrod velocity
|
||||
timberke cobol
|
||||
Aaron Schaefer factor
|
||||
Laurent ARNOUD asterisk
|
||||
Laurent ARNOUD asterisk, mplayerconf
|
||||
Kuchma Michael plsql
|
||||
Brett Warneke spectre
|
||||
Pipp lhaskell
|
||||
Renald Buter scala
|
||||
Vladimir Lomov asymptote
|
||||
Marco mrxvtrc, aap
|
||||
nicothakis SVNAnnotate, CVSAnnotate, SVKAnnotate,
|
||||
SVNdiff, gitAnnotate, gitdiff
|
||||
Chen Xing Wikipedia
|
||||
Jacobo Diaz dakota, patran
|
||||
Li Jin gentoo-env-d, gentoo-init-d,
|
||||
gentoo-make-conf, grub, modconf, sudoers
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
" vim global plugin that provides easy code commenting for various file types
|
||||
" Last Change: 26 oct 2007
|
||||
" Last Change: 31 March 2008
|
||||
" Maintainer: Martin Grenfell <martin_grenfell at msn.com>
|
||||
let s:NERD_commenter_version = 2.1.7
|
||||
let s:NERD_commenter_version = 2.1.12
|
||||
|
||||
" 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
|
||||
@@ -54,7 +54,7 @@ call s:InitVariable("g:NERDAllowAnyVisualDelims", 1)
|
||||
call s:InitVariable("g:NERDBlockComIgnoreEmpty", 0)
|
||||
call s:InitVariable("g:NERDCommentWholeLinesInVMode", 0)
|
||||
call s:InitVariable("g:NERDCompactSexyComs", 0)
|
||||
call s:InitVariable("g:NERDDefaultNesting", 0)
|
||||
call s:InitVariable("g:NERDDefaultNesting", 1)
|
||||
call s:InitVariable("g:NERDMenuMode", 3)
|
||||
call s:InitVariable("g:NERDLPlace", "[>")
|
||||
call s:InitVariable("g:NERDUsePlaceHolders", 1)
|
||||
@@ -132,6 +132,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
"hardcoded the comment delimiters to use
|
||||
if a:filetype == ""
|
||||
call s:MapDelimiters('', '')
|
||||
elseif a:filetype == "aap"
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "abaqus"
|
||||
call s:MapDelimiters('**', '')
|
||||
elseif a:filetype == "abc"
|
||||
@@ -166,6 +168,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
call s:MapDelimiters('''', '')
|
||||
elseif a:filetype == "asterisk"
|
||||
call s:MapDelimiters(';', '')
|
||||
elseif a:filetype == "asy"
|
||||
call s:MapDelimiters('//', '')
|
||||
elseif a:filetype == "atlas"
|
||||
call s:MapDelimiters('C','$')
|
||||
elseif a:filetype == "autohotkey"
|
||||
@@ -246,10 +250,14 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
call s:MapDelimiters('','')
|
||||
elseif a:filetype == "cvs"
|
||||
call s:MapDelimiters('CVS:','')
|
||||
elseif a:filetype == "CVSAnnotate"
|
||||
call s:MapDelimiters('','')
|
||||
elseif a:filetype == "d"
|
||||
call s:MapDelimitersWithAlternative('//','', '/*','*/')
|
||||
elseif a:filetype == "dcl"
|
||||
call s:MapDelimiters('$!', '')
|
||||
elseif a:filetype == "dakota"
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "debchangelog"
|
||||
call s:MapDelimiters('', '')
|
||||
elseif a:filetype == "debcontrol"
|
||||
@@ -336,16 +344,28 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
call s:MapDelimiters('GEEK_COMMENT:', '')
|
||||
elseif a:filetype == "gentoo-conf-d"
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "gentoo-env-d"
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "gentoo-init-d"
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "gentoo-make-conf"
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == 'gentoo-package-keywords'
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == 'gentoo-package-mask'
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == 'gentoo-package-use'
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == 'gitAnnotate'
|
||||
call s:MapDelimiters('', '')
|
||||
elseif a:filetype == 'gitdiff'
|
||||
call s:MapDelimiters('', '')
|
||||
elseif a:filetype == "gnuplot"
|
||||
call s:MapDelimiters('#','')
|
||||
elseif a:filetype == "groovy"
|
||||
call s:MapDelimitersWithAlternative('//','', '/*','*/')
|
||||
elseif a:filetype == "grub"
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "gtkrc"
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "haskell"
|
||||
@@ -416,6 +436,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
call s:MapDelimiters('/*','*/')
|
||||
elseif a:filetype == "lftp"
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "lhaskell"
|
||||
call s:MapDelimiters('','')
|
||||
elseif a:filetype == "lifelines"
|
||||
call s:MapDelimiters('/*','*/')
|
||||
elseif a:filetype == "lilo"
|
||||
@@ -466,8 +488,12 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
call s:MapDelimiters('%', '')
|
||||
elseif a:filetype == "mib"
|
||||
call s:MapDelimiters('--', '')
|
||||
elseif a:filetype == "mkd"
|
||||
call s:MapDelimiters('>', '')
|
||||
elseif a:filetype == "mma"
|
||||
call s:MapDelimiters('(*','*)')
|
||||
elseif a:filetype == "modconf"
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "model"
|
||||
call s:MapDelimiters('$','$')
|
||||
elseif a:filetype =~ "moduala."
|
||||
@@ -478,6 +504,10 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
call s:MapDelimiters('(*','*)')
|
||||
elseif a:filetype == "monk"
|
||||
call s:MapDelimiters(';', '')
|
||||
elseif a:filetype == "mplayerconf"
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "mrxvtrc"
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "mush"
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "muttrc"
|
||||
@@ -528,6 +558,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
call s:MapDelimitersWithAlternative('{','}', '(*', '*)')
|
||||
elseif a:filetype == "passwd"
|
||||
call s:MapDelimiters('','')
|
||||
elseif a:filetype == "patran"
|
||||
call s:MapDelimitersWithAlternative('$','','/*', '*/')
|
||||
elseif a:filetype == "pcap"
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "pccts"
|
||||
@@ -553,7 +585,7 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
elseif a:filetype == "plm"
|
||||
call s:MapDelimitersWithAlternative('//','', '/*','*/')
|
||||
elseif a:filetype == "plsql"
|
||||
call s:MapDelimiters('--', '')
|
||||
call s:MapDelimitersWithAlternative('--', '', '/*', '*/')
|
||||
elseif a:filetype == "po"
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "postscr"
|
||||
@@ -620,6 +652,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
call s:MapDelimitersWithAlternative('//','', '/*', '')
|
||||
elseif a:filetype == "sather"
|
||||
call s:MapDelimiters('--', '')
|
||||
elseif a:filetype == "scala"
|
||||
call s:MapDelimitersWithAlternative('//','', '/*','*/')
|
||||
elseif a:filetype == "scheme"
|
||||
call s:MapDelimiters(';', '')
|
||||
elseif a:filetype == "scilab"
|
||||
@@ -676,6 +710,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "specman"
|
||||
call s:MapDelimiters('//', '')
|
||||
elseif a:filetype == "spectre"
|
||||
call s:MapDelimitersWithAlternative('//', '', '*', '')
|
||||
elseif a:filetype == "spice"
|
||||
call s:MapDelimiters('$', '')
|
||||
elseif a:filetype == "sql"
|
||||
@@ -694,10 +730,18 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
call s:MapDelimiters('--', '')
|
||||
elseif a:filetype == "strace"
|
||||
call s:MapDelimiters('/*','*/')
|
||||
elseif a:filetype == "sudoers"
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "SVKAnnotate"
|
||||
call s:MapDelimiters('','')
|
||||
elseif a:filetype == "svn"
|
||||
call s:MapDelimiters('','')
|
||||
elseif a:filetype == "SVNAnnotate"
|
||||
call s:MapDelimiters('','')
|
||||
elseif a:filetype == "SVNcommitlog"
|
||||
call s:MapDelimiters('','')
|
||||
elseif a:filetype == "SVNdiff"
|
||||
call s:MapDelimiters('','')
|
||||
elseif a:filetype == "systemverilog"
|
||||
call s:MapDelimitersWithAlternative('//','', '/*','*/')
|
||||
elseif a:filetype == "tads"
|
||||
@@ -772,6 +816,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
call s:MapDelimiters('##', '')
|
||||
elseif a:filetype == "wget"
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype ==? "Wikipedia"
|
||||
call s:MapDelimiters('<!--','-->')
|
||||
elseif a:filetype == "winbatch"
|
||||
call s:MapDelimiters(';', '')
|
||||
elseif a:filetype == "wml"
|
||||
@@ -1023,7 +1069,7 @@ function s:CommentBlock(top, bottom, lSide, rSide, forceNested )
|
||||
|
||||
if s:Multipart()
|
||||
"stick the right delimiter down
|
||||
let theLine = strpart(theLine, 0, rSide+strlen(leftSpaced)) . rightSpaced . strpart(theLine, rSide+strlen(rightSpaced))
|
||||
let theLine = strpart(theLine, 0, rSide+strlen(leftSpaced)) . rightSpaced . strpart(theLine, rSide+strlen(leftSpaced))
|
||||
|
||||
let firstLeftDelim = s:FindDelimiterIndex(b:left, theLine)
|
||||
let lastRightDelim = s:LastIndexOfDelim(b:right, theLine)
|
||||
@@ -1102,12 +1148,12 @@ function s:CommentLines(forceNested, alignLeft, alignRight, firstLine, lastLine)
|
||||
" check if we can comment this line
|
||||
if !isCommented || g:NERDUsePlaceHolders || s:Multipart()
|
||||
if a:alignLeft
|
||||
let theLine = s:AddLeftDelimAligned(b:left, theLine, leftAlignIndx)
|
||||
let theLine = s:AddLeftDelimAligned(s:GetLeft(0,1,0), theLine, leftAlignIndx)
|
||||
else
|
||||
let theLine = s:AddLeftDelim(s:GetLeft(0,1,0), theLine)
|
||||
endif
|
||||
if a:alignRight
|
||||
let theLine = s:AddRightDelimAligned(b:right, theLine, rightAlignIndx)
|
||||
let theLine = s:AddRightDelimAligned(s:GetRight(0,1,0), theLine, rightAlignIndx)
|
||||
else
|
||||
let theLine = s:AddRightDelim(s:GetRight(0,1,0), theLine)
|
||||
endif
|
||||
@@ -1422,14 +1468,14 @@ endfunction
|
||||
" 'nested', 'toEOL', 'prepend', 'append', 'insert', 'uncomment', 'yank'
|
||||
function! NERDComment(isVisual, type) range
|
||||
" we want case sensitivity when commenting
|
||||
let prevIgnoreCase = &ignorecase
|
||||
let oldIgnoreCase = &ignorecase
|
||||
set noignorecase
|
||||
|
||||
if a:isVisual
|
||||
let firstLine = line("'<")
|
||||
let lastLine = line("'>")
|
||||
let firstCol = col("'<")
|
||||
let lastCol = col("'>")
|
||||
let lastCol = col("'>") - (&selection == 'exclusive' ? 1 : 0)
|
||||
else
|
||||
let firstLine = a:firstline
|
||||
let lastLine = a:lastline
|
||||
@@ -1511,7 +1557,7 @@ function! NERDComment(isVisual, type) range
|
||||
execute firstLine .','. lastLine .'call NERDComment('. a:isVisual .', "norm")'
|
||||
endif
|
||||
|
||||
let &ignorecase = prevIgnoreCase
|
||||
let &ignorecase = oldIgnoreCase
|
||||
endfunction
|
||||
|
||||
" Function: s:PlaceDelimitersAndInsBetween() function {{{2
|
||||
@@ -1834,15 +1880,15 @@ function s:UncommentLineNormal(line)
|
||||
let line = a:line
|
||||
|
||||
"get the comment status on the line so we know how it is commented
|
||||
let lineCommentStatus = s:IsCommentedOuttermost(b:leftAlt, b:rightAlt, b:left, b:right, line)
|
||||
let lineCommentStatus = s:IsCommentedOuttermost(b:left, b:right, b:leftAlt, b:rightAlt, line)
|
||||
|
||||
"it is commented with b:left and b:right so remove these delims
|
||||
if lineCommentStatus == 1
|
||||
let line = s:RemoveDelimiters(b:leftAlt, b:rightAlt, line)
|
||||
let line = s:RemoveDelimiters(b:left, b:right, line)
|
||||
|
||||
"it is commented with b:leftAlt and b:rightAlt so remove these delims
|
||||
elseif lineCommentStatus == 2 && g:NERDRemoveAltComs
|
||||
let line = s:RemoveDelimiters(b:left, b:right, line)
|
||||
let line = s:RemoveDelimiters(b:leftAlt, b:rightAlt, line)
|
||||
|
||||
"it is not properly commented with any delims so we check if it has
|
||||
"any random left or right delims on it and remove the outtermost ones
|
||||
|
||||
Reference in New Issue
Block a user