78 Commits

Author SHA1 Message Date
Martin Grenfell
377a04eeec add support for xquery 2008-07-27 22:11:34 +12:00
Martin Grenfell
709d01d074 add support for llvm 2008-07-27 22:09:45 +12:00
Martin Grenfell
2e9b7ca58e dont map the insert comment map if the key isnt set 2008-07-20 00:59:51 +12:00
Martin Grenfell
01d6c8c7f6 change version to 2.1.17 2008-07-19 21:03:39 +12:00
Martin Grenfell
89c008b644 disable the ctrl-c mapping by default 2008-07-19 21:02:52 +12:00
Martin Grenfell
1b9033c7ee apply a doc fix path for NERDMapLeader option 2008-07-13 12:12:36 +12:00
Martin Grenfell
165d1e3686 add support for stata 2008-07-13 12:09:22 +12:00
Martin Grenfell
4567fae10f add support for mailcap 2008-07-13 12:09:03 +12:00
Martin Grenfell
2ea675da5e made a hack fix to haskell comments 2008-07-01 23:18:08 +12:00
Martin Grenfell
865d928a1f update changelog and credits 2008-06-27 12:46:56 +12:00
Martin Grenfell
8a0056a610 switch to version 2.1.16 2008-06-27 12:35:32 +12:00
Martin Grenfell
e466dd9418 fix compatibiltiy bug with vim 7.2 2008-06-27 12:35:02 +12:00
Martin Grenfell
a84365f174 switch version to 2.1.15 2008-06-22 12:09:48 +12:00
Martin Grenfell
1fc1decbe9 update changelog 2008-06-22 12:09:19 +12:00
Martin Grenfell
dc8275ffa0 update the header comments 2008-06-22 12:08:11 +12:00
Martin Grenfell
64f0798984 use wtfpl license, remove todo list from the help 2008-06-22 12:03:32 +12:00
Martin Grenfell
01f8df684c add support for group 2008-06-20 21:46:17 +12:00
Martin Grenfell
7c830eb223 remove all trailing whitespace 2008-06-15 21:36:23 +12:00
Martin Grenfell
af0d51d8b3 add support for bzr 2008-06-15 21:34:08 +12:00
Martin Grenfell
650396b1fc update the changelog 2008-05-24 18:55:53 +12:00
Martin Grenfell
cf54bfc7c4 add support for map 2008-05-24 18:55:08 +12:00
Martin Grenfell
6b2cc6c41d add support for mason 2008-05-24 16:35:03 +12:00
Martin Grenfell
e52840527a remove an out of date comment 2008-05-19 15:44:53 +12:00
Martin Grenfell
dee2021b8f fix some indenting in the changelog 2008-05-19 15:43:42 +12:00
Martin Grenfell
2da9787ff1 add support for pamconf 2008-05-19 15:42:19 +12:00
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
Martin Grenfell
6a9764f39a changed the version to 2.1.12 2008-03-31 18:11:58 +13:00
Martin Grenfell
6304c65434 added support for SVNdiff, gitAnnotate and gitdiff 2008-03-31 18:11:06 +13:00
Martin Grenfell
6089d08ed3 handy rakefile to create release zip files and deploy locally 2008-03-31 17:56:29 +13:00
Martin Grenfell
c53ae79ca3 added a credit and changelog entry for the previous commit 2008-03-10 21:17:51 +13:00
Martin Grenfell
432fe6b156 applied a patch from Li Jin to add support for 6 more filetypes 2008-03-10 21:14:03 +13:00
Martin Grenfell
aafe01e4e9 added support for patran and dakota 2008-03-10 21:10:22 +13:00
marty
4f05d713b4 updated version and timestamp 2008-02-24 00:31:44 +13:00
marty
59735a2904 bugfix: fixed a bug with &selection and visual commenting 2008-02-24 00:31:27 +13:00
marty
f8c60c7bd8 updated the version and updated time 2008-02-22 22:51:50 +13:00
marty
2783e3639d update to the change log 2008-02-22 22:49:53 +13:00
marty
6337d56893 added support for Wikipedia, mplayerconf and mkd 2008-02-22 22:45:56 +13:00
marty
a24534c6f1 bugfix: fixed a bug that was showing up when commenting in visual mode with multipart delims of different lengths 2008-02-06 21:08:40 +13:00
marty
122490be95 bugfix: now we take into account the &selection option and adjust visual selections accordingly 2008-02-06 20:23:54 +13:00
marty
d1af8af555 refactored a variable name 2008-02-06 20:11:17 +13:00
marty
08d14e7342 updated the version/last update comments 2008-01-18 23:21:04 +13:00
marty
532c58db62 added support for aap 2008-01-18 23:20:28 +13:00
marty
fb93d5869d added support for mrxvtrc, (SVN|SVK|CVS)Annotate 2008-01-18 23:18:20 +13:00
marty
78f182a601 made the NERDDefaultNesting option default to 1 2007-12-14 16:11:49 +13:00
marty
b6882e5d23 version bump and cleaned up the changelog a bit 2007-12-14 15:56:14 +13:00
marty
574f2841cc added support for assymptote 2007-12-14 15:53:12 +13:00
marty
023a62224e bugfix: fixed a bug with aligned comments and the NERDSpaceDelims option 2007-12-14 14:15:42 +13:00
marty
443eb8045e added dummy support for lhaskell 2007-12-14 12:52:15 +13:00
marty
13b0f4ee27 added the latest changes to teh changelog and gave credit 2007-12-12 22:28:55 +13:00
marty
ee3106ad45 bugfix: a bug was screwing up the removal of spaces when NERDSpaceDelims was set 2007-12-12 22:23:36 +13:00
marty
3161d57792 added new filetypes, updated plsql 2007-12-07 20:17:15 +13:00
3 changed files with 1068 additions and 836 deletions

18
Rakefile Normal file
View 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

View File

@@ -40,9 +40,9 @@ CONTENTS *NERDCommenterContents*
4.1 Delimiter detection heuristics....|NERDComHeuristics| 4.1 Delimiter detection heuristics....|NERDComHeuristics|
4.2 Nesting issues....................|NERDComNesting| 4.2 Nesting issues....................|NERDComNesting|
5.The author..............................|NERDComAuthor| 5.The author..............................|NERDComAuthor|
6.TODO list...............................|NERDComTodo| 6.Changelog...............................|NERDComChangelog|
7.Changelog...............................|NERDComChangelog| 7.Credits.................................|NERDComCredits|
8.Credits.................................|NERDComCredits| 8.License.................................|NERDComLicense|
============================================================================== ==============================================================================
1. Intro *NERDCommenter* 1. Intro *NERDCommenter*
@@ -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|
@@ -111,8 +111,9 @@ Adds comment delimiters to the start of line and goes into insert mode between
them. them.
<C-c> |NERDComInsertComment| |NERDComInsertComment|
Adds comment delimiters at the current cursor position and inserts between. Adds comment delimiters at the current cursor position and inserts between.
Disabled by default.
,ca |NERDComAltDelim| ,ca |NERDComAltDelim|
@@ -288,13 +289,19 @@ insert mode between the new delimiters.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
2.2.11 Insert comment map *NERDComInsertComment* 2.2.11 Insert comment map *NERDComInsertComment*
Default mapping: <C-c> Default mapping: disabled by default.
Change the mapping with: NERDComInInsertMap. Change the mapping with: NERDComInInsertMap.
Applicable modes: insert. Applicable modes: insert.
Adds comment delimiters at the current cursor position and inserts Adds comment delimiters at the current cursor position and inserts
between them. between them.
NOTE: prior to version 2.1.17 this was mapped to ctrl-c. To restore this
mapping add >
let NERDComInsertMap='<c-c>'
<
to your vimrc.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
2.2.12 Use alternate delims map *NERDComAltDelim* 2.2.12 Use alternate delims map *NERDComAltDelim*
@@ -651,17 +658,17 @@ When we uncomment this line it will go back to what it was.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
*NERDMapleader* *NERDMapleader*
Values: arbitrary string. Values: arbitrary string.
Default: \c Default: ,c
NERDMapleader is used to specify what all the NERD commenter key mappings NERDMapleader is used to specify what all the NERD commenter key mappings
begin with. begin with.
The default key mappings will look like this: > The default key mappings will look like this: >
\cc ,cc
\cu ,cu
\ca ,ca
\ci ,ci
\cs ,cs
... ...
< <
However, if this line: > However, if this line: >
@@ -744,7 +751,7 @@ If this option is set to 1 then the top style will be used.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
*NERDDefaultNesting* *NERDDefaultNesting*
Values: 0 or 1. Values: 0 or 1.
Default 0. Default 1.
When this option is set to 1, comments are nested automatically. That is, if 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 you hit ,cc on a line that is already commented it will be commented
@@ -839,7 +846,7 @@ will become: >
for simplicity) for simplicity)
============================================================================== ==============================================================================
6. The author *NERDComAuthor* 5. The author *NERDComAuthor*
The author of the NERD commenter is Martyzillatron --- the half robot, half The author of the NERD commenter is Martyzillatron --- the half robot, half
dinosaur bastard son of Megatron and Godzilla. He enjoys destroying dinosaur bastard son of Megatron and Godzilla. He enjoys destroying
@@ -850,15 +857,81 @@ its a lonely life being the worlds premier terror machine. How would you feel
if your face looked like a toaster and a t-rex put together? :( if your face looked like a toaster and a t-rex put together? :(
============================================================================== ==============================================================================
7. TODO list *NERDComTodo* 7. Changelog *NERDComChangelog*
Uncommenting of minimal comments needs to be more robust. Currently it is easy 2.1.18
to get illegal syntax when uncommenting them. - add support for llvm. Thanks to nicothakis.
- add support for xquery. Thanks to Phillip Kovalev.
2.1.17
- fixed haskell delimiters (hackily). Thanks to Elias Pipping.
- add support for mailcap. Thanks to Pascal Brueckner.
- add support for stata. Thanks to Jerónimo Carballo.
- applied a patch from ewfalor to fix an error in the help file with the
NERDMapleader doc
- disable the insert mode ctrl-c mapping by default, see :help
NERDComInsertComment if you wish to restore it
2.1.16
- compatibility fix for vim7.2, cheers to Ben Schmidt, David Fishburn, and
Erik Falor for the emails, and to JaGoTerr for posting the issue.
2.1.15
- added pamconf support, thanks to Martin Kustermann
- added mason support, thanks to Indriði Einarsson
- added map support, thanks to Chris
- added bzr support, thanks to Stromnov
- added group support, thanks to Krzysztof A. Adamski
- change license to wtfpl
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
- 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
==============================================================================
8. Changelog *NERDComChangelog*
2.1.7 2.1.7
- added support for haml, thx to Greb Weber - added support for haml, thx to Greb Weber
@@ -1008,12 +1081,12 @@ to get illegal syntax when uncommenting them.
filetypes. filetypes.
- Added '#' comments as an alternative for the asm filetype - Added '#' comments as an alternative for the asm filetype
Thanks to Markus Klinik and Anders for bug reports, and again to Anders Thanks to Markus Klinik and Anders for bug reports, and again to Anders
for his patch. Thanks to John O'Shea and fREW for the filetype for his patch. Thanks to John O'Shea and fREW for the filetype
information. information.
============================================================================== ==============================================================================
8. Credits *NERDComCredits* 7. Credits *NERDComCredits*
Thanks and respect to the following people: Thanks and respect to the following people:
@@ -1123,6 +1196,27 @@ Cheers to Cheng Fang for the bug reports :D
Cheers to Yongwei Wu for a bug report about the passwd filetype. 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.
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.
Thanks to Ben Schmidt, David Fishburn, and Erik Falor for emailing me about an
incompatibility with vim7.2. Thanks also to JaGoTerr for posting the issue.
Thanks to Elias Pipping for sending me a bug report about haskell commenting.
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
@@ -1145,7 +1239,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
@@ -1164,4 +1258,35 @@ 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
Brett Warneke spectre
Pipp lhaskell
Renald Buter scala
Vladimir Lomov asymptote
Marco mrxvtrc, aap
nicothakis SVNAnnotate, CVSAnnotate, SVKAnnotate,
SVNdiff, gitAnnotate, gitdiff, dtrace
llvm
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, bzr
Martin Kustermann pamconf
Indriði Einarsson mason
Chris map
Krzysztof A. Adamski group
Pascal Brueckner mailcap
Jerónimo Carballo stata
Phillip Kovalev xquery
==============================================================================
8. License *NERDComLicense*
The NERD commenter is released under the wtfpl.
See http://sam.zoy.org/wtfpl/COPYING.

View File

@@ -1,11 +1,16 @@
" vim global plugin that provides easy code commenting for various file types " ============================================================================
" Last Change: 26 oct 2007 " File: NERD_commenter.vim
" Maintainer: Martin Grenfell <martin_grenfell at msn.com> " Description: vim global plugin that provides easy code commenting
let s:NERD_commenter_version = 2.1.7 " Maintainer: Martin Grenfell <martin_grenfell at msn dot com>
" Version: 2.1.17
" For help documentation type :help NERDCommenter. If this fails, Restart vim " Last Change: 27 June, 2008
" and try again. If it sill doesnt work... the help page is at the bottom " License: This program is free software. It comes without any warranty,
" of this file. " to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
" ============================================================================
" Section: script init stuff {{{1 " Section: script init stuff {{{1
if exists("loaded_nerd_comments") if exists("loaded_nerd_comments")
@@ -54,12 +59,12 @@ call s:InitVariable("g:NERDAllowAnyVisualDelims", 1)
call s:InitVariable("g:NERDBlockComIgnoreEmpty", 0) call s:InitVariable("g:NERDBlockComIgnoreEmpty", 0)
call s:InitVariable("g:NERDCommentWholeLinesInVMode", 0) call s:InitVariable("g:NERDCommentWholeLinesInVMode", 0)
call s:InitVariable("g:NERDCompactSexyComs", 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: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)
@@ -72,7 +77,7 @@ call s:InitVariable("g:NERDAppendComMap", g:NERDMapleader . 'A')
call s:InitVariable("g:NERDComAlignBothMap", g:NERDMapleader . 'b') call s:InitVariable("g:NERDComAlignBothMap", g:NERDMapleader . 'b')
call s:InitVariable("g:NERDComAlignLeftMap", g:NERDMapleader . 'l') call s:InitVariable("g:NERDComAlignLeftMap", g:NERDMapleader . 'l')
call s:InitVariable("g:NERDComAlignRightMap", g:NERDMapleader . 'r') call s:InitVariable("g:NERDComAlignRightMap", g:NERDMapleader . 'r')
call s:InitVariable("g:NERDComInInsertMap", '<C-c>') call s:InitVariable("g:NERDComInInsertMap", '')
call s:InitVariable("g:NERDComLineInvertMap", g:NERDMapleader . 'i') call s:InitVariable("g:NERDComLineInvertMap", g:NERDMapleader . 'i')
call s:InitVariable("g:NERDComLineMap", g:NERDMapleader . 'c') call s:InitVariable("g:NERDComLineMap", g:NERDMapleader . 'c')
call s:InitVariable("g:NERDComLineNestMap", g:NERDMapleader . 'n') call s:InitVariable("g:NERDComLineNestMap", g:NERDMapleader . 'n')
@@ -132,6 +137,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"
@@ -166,6 +173,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
call s:MapDelimiters('''', '') call s:MapDelimiters('''', '')
elseif a:filetype == "asterisk" elseif a:filetype == "asterisk"
call s:MapDelimiters(';', '') call s:MapDelimiters(';', '')
elseif a:filetype == "asy"
call s:MapDelimiters('//', '')
elseif a:filetype == "atlas" elseif a:filetype == "atlas"
call s:MapDelimiters('C','$') call s:MapDelimiters('C','$')
elseif a:filetype == "autohotkey" elseif a:filetype == "autohotkey"
@@ -196,6 +205,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
call s:MapDelimiters('%', '') call s:MapDelimiters('%', '')
elseif a:filetype == "btm" elseif a:filetype == "btm"
call s:MapDelimiters('::', '') call s:MapDelimiters('::', '')
elseif a:filetype == "bzr"
call s:MapDelimiters('', '')
elseif a:filetype == "caos" elseif a:filetype == "caos"
call s:MapDelimiters('*', '') call s:MapDelimiters('*', '')
elseif a:filetype == "catalog" elseif a:filetype == "catalog"
@@ -246,10 +257,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"
@@ -282,6 +297,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'
@@ -336,20 +353,38 @@ 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 == "group"
call s:MapDelimiters('','')
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"
call s:MapDelimitersWithAlternative('--','', '{-', '-}') call s:MapDelimitersWithAlternative('{-','-}', '--', '--')
elseif a:filetype == "hb" elseif a:filetype == "hb"
call s:MapDelimiters('#', '') call s:MapDelimiters('#', '')
elseif a:filetype == "h" elseif a:filetype == "h"
@@ -416,16 +451,22 @@ function s:SetUpForNewFiletype(filetype, forceReset)
call s:MapDelimiters('/*','*/') call s:MapDelimiters('/*','*/')
elseif a:filetype == "lftp" elseif a:filetype == "lftp"
call s:MapDelimiters('#', '') call s:MapDelimiters('#', '')
elseif a:filetype == "lhaskell"
call s:MapDelimiters('','')
elseif a:filetype == "lifelines" elseif a:filetype == "lifelines"
call s:MapDelimiters('/*','*/') call s:MapDelimiters('/*','*/')
elseif a:filetype == "lilo" elseif a:filetype == "lilo"
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"
call s:MapDelimiters('/*','*/') call s:MapDelimiters('/*','*/')
elseif a:filetype == "llvm"
call s:MapDelimiters(';','')
elseif a:filetype == "lookupfile" elseif a:filetype == "lookupfile"
call s:MapDelimiters('', '') call s:MapDelimiters('', '')
elseif a:filetype == "lotos" elseif a:filetype == "lotos"
@@ -448,14 +489,20 @@ function s:SetUpForNewFiletype(filetype, forceReset)
call s:MapDelimiters('dnl ', '') call s:MapDelimiters('dnl ', '')
elseif a:filetype == "mail" elseif a:filetype == "mail"
call s:MapDelimiters('> ','') call s:MapDelimiters('> ','')
elseif a:filetype == "mailcap"
call s:MapDelimiters('#','')
elseif a:filetype == "make" elseif a:filetype == "make"
call s:MapDelimiters('#','') call s:MapDelimiters('#','')
elseif a:filetype == "map"
call s:MapDelimiters('%', '')
elseif a:filetype == "maple" elseif a:filetype == "maple"
call s:MapDelimiters('#', '') call s:MapDelimiters('#', '')
elseif a:filetype == "markdown" elseif a:filetype == "markdown"
call s:MapDelimiters('<!--', '-->') call s:MapDelimiters('<!--', '-->')
elseif a:filetype == "masm" elseif a:filetype == "masm"
call s:MapDelimiters(';', '') call s:MapDelimiters(';', '')
elseif a:filetype == "mason"
call s:MapDelimiters('<% #', '%>')
elseif a:filetype == "master" elseif a:filetype == "master"
call s:MapDelimiters('$', '') call s:MapDelimiters('$', '')
elseif a:filetype == "matlab" elseif a:filetype == "matlab"
@@ -466,8 +513,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."
@@ -478,6 +529,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"
@@ -492,6 +547,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"
@@ -524,10 +581,14 @@ function s:SetUpForNewFiletype(filetype, forceReset)
call s:MapDelimiters('', '') call s:MapDelimiters('', '')
elseif a:filetype == "ox" elseif a:filetype == "ox"
call s:MapDelimiters('//', '') call s:MapDelimiters('//', '')
elseif a:filetype == "pamconf"
call s:MapDelimiters('#', '')
elseif a:filetype == "pascal" elseif a:filetype == "pascal"
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"
@@ -553,7 +614,7 @@ function s:SetUpForNewFiletype(filetype, forceReset)
elseif a:filetype == "plm" elseif a:filetype == "plm"
call s:MapDelimitersWithAlternative('//','', '/*','*/') call s:MapDelimitersWithAlternative('//','', '/*','*/')
elseif a:filetype == "plsql" elseif a:filetype == "plsql"
call s:MapDelimiters('--', '') call s:MapDelimitersWithAlternative('--', '', '/*', '*/')
elseif a:filetype == "po" elseif a:filetype == "po"
call s:MapDelimiters('#', '') call s:MapDelimiters('#', '')
elseif a:filetype == "postscr" elseif a:filetype == "postscr"
@@ -576,6 +637,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"
@@ -600,6 +663,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"
@@ -620,6 +685,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
call s:MapDelimitersWithAlternative('//','', '/*', '') call s:MapDelimitersWithAlternative('//','', '/*', '')
elseif a:filetype == "sather" elseif a:filetype == "sather"
call s:MapDelimiters('--', '') call s:MapDelimiters('--', '')
elseif a:filetype == "scala"
call s:MapDelimitersWithAlternative('//','', '/*','*/')
elseif a:filetype == "scheme" elseif a:filetype == "scheme"
call s:MapDelimiters(';', '') call s:MapDelimiters(';', '')
elseif a:filetype == "scilab" elseif a:filetype == "scilab"
@@ -634,6 +701,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"
@@ -652,6 +721,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"
@@ -676,6 +747,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
call s:MapDelimiters('#', '') call s:MapDelimiters('#', '')
elseif a:filetype == "specman" elseif a:filetype == "specman"
call s:MapDelimiters('//', '') call s:MapDelimiters('//', '')
elseif a:filetype == "spectre"
call s:MapDelimitersWithAlternative('//', '', '*', '')
elseif a:filetype == "spice" elseif a:filetype == "spice"
call s:MapDelimiters('$', '') call s:MapDelimiters('$', '')
elseif a:filetype == "sql" elseif a:filetype == "sql"
@@ -690,14 +763,24 @@ function s:SetUpForNewFiletype(filetype, forceReset)
call s:MapDelimiters('#', '') call s:MapDelimiters('#', '')
elseif a:filetype == "st" elseif a:filetype == "st"
call s:MapDelimiters('"','') call s:MapDelimiters('"','')
elseif a:filetype == "stata"
call s:MapDelimiters('/*','*/')
elseif a:filetype == "stp" elseif a:filetype == "stp"
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"
@@ -708,6 +791,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"
@@ -760,6 +845,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"
@@ -772,6 +859,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"
@@ -806,6 +895,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
call s:MapDelimiters('/*','*/') call s:MapDelimiters('/*','*/')
elseif a:filetype == "yaml" elseif a:filetype == "yaml"
call s:MapDelimiters('#','') call s:MapDelimiters('#','')
elseif a:filetype == "xquery"
call s:MapDelimiters('(:',':)')
elseif a:filetype == "z8a" elseif a:filetype == "z8a"
call s:MapDelimiters(';', '') call s:MapDelimiters(';', '')
@@ -1023,7 +1114,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)
@@ -1102,12 +1193,12 @@ function s:CommentLines(forceNested, alignLeft, alignRight, firstLine, lastLine)
" check if we can comment this line " check if we can comment this line
if !isCommented || g:NERDUsePlaceHolders || s:Multipart() if !isCommented || g:NERDUsePlaceHolders || s:Multipart()
if a:alignLeft if a:alignLeft
let theLine = s:AddLeftDelimAligned(b:left, theLine, leftAlignIndx) let theLine = s:AddLeftDelimAligned(s:GetLeft(0,1,0), theLine, leftAlignIndx)
else else
let theLine = s:AddLeftDelim(s:GetLeft(0,1,0), theLine) let theLine = s:AddLeftDelim(s:GetLeft(0,1,0), theLine)
endif endif
if a:alignRight if a:alignRight
let theLine = s:AddRightDelimAligned(b:right, theLine, rightAlignIndx) let theLine = s:AddRightDelimAligned(s:GetRight(0,1,0), theLine, rightAlignIndx)
else else
let theLine = s:AddRightDelim(s:GetRight(0,1,0), theLine) let theLine = s:AddRightDelim(s:GetRight(0,1,0), theLine)
endif endif
@@ -1228,12 +1319,14 @@ function s:CommentLinesSexy(topline, bottomline)
call setline(a:topline, theLine) call setline(a:topline, theLine)
"comment the bottom line "comment the bottom line
if a:bottomline != a:topline
let theLine = getline(a:bottomline) let theLine = getline(a:bottomline)
let lineHasTabs = s:HasLeadingTabs(theLine) let lineHasTabs = s:HasLeadingTabs(theLine)
if lineHasTabs if lineHasTabs
let theLine = s:ConvertLeadingTabsToSpaces(theLine) let theLine = s:ConvertLeadingTabsToSpaces(theLine)
endif endif
let theLine = s:SwapOutterMultiPartDelimsForPlaceHolders(theLine) let theLine = s:SwapOutterMultiPartDelimsForPlaceHolders(theLine)
endif
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)
@@ -1390,7 +1483,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
@@ -1422,14 +1515,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
@@ -1460,7 +1553,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
@@ -1469,7 +1562,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
@@ -1498,7 +1591,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
@@ -1511,7 +1604,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
@@ -1657,14 +1750,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
@@ -1697,12 +1789,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)
if a:onlyWholeLineComs && (s:IsCommentedFromStartOfLine(b:left, theLine) || s:IsCommentedFromStartOfLine(b:leftAlt, theLine))
call s:UncommentLinesNormal(currentLine, currentLine) 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
@@ -1834,15 +1921,15 @@ function s:UncommentLineNormal(line)
let line = a:line let line = a:line
"get the comment status on the line so we know how it is commented "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 "it is commented with b:left and b:right so remove these delims
if lineCommentStatus == 1 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 "it is commented with b:leftAlt and b:rightAlt so remove these delims
elseif lineCommentStatus == 2 && g:NERDRemoveAltComs 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 "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 "any random left or right delims on it and remove the outtermost ones
@@ -1855,16 +1942,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
@@ -2269,12 +2356,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
@@ -3211,7 +3298,9 @@ execute 'nmap <silent>' . g:NERDAppendComMap . ' :call NERDComment(0, "append")<
execute 'nmap <silent>' . g:NERDPrependComMap . ' :call NERDComment(0, "prepend")<cr>' execute 'nmap <silent>' . g:NERDPrependComMap . ' :call NERDComment(0, "prepend")<cr>'
" set up the mapping to insert comment delims at the cursor position in insert mode " set up the mapping to insert comment delims at the cursor position in insert mode
execute 'inoremap <silent>' . g:NERDComInInsertMap . ' ' . '<SPACE><BS><ESC>:call NERDComment(0, "insert")<CR>' if g:NERDComInInsertMap != ''
execute 'inoremap <silent>' . g:NERDComInInsertMap . ' ' . '<SPACE><BS><ESC>:call NERDComment(0, "insert")<CR>'
endif
" Section: Menu item setup {{{1 " Section: Menu item setup {{{1
" =========================================================================== " ===========================================================================