mirror of
https://github.com/preservim/nerdcommenter.git
synced 2025-11-08 09:53:47 -05:00
Compare commits
45 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fef5db7e92 | ||
|
|
875831209a | ||
|
|
191bb50879 | ||
|
|
e92b6f60d5 | ||
|
|
3eea85daa4 | ||
|
|
62b394aa9b | ||
|
|
953fc19af9 | ||
|
|
ded4e80efe | ||
|
|
890ab3fe2e | ||
|
|
dd7a0bf471 | ||
|
|
4b0e7a8f1a | ||
|
|
c5623a31e2 | ||
|
|
06be251c66 | ||
|
|
3aeaa92dd7 | ||
|
|
4809a9c287 | ||
|
|
0256b0a18c | ||
|
|
148fe82c42 | ||
|
|
3eb5a0fcde | ||
|
|
f5092782ee | ||
|
|
75f5b5f275 | ||
|
|
ebe9dc2a38 | ||
|
|
f2fa62bd4f | ||
|
|
7ea2aeea99 | ||
|
|
065022b1ee | ||
|
|
3bccb91e7d | ||
|
|
a24c8b79f8 | ||
|
|
f8ce318000 | ||
|
|
f95255e299 | ||
|
|
6a9764f39a | ||
|
|
6304c65434 | ||
|
|
6089d08ed3 | ||
|
|
c53ae79ca3 | ||
|
|
432fe6b156 | ||
|
|
aafe01e4e9 | ||
|
|
4f05d713b4 | ||
|
|
59735a2904 | ||
|
|
f8c60c7bd8 | ||
|
|
2783e3639d | ||
|
|
6337d56893 | ||
|
|
a24534c6f1 | ||
|
|
122490be95 | ||
|
|
d1af8af555 | ||
|
|
08d14e7342 | ||
|
|
532c58db62 | ||
|
|
fb93d5869d |
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
|
||||||
|
|
||||||
@@ -89,7 +89,7 @@ line that is commented is uncommented and vice versa.
|
|||||||
|
|
||||||
|
|
||||||
[count],cs |NERDComSexyComment|
|
[count],cs |NERDComSexyComment|
|
||||||
Comments out the selected lines ``sexually''
|
Comments out the selected lines ``sexily''
|
||||||
|
|
||||||
|
|
||||||
[count],cy |NERDComYankComment|
|
[count],cy |NERDComYankComment|
|
||||||
@@ -860,6 +860,43 @@ to get illegal syntax when uncommenting them.
|
|||||||
==============================================================================
|
==============================================================================
|
||||||
8. Changelog *NERDComChangelog*
|
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,
|
||||||
|
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
|
2.1.8
|
||||||
- fixed a couple of bugs with the NERDSpaceDelims option, thx to
|
- fixed a couple of bugs with the NERDSpaceDelims option, thx to
|
||||||
David Miani and Jeremy Hinegardner
|
David Miani and Jeremy Hinegardner
|
||||||
@@ -1144,6 +1181,14 @@ comments and the NERDSpaceDelims option.
|
|||||||
|
|
||||||
Thanks to marco for suggesting NERDDefaultNesting be set by default.
|
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
|
Not to forget! Thanks to the following people for sending me new filetypes to
|
||||||
support :D
|
support :D
|
||||||
|
|
||||||
@@ -1166,7 +1211,7 @@ Lizendir fstab
|
|||||||
Michael Böhler autoit, autohotkey and docbk
|
Michael Böhler autoit, autohotkey and docbk
|
||||||
Aaron Small cmake
|
Aaron Small cmake
|
||||||
Ramiro htmldjango and django
|
Ramiro htmldjango and django
|
||||||
Stefano Zacchiroli debcontrol and debchangelog
|
Stefano Zacchiroli debcontrol, debchangelog, mkd
|
||||||
Alex Tarkovsky ebuild and eclass
|
Alex Tarkovsky ebuild and eclass
|
||||||
Jorge Rodrigues gams
|
Jorge Rodrigues gams
|
||||||
Rainer Müller Objective C
|
Rainer Müller Objective C
|
||||||
@@ -1185,9 +1230,21 @@ Greg Weber D, haml
|
|||||||
Bruce Sherrod velocity
|
Bruce Sherrod velocity
|
||||||
timberke cobol
|
timberke cobol
|
||||||
Aaron Schaefer factor
|
Aaron Schaefer factor
|
||||||
Laurent ARNOUD asterisk
|
Laurent ARNOUD asterisk, mplayerconf
|
||||||
Kuchma Michael plsql
|
Kuchma Michael plsql
|
||||||
Brett Warneke spectre
|
Brett Warneke spectre
|
||||||
Pipp lhaskell
|
Pipp lhaskell
|
||||||
Renald Buter scala
|
Renald Buter scala
|
||||||
Vladimir Lomov asymptote
|
Vladimir Lomov asymptote
|
||||||
|
Marco mrxvtrc, aap
|
||||||
|
nicothakis SVNAnnotate, CVSAnnotate, SVKAnnotate,
|
||||||
|
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
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
" vim global plugin that provides easy code commenting for various file types
|
" vim global plugin that provides easy code commenting for various file types
|
||||||
" Last Change: 14 dec 2007
|
" Last Change: 17 May 2008
|
||||||
" Maintainer: Martin Grenfell <martin_grenfell at msn.com>
|
" Maintainer: Martin Grenfell <martin_grenfell at msn.com>
|
||||||
let s:NERD_commenter_version = 2.1.8
|
let s:NERD_commenter_version = 2.1.14
|
||||||
|
|
||||||
" For help documentation type :help NERDCommenter. If this fails, Restart vim
|
" 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
|
" 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:NERDLPlace", "[>")
|
||||||
call s:InitVariable("g:NERDUsePlaceHolders", 1)
|
call s:InitVariable("g:NERDUsePlaceHolders", 1)
|
||||||
call s:InitVariable("g:NERDRemoveAltComs", 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:NERDRPlace", "<]")
|
||||||
call s:InitVariable("g:NERDShutUp", '0')
|
call s:InitVariable("g:NERDShutUp", '0')
|
||||||
call s:InitVariable("g:NERDSpaceDelims", 0)
|
call s:InitVariable("g:NERDSpaceDelims", 0)
|
||||||
@@ -132,6 +132,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
|||||||
"hardcoded the comment delimiters to use
|
"hardcoded the comment delimiters to use
|
||||||
if a:filetype == ""
|
if a:filetype == ""
|
||||||
call s:MapDelimiters('', '')
|
call s:MapDelimiters('', '')
|
||||||
|
elseif a:filetype == "aap"
|
||||||
|
call s:MapDelimiters('#', '')
|
||||||
elseif a:filetype == "abaqus"
|
elseif a:filetype == "abaqus"
|
||||||
call s:MapDelimiters('**', '')
|
call s:MapDelimiters('**', '')
|
||||||
elseif a:filetype == "abc"
|
elseif a:filetype == "abc"
|
||||||
@@ -248,10 +250,14 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
|||||||
call s:MapDelimiters('','')
|
call s:MapDelimiters('','')
|
||||||
elseif a:filetype == "cvs"
|
elseif a:filetype == "cvs"
|
||||||
call s:MapDelimiters('CVS:','')
|
call s:MapDelimiters('CVS:','')
|
||||||
|
elseif a:filetype == "CVSAnnotate"
|
||||||
|
call s:MapDelimiters('','')
|
||||||
elseif a:filetype == "d"
|
elseif a:filetype == "d"
|
||||||
call s:MapDelimitersWithAlternative('//','', '/*','*/')
|
call s:MapDelimitersWithAlternative('//','', '/*','*/')
|
||||||
elseif a:filetype == "dcl"
|
elseif a:filetype == "dcl"
|
||||||
call s:MapDelimiters('$!', '')
|
call s:MapDelimiters('$!', '')
|
||||||
|
elseif a:filetype == "dakota"
|
||||||
|
call s:MapDelimiters('#', '')
|
||||||
elseif a:filetype == "debchangelog"
|
elseif a:filetype == "debchangelog"
|
||||||
call s:MapDelimiters('', '')
|
call s:MapDelimiters('', '')
|
||||||
elseif a:filetype == "debcontrol"
|
elseif a:filetype == "debcontrol"
|
||||||
@@ -284,6 +290,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
|||||||
call s:MapDelimiters('<!--','-->')
|
call s:MapDelimiters('<!--','-->')
|
||||||
elseif a:filetype == "dtml"
|
elseif a:filetype == "dtml"
|
||||||
call s:MapDelimiters('<dtml-comment>','</dtml-comment>')
|
call s:MapDelimiters('<dtml-comment>','</dtml-comment>')
|
||||||
|
elseif a:filetype == "dtrace"
|
||||||
|
call s:MapDelimiters('/*','*/')
|
||||||
elseif a:filetype == "dylan"
|
elseif a:filetype == "dylan"
|
||||||
call s:MapDelimitersWithAlternative('//','', '/*','*/')
|
call s:MapDelimitersWithAlternative('//','', '/*','*/')
|
||||||
elseif a:filetype == 'ebuild'
|
elseif a:filetype == 'ebuild'
|
||||||
@@ -338,16 +346,32 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
|||||||
call s:MapDelimiters('GEEK_COMMENT:', '')
|
call s:MapDelimiters('GEEK_COMMENT:', '')
|
||||||
elseif a:filetype == "gentoo-conf-d"
|
elseif a:filetype == "gentoo-conf-d"
|
||||||
call s:MapDelimiters('#', '')
|
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'
|
elseif a:filetype == 'gentoo-package-keywords'
|
||||||
call s:MapDelimiters('#', '')
|
call s:MapDelimiters('#', '')
|
||||||
elseif a:filetype == 'gentoo-package-mask'
|
elseif a:filetype == 'gentoo-package-mask'
|
||||||
call s:MapDelimiters('#', '')
|
call s:MapDelimiters('#', '')
|
||||||
elseif a:filetype == 'gentoo-package-use'
|
elseif a:filetype == 'gentoo-package-use'
|
||||||
call s:MapDelimiters('#', '')
|
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"
|
elseif a:filetype == "gnuplot"
|
||||||
call s:MapDelimiters('#','')
|
call s:MapDelimiters('#','')
|
||||||
elseif a:filetype == "groovy"
|
elseif a:filetype == "groovy"
|
||||||
call s:MapDelimitersWithAlternative('//','', '/*','*/')
|
call s:MapDelimitersWithAlternative('//','', '/*','*/')
|
||||||
|
elseif a:filetype == "grub"
|
||||||
|
call s:MapDelimiters('#', '')
|
||||||
elseif a:filetype == "gtkrc"
|
elseif a:filetype == "gtkrc"
|
||||||
call s:MapDelimiters('#', '')
|
call s:MapDelimiters('#', '')
|
||||||
elseif a:filetype == "haskell"
|
elseif a:filetype == "haskell"
|
||||||
@@ -426,6 +450,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
|||||||
call s:MapDelimiters('#', '')
|
call s:MapDelimiters('#', '')
|
||||||
elseif a:filetype == "lilypond"
|
elseif a:filetype == "lilypond"
|
||||||
call s:MapDelimiters('%', '')
|
call s:MapDelimiters('%', '')
|
||||||
|
elseif a:filetype == "liquid"
|
||||||
|
call s:MapDelimiters('{%', '%}')
|
||||||
elseif a:filetype == "lisp"
|
elseif a:filetype == "lisp"
|
||||||
call s:MapDelimitersWithAlternative(';','', '#|', '|#')
|
call s:MapDelimitersWithAlternative(';','', '#|', '|#')
|
||||||
elseif a:filetype == "lite"
|
elseif a:filetype == "lite"
|
||||||
@@ -470,8 +496,12 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
|||||||
call s:MapDelimiters('%', '')
|
call s:MapDelimiters('%', '')
|
||||||
elseif a:filetype == "mib"
|
elseif a:filetype == "mib"
|
||||||
call s:MapDelimiters('--', '')
|
call s:MapDelimiters('--', '')
|
||||||
|
elseif a:filetype == "mkd"
|
||||||
|
call s:MapDelimiters('>', '')
|
||||||
elseif a:filetype == "mma"
|
elseif a:filetype == "mma"
|
||||||
call s:MapDelimiters('(*','*)')
|
call s:MapDelimiters('(*','*)')
|
||||||
|
elseif a:filetype == "modconf"
|
||||||
|
call s:MapDelimiters('#', '')
|
||||||
elseif a:filetype == "model"
|
elseif a:filetype == "model"
|
||||||
call s:MapDelimiters('$','$')
|
call s:MapDelimiters('$','$')
|
||||||
elseif a:filetype =~ "moduala."
|
elseif a:filetype =~ "moduala."
|
||||||
@@ -482,6 +512,10 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
|||||||
call s:MapDelimiters('(*','*)')
|
call s:MapDelimiters('(*','*)')
|
||||||
elseif a:filetype == "monk"
|
elseif a:filetype == "monk"
|
||||||
call s:MapDelimiters(';', '')
|
call s:MapDelimiters(';', '')
|
||||||
|
elseif a:filetype == "mplayerconf"
|
||||||
|
call s:MapDelimiters('#', '')
|
||||||
|
elseif a:filetype == "mrxvtrc"
|
||||||
|
call s:MapDelimiters('#', '')
|
||||||
elseif a:filetype == "mush"
|
elseif a:filetype == "mush"
|
||||||
call s:MapDelimiters('#', '')
|
call s:MapDelimiters('#', '')
|
||||||
elseif a:filetype == "muttrc"
|
elseif a:filetype == "muttrc"
|
||||||
@@ -496,6 +530,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
|||||||
call s:MapDelimiters('/*', '')
|
call s:MapDelimiters('/*', '')
|
||||||
elseif a:filetype == "ncf"
|
elseif a:filetype == "ncf"
|
||||||
call s:MapDelimiters(';', '')
|
call s:MapDelimiters(';', '')
|
||||||
|
elseif a:filetype == "nerdtree"
|
||||||
|
call s:MapDelimiters('', '')
|
||||||
elseif a:filetype == "netdict"
|
elseif a:filetype == "netdict"
|
||||||
call s:MapDelimiters('', '')
|
call s:MapDelimiters('', '')
|
||||||
elseif a:filetype == "netrw"
|
elseif a:filetype == "netrw"
|
||||||
@@ -532,6 +568,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
|||||||
call s:MapDelimitersWithAlternative('{','}', '(*', '*)')
|
call s:MapDelimitersWithAlternative('{','}', '(*', '*)')
|
||||||
elseif a:filetype == "passwd"
|
elseif a:filetype == "passwd"
|
||||||
call s:MapDelimiters('','')
|
call s:MapDelimiters('','')
|
||||||
|
elseif a:filetype == "patran"
|
||||||
|
call s:MapDelimitersWithAlternative('$','','/*', '*/')
|
||||||
elseif a:filetype == "pcap"
|
elseif a:filetype == "pcap"
|
||||||
call s:MapDelimiters('#', '')
|
call s:MapDelimiters('#', '')
|
||||||
elseif a:filetype == "pccts"
|
elseif a:filetype == "pccts"
|
||||||
@@ -580,6 +618,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
|||||||
call s:MapDelimiters('#', '')
|
call s:MapDelimiters('#', '')
|
||||||
elseif a:filetype == "ptcap"
|
elseif a:filetype == "ptcap"
|
||||||
call s:MapDelimiters('#', '')
|
call s:MapDelimiters('#', '')
|
||||||
|
elseif a:filetype == "pyrex"
|
||||||
|
call s:MapDelimiters('#','')
|
||||||
elseif a:filetype == "python"
|
elseif a:filetype == "python"
|
||||||
call s:MapDelimiters('#','')
|
call s:MapDelimiters('#','')
|
||||||
elseif a:filetype == "qf"
|
elseif a:filetype == "qf"
|
||||||
@@ -604,6 +644,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
|||||||
call s:MapDelimiters('#', '')
|
call s:MapDelimiters('#', '')
|
||||||
elseif a:filetype == "rexx"
|
elseif a:filetype == "rexx"
|
||||||
call s:MapDelimiters('/*','*/')
|
call s:MapDelimiters('/*','*/')
|
||||||
|
elseif a:filetype == "rib"
|
||||||
|
call s:MapDelimiters('#','')
|
||||||
elseif a:filetype == "robots"
|
elseif a:filetype == "robots"
|
||||||
call s:MapDelimiters('#', '')
|
call s:MapDelimiters('#', '')
|
||||||
elseif a:filetype == "rpl"
|
elseif a:filetype == "rpl"
|
||||||
@@ -640,6 +682,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
|||||||
call s:MapDelimiters('#', '')
|
call s:MapDelimiters('#', '')
|
||||||
elseif a:filetype == "selectbuf"
|
elseif a:filetype == "selectbuf"
|
||||||
call s:MapDelimiters('', '')
|
call s:MapDelimiters('', '')
|
||||||
|
elseif a:filetype == "services"
|
||||||
|
call s:MapDelimiters('#', '')
|
||||||
elseif a:filetype == "sgml"
|
elseif a:filetype == "sgml"
|
||||||
call s:MapDelimiters('<!','>')
|
call s:MapDelimiters('<!','>')
|
||||||
elseif a:filetype == "sgmldecl"
|
elseif a:filetype == "sgmldecl"
|
||||||
@@ -658,6 +702,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
|||||||
call s:MapDelimiters('%', '')
|
call s:MapDelimiters('%', '')
|
||||||
elseif a:filetype == "sl"
|
elseif a:filetype == "sl"
|
||||||
call s:MapDelimiters('/*','*/')
|
call s:MapDelimiters('/*','*/')
|
||||||
|
elseif a:filetype == "slice"
|
||||||
|
call s:MapDelimitersWithAlternative('//','', '/*','*/')
|
||||||
elseif a:filetype == "slrnrc"
|
elseif a:filetype == "slrnrc"
|
||||||
call s:MapDelimiters('%', '')
|
call s:MapDelimiters('%', '')
|
||||||
elseif a:filetype == "sm"
|
elseif a:filetype == "sm"
|
||||||
@@ -702,10 +748,18 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
|||||||
call s:MapDelimiters('--', '')
|
call s:MapDelimiters('--', '')
|
||||||
elseif a:filetype == "strace"
|
elseif a:filetype == "strace"
|
||||||
call s:MapDelimiters('/*','*/')
|
call s:MapDelimiters('/*','*/')
|
||||||
|
elseif a:filetype == "sudoers"
|
||||||
|
call s:MapDelimiters('#', '')
|
||||||
|
elseif a:filetype == "SVKAnnotate"
|
||||||
|
call s:MapDelimiters('','')
|
||||||
elseif a:filetype == "svn"
|
elseif a:filetype == "svn"
|
||||||
call s:MapDelimiters('','')
|
call s:MapDelimiters('','')
|
||||||
|
elseif a:filetype == "SVNAnnotate"
|
||||||
|
call s:MapDelimiters('','')
|
||||||
elseif a:filetype == "SVNcommitlog"
|
elseif a:filetype == "SVNcommitlog"
|
||||||
call s:MapDelimiters('','')
|
call s:MapDelimiters('','')
|
||||||
|
elseif a:filetype == "SVNdiff"
|
||||||
|
call s:MapDelimiters('','')
|
||||||
elseif a:filetype == "systemverilog"
|
elseif a:filetype == "systemverilog"
|
||||||
call s:MapDelimitersWithAlternative('//','', '/*','*/')
|
call s:MapDelimitersWithAlternative('//','', '/*','*/')
|
||||||
elseif a:filetype == "tads"
|
elseif a:filetype == "tads"
|
||||||
@@ -716,6 +770,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
|||||||
call s:MapDelimiters(';', '')
|
call s:MapDelimiters(';', '')
|
||||||
elseif a:filetype == "tak"
|
elseif a:filetype == "tak"
|
||||||
call s:MapDelimiters('$', '')
|
call s:MapDelimiters('$', '')
|
||||||
|
elseif a:filetype == "tar"
|
||||||
|
call s:MapDelimiters('', '')
|
||||||
elseif a:filetype == "tasm"
|
elseif a:filetype == "tasm"
|
||||||
call s:MapDelimiters(';', '')
|
call s:MapDelimiters(';', '')
|
||||||
elseif a:filetype == "tcl"
|
elseif a:filetype == "tcl"
|
||||||
@@ -768,6 +824,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
|||||||
call s:MapDelimiters('"','')
|
call s:MapDelimiters('"','')
|
||||||
elseif a:filetype == "viminfo"
|
elseif a:filetype == "viminfo"
|
||||||
call s:MapDelimiters('','')
|
call s:MapDelimiters('','')
|
||||||
|
elseif a:filetype == "vimperator"
|
||||||
|
call s:MapDelimiters('"','')
|
||||||
elseif a:filetype == "virata"
|
elseif a:filetype == "virata"
|
||||||
call s:MapDelimiters('%', '')
|
call s:MapDelimiters('%', '')
|
||||||
elseif a:filetype == "vo_base"
|
elseif a:filetype == "vo_base"
|
||||||
@@ -780,6 +838,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
|||||||
call s:MapDelimiters('##', '')
|
call s:MapDelimiters('##', '')
|
||||||
elseif a:filetype == "wget"
|
elseif a:filetype == "wget"
|
||||||
call s:MapDelimiters('#', '')
|
call s:MapDelimiters('#', '')
|
||||||
|
elseif a:filetype ==? "Wikipedia"
|
||||||
|
call s:MapDelimiters('<!--','-->')
|
||||||
elseif a:filetype == "winbatch"
|
elseif a:filetype == "winbatch"
|
||||||
call s:MapDelimiters(';', '')
|
call s:MapDelimiters(';', '')
|
||||||
elseif a:filetype == "wml"
|
elseif a:filetype == "wml"
|
||||||
@@ -1031,7 +1091,7 @@ function s:CommentBlock(top, bottom, lSide, rSide, forceNested )
|
|||||||
|
|
||||||
if s:Multipart()
|
if s:Multipart()
|
||||||
"stick the right delimiter down
|
"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 firstLeftDelim = s:FindDelimiterIndex(b:left, theLine)
|
||||||
let lastRightDelim = s:LastIndexOfDelim(b:right, theLine)
|
let lastRightDelim = s:LastIndexOfDelim(b:right, theLine)
|
||||||
@@ -1236,12 +1296,14 @@ function s:CommentLinesSexy(topline, bottomline)
|
|||||||
call setline(a:topline, theLine)
|
call setline(a:topline, theLine)
|
||||||
|
|
||||||
"comment the bottom line
|
"comment the bottom line
|
||||||
let theLine = getline(a:bottomline)
|
if a:bottomline != a:topline
|
||||||
let lineHasTabs = s:HasLeadingTabs(theLine)
|
let theLine = getline(a:bottomline)
|
||||||
if lineHasTabs
|
let lineHasTabs = s:HasLeadingTabs(theLine)
|
||||||
let theLine = s:ConvertLeadingTabsToSpaces(theLine)
|
if lineHasTabs
|
||||||
|
let theLine = s:ConvertLeadingTabsToSpaces(theLine)
|
||||||
|
endif
|
||||||
|
let theLine = s:SwapOutterMultiPartDelimsForPlaceHolders(theLine)
|
||||||
endif
|
endif
|
||||||
let theLine = s:SwapOutterMultiPartDelimsForPlaceHolders(theLine)
|
|
||||||
let theLine = s:AddRightDelim(spaceString . right, theLine)
|
let theLine = s:AddRightDelim(spaceString . right, theLine)
|
||||||
if lineHasTabs
|
if lineHasTabs
|
||||||
let theLine = s:ConvertLeadingSpacesToTabs(theLine)
|
let theLine = s:ConvertLeadingSpacesToTabs(theLine)
|
||||||
@@ -1398,7 +1460,7 @@ function s:InvertComment(firstLine, lastLine)
|
|||||||
|
|
||||||
" if the line is commented normally, uncomment it
|
" if the line is commented normally, uncomment it
|
||||||
if s:IsCommentedFromStartOfLine(b:left, theLine) || s:IsCommentedFromStartOfLine(b:leftAlt, theLine)
|
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
|
let currentLine = currentLine + 1
|
||||||
|
|
||||||
" check if the line is commented sexually
|
" check if the line is commented sexually
|
||||||
@@ -1430,14 +1492,14 @@ endfunction
|
|||||||
" 'nested', 'toEOL', 'prepend', 'append', 'insert', 'uncomment', 'yank'
|
" 'nested', 'toEOL', 'prepend', 'append', 'insert', 'uncomment', 'yank'
|
||||||
function! NERDComment(isVisual, type) range
|
function! NERDComment(isVisual, type) range
|
||||||
" we want case sensitivity when commenting
|
" we want case sensitivity when commenting
|
||||||
let prevIgnoreCase = &ignorecase
|
let oldIgnoreCase = &ignorecase
|
||||||
set noignorecase
|
set noignorecase
|
||||||
|
|
||||||
if a:isVisual
|
if a:isVisual
|
||||||
let firstLine = line("'<")
|
let firstLine = line("'<")
|
||||||
let lastLine = line("'>")
|
let lastLine = line("'>")
|
||||||
let firstCol = col("'<")
|
let firstCol = col("'<")
|
||||||
let lastCol = col("'>")
|
let lastCol = col("'>") - (&selection == 'exclusive' ? 1 : 0)
|
||||||
else
|
else
|
||||||
let firstLine = a:firstline
|
let firstLine = a:firstline
|
||||||
let lastLine = a:lastline
|
let lastLine = a:lastline
|
||||||
@@ -1468,7 +1530,7 @@ function! NERDComment(isVisual, type) range
|
|||||||
try
|
try
|
||||||
call s:CommentLinesSexy(firstLine, lastLine)
|
call s:CommentLinesSexy(firstLine, lastLine)
|
||||||
catch /NERDCommenter.Delimiters/
|
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/
|
catch /NERDCommenter.Nesting/
|
||||||
call s:NerdEcho("Sexy comment aborted. Nested sexy cannot be nested", 0)
|
call s:NerdEcho("Sexy comment aborted. Nested sexy cannot be nested", 0)
|
||||||
endtry
|
endtry
|
||||||
@@ -1477,7 +1539,7 @@ function! NERDComment(isVisual, type) range
|
|||||||
let theLine = getline(firstLine)
|
let theLine = getline(firstLine)
|
||||||
|
|
||||||
if s:IsInSexyComment(firstLine) || s:IsCommentedFromStartOfLine(b:left, theLine) || s:IsCommentedFromStartOfLine(b:leftAlt, theLine)
|
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
|
else
|
||||||
call s:CommentLinesToggle(forceNested, firstLine, lastLine)
|
call s:CommentLinesToggle(forceNested, firstLine, lastLine)
|
||||||
endif
|
endif
|
||||||
@@ -1506,7 +1568,7 @@ function! NERDComment(isVisual, type) range
|
|||||||
call s:PlaceDelimitersAndInsBetween()
|
call s:PlaceDelimitersAndInsBetween()
|
||||||
|
|
||||||
elseif a:type == 'uncomment'
|
elseif a:type == 'uncomment'
|
||||||
call s:UncommentLines(0, firstLine, lastLine)
|
call s:UncommentLines(firstLine, lastLine)
|
||||||
|
|
||||||
elseif a:type == 'yank'
|
elseif a:type == 'yank'
|
||||||
if a:isVisual
|
if a:isVisual
|
||||||
@@ -1519,7 +1581,7 @@ function! NERDComment(isVisual, type) range
|
|||||||
execute firstLine .','. lastLine .'call NERDComment('. a:isVisual .', "norm")'
|
execute firstLine .','. lastLine .'call NERDComment('. a:isVisual .', "norm")'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let &ignorecase = prevIgnoreCase
|
let &ignorecase = oldIgnoreCase
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:PlaceDelimitersAndInsBetween() function {{{2
|
" Function: s:PlaceDelimitersAndInsBetween() function {{{2
|
||||||
@@ -1665,14 +1727,13 @@ function s:RemoveDelimiters(left, right, line)
|
|||||||
return line
|
return line
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:UncommentLines(onlyWholeLineComs, topLine, bottomLine) {{{2
|
" Function: s:UncommentLines(topLine, bottomLine) {{{2
|
||||||
" This function uncomments the given lines
|
" This function uncomments the given lines
|
||||||
"
|
"
|
||||||
" Args:
|
" Args:
|
||||||
" onlyWholeLineComs: should be 1 for toggle style uncommenting
|
|
||||||
" topLine: the top line of the visual selection to uncomment
|
" topLine: the top line of the visual selection to uncomment
|
||||||
" bottomLine: the bottom 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
|
"make local copies of a:firstline and a:lastline and, if need be, swap
|
||||||
"them around if the top line is below the bottom
|
"them around if the top line is below the bottom
|
||||||
let l:firstline = a:topLine
|
let l:firstline = a:topLine
|
||||||
@@ -1705,12 +1766,7 @@ function s:UncommentLines(onlyWholeLineComs, topLine, bottomLine)
|
|||||||
|
|
||||||
"no sexy com was detected so uncomment the line as normal
|
"no sexy com was detected so uncomment the line as normal
|
||||||
else
|
else
|
||||||
let theLine = getline(currentLine)
|
call s:UncommentLinesNormal(currentLine, 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
|
|
||||||
let currentLine = currentLine + 1
|
let currentLine = currentLine + 1
|
||||||
endif
|
endif
|
||||||
endwhile
|
endwhile
|
||||||
@@ -1863,16 +1919,16 @@ function s:UncommentLineNormal(line)
|
|||||||
|
|
||||||
"remove the outter most left comment delim
|
"remove the outter most left comment delim
|
||||||
if indxLeft != -1 && (indxLeft < indxLeftAlt || indxLeftAlt == -1)
|
if indxLeft != -1 && (indxLeft < indxLeftAlt || indxLeftAlt == -1)
|
||||||
let line = s:ReplaceLeftMostDelim(b:left, '', line)
|
let line = s:RemoveDelimiters(b:left, '', line)
|
||||||
elseif indxLeftAlt != -1
|
elseif indxLeftAlt != -1
|
||||||
let line = s:ReplaceLeftMostDelim(b:leftAlt, '', line)
|
let line = s:RemoveDelimiters(b:leftAlt, '', line)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
"remove the outter most right comment delim
|
"remove the outter most right comment delim
|
||||||
if indxRight != -1 && (indxRight < indxRightAlt || indxRightAlt == -1)
|
if indxRight != -1 && (indxRight < indxRightAlt || indxRightAlt == -1)
|
||||||
let line = s:ReplaceRightMostDelim(b:right, '', line)
|
let line = s:RemoveDelimiters('', b:right, line)
|
||||||
elseif indxRightAlt != -1
|
elseif indxRightAlt != -1
|
||||||
let line = s:ReplaceRightMostDelim(b:rightAlt, '', line)
|
let line = s:RemoveDelimiters('', b:rightAlt, line)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -2277,12 +2333,12 @@ function s:FindBoundingLinesOfSexyCom(lineNum)
|
|||||||
let theLine = getline(currentLine)
|
let theLine = getline(currentLine)
|
||||||
|
|
||||||
"check if the current line is the top of the sexy comment
|
"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 top = currentLine
|
||||||
let currentLine = a:lineNum
|
let currentLine = a:lineNum
|
||||||
|
|
||||||
"check if the current line is the bottom of the sexy comment
|
"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
|
let bottom = currentLine
|
||||||
|
|
||||||
"the right delimiter is on the same line as the last sexyComMarker
|
"the right delimiter is on the same line as the last sexyComMarker
|
||||||
|
|||||||
Reference in New Issue
Block a user