mirror of
https://github.com/preservim/nerdcommenter.git
synced 2025-11-08 09:53:47 -05:00
Compare commits
56 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
01d6c8c7f6 | ||
|
|
89c008b644 | ||
|
|
1b9033c7ee | ||
|
|
165d1e3686 | ||
|
|
4567fae10f | ||
|
|
2ea675da5e | ||
|
|
865d928a1f | ||
|
|
8a0056a610 | ||
|
|
e466dd9418 | ||
|
|
a84365f174 | ||
|
|
1fc1decbe9 | ||
|
|
dc8275ffa0 | ||
|
|
64f0798984 | ||
|
|
01f8df684c | ||
|
|
7c830eb223 | ||
|
|
af0d51d8b3 | ||
|
|
650396b1fc | ||
|
|
cf54bfc7c4 | ||
|
|
6b2cc6c41d | ||
|
|
e52840527a | ||
|
|
dee2021b8f | ||
|
|
2da9787ff1 | ||
|
|
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 |
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
|
||||
|
||||
@@ -40,9 +40,9 @@ CONTENTS *NERDCommenterContents*
|
||||
4.1 Delimiter detection heuristics....|NERDComHeuristics|
|
||||
4.2 Nesting issues....................|NERDComNesting|
|
||||
5.The author..............................|NERDComAuthor|
|
||||
6.TODO list...............................|NERDComTodo|
|
||||
7.Changelog...............................|NERDComChangelog|
|
||||
8.Credits.................................|NERDComCredits|
|
||||
6.Changelog...............................|NERDComChangelog|
|
||||
7.Credits.................................|NERDComCredits|
|
||||
8.License.................................|NERDComLicense|
|
||||
|
||||
==============================================================================
|
||||
1. Intro *NERDCommenter*
|
||||
@@ -89,7 +89,7 @@ line that is commented is uncommented and vice versa.
|
||||
|
||||
|
||||
[count],cs |NERDComSexyComment|
|
||||
Comments out the selected lines ``sexually''
|
||||
Comments out the selected lines ``sexily''
|
||||
|
||||
|
||||
[count],cy |NERDComYankComment|
|
||||
@@ -111,8 +111,9 @@ Adds comment delimiters to the start of line and goes into insert mode between
|
||||
them.
|
||||
|
||||
|
||||
<C-c> |NERDComInsertComment|
|
||||
|NERDComInsertComment|
|
||||
Adds comment delimiters at the current cursor position and inserts between.
|
||||
Disabled by default.
|
||||
|
||||
|
||||
,ca |NERDComAltDelim|
|
||||
@@ -288,13 +289,19 @@ insert mode between the new delimiters.
|
||||
------------------------------------------------------------------------------
|
||||
2.2.11 Insert comment map *NERDComInsertComment*
|
||||
|
||||
Default mapping: <C-c>
|
||||
Default mapping: disabled by default.
|
||||
Change the mapping with: NERDComInInsertMap.
|
||||
Applicable modes: insert.
|
||||
|
||||
Adds comment delimiters at the current cursor position and inserts
|
||||
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*
|
||||
|
||||
@@ -651,17 +658,17 @@ When we uncomment this line it will go back to what it was.
|
||||
------------------------------------------------------------------------------
|
||||
*NERDMapleader*
|
||||
Values: arbitrary string.
|
||||
Default: \c
|
||||
Default: ,c
|
||||
|
||||
NERDMapleader is used to specify what all the NERD commenter key mappings
|
||||
begin with.
|
||||
|
||||
The default key mappings will look like this: >
|
||||
\cc
|
||||
\cu
|
||||
\ca
|
||||
\ci
|
||||
\cs
|
||||
,cc
|
||||
,cu
|
||||
,ca
|
||||
,ci
|
||||
,cs
|
||||
...
|
||||
<
|
||||
However, if this line: >
|
||||
@@ -839,7 +846,7 @@ will become: >
|
||||
for simplicity)
|
||||
|
||||
==============================================================================
|
||||
6. The author *NERDComAuthor*
|
||||
5. The author *NERDComAuthor*
|
||||
|
||||
The author of the NERD commenter is Martyzillatron --- the half robot, half
|
||||
dinosaur bastard son of Megatron and Godzilla. He enjoys destroying
|
||||
@@ -850,15 +857,50 @@ 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? :(
|
||||
|
||||
==============================================================================
|
||||
7. TODO list *NERDComTodo*
|
||||
7. Changelog *NERDComChangelog*
|
||||
|
||||
Uncommenting of minimal comments needs to be more robust. Currently it is easy
|
||||
to get illegal syntax when uncommenting them.
|
||||
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
|
||||
|
||||
==============================================================================
|
||||
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).
|
||||
@@ -1036,12 +1078,12 @@ to get illegal syntax when uncommenting them.
|
||||
filetypes.
|
||||
- Added '#' comments as an alternative for the asm filetype
|
||||
|
||||
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
|
||||
information.
|
||||
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
|
||||
information.
|
||||
|
||||
==============================================================================
|
||||
8. Credits *NERDComCredits*
|
||||
7. Credits *NERDComCredits*
|
||||
|
||||
Thanks and respect to the following people:
|
||||
|
||||
@@ -1161,6 +1203,17 @@ 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
|
||||
support :D
|
||||
|
||||
@@ -1209,5 +1262,26 @@ Pipp lhaskell
|
||||
Renald Buter scala
|
||||
Vladimir Lomov asymptote
|
||||
Marco mrxvtrc, aap
|
||||
nicothakis SVNAnnotate, CVSAnnotate, SVKAnnotate
|
||||
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, bzr
|
||||
Martin Kustermann pamconf
|
||||
Indriði Einarsson mason
|
||||
Chris map
|
||||
Krzysztof A. Adamski group
|
||||
Pascal Brueckner mailcap
|
||||
Jerónimo Carballo stata
|
||||
|
||||
==============================================================================
|
||||
8. License *NERDComLicense*
|
||||
|
||||
The NERD commenter is released under the wtfpl.
|
||||
See http://sam.zoy.org/wtfpl/COPYING.
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
" vim global plugin that provides easy code commenting for various file types
|
||||
" Last Change: 24 Feb 2008
|
||||
" Maintainer: Martin Grenfell <martin_grenfell at msn.com>
|
||||
let s:NERD_commenter_version = 2.1.11
|
||||
|
||||
" 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
|
||||
" of this file.
|
||||
" ============================================================================
|
||||
" File: NERD_commenter.vim
|
||||
" Description: vim global plugin that provides easy code commenting
|
||||
" Maintainer: Martin Grenfell <martin_grenfell at msn dot com>
|
||||
" Version: 2.1.17
|
||||
" Last Change: 27 June, 2008
|
||||
" License: This program is free software. It comes without any warranty,
|
||||
" 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
|
||||
if exists("loaded_nerd_comments")
|
||||
@@ -59,7 +64,7 @@ call s:InitVariable("g:NERDMenuMode", 3)
|
||||
call s:InitVariable("g:NERDLPlace", "[>")
|
||||
call s:InitVariable("g:NERDUsePlaceHolders", 1)
|
||||
call s:InitVariable("g:NERDRemoveAltComs", 1)
|
||||
call s:InitVariable("g:NERDRemoveExtraSpaces", 0)
|
||||
call s:InitVariable("g:NERDRemoveExtraSpaces", 1)
|
||||
call s:InitVariable("g:NERDRPlace", "<]")
|
||||
call s:InitVariable("g:NERDShutUp", '0')
|
||||
call s:InitVariable("g:NERDSpaceDelims", 0)
|
||||
@@ -72,7 +77,7 @@ call s:InitVariable("g:NERDAppendComMap", g:NERDMapleader . 'A')
|
||||
call s:InitVariable("g:NERDComAlignBothMap", g:NERDMapleader . 'b')
|
||||
call s:InitVariable("g:NERDComAlignLeftMap", g:NERDMapleader . 'l')
|
||||
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:NERDComLineMap", g:NERDMapleader . 'c')
|
||||
call s:InitVariable("g:NERDComLineNestMap", g:NERDMapleader . 'n')
|
||||
@@ -200,6 +205,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
call s:MapDelimiters('%', '')
|
||||
elseif a:filetype == "btm"
|
||||
call s:MapDelimiters('::', '')
|
||||
elseif a:filetype == "bzr"
|
||||
call s:MapDelimiters('', '')
|
||||
elseif a:filetype == "caos"
|
||||
call s:MapDelimiters('*', '')
|
||||
elseif a:filetype == "catalog"
|
||||
@@ -256,6 +263,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
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"
|
||||
@@ -288,6 +297,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
call s:MapDelimiters('<!--','-->')
|
||||
elseif a:filetype == "dtml"
|
||||
call s:MapDelimiters('<dtml-comment>','</dtml-comment>')
|
||||
elseif a:filetype == "dtrace"
|
||||
call s:MapDelimiters('/*','*/')
|
||||
elseif a:filetype == "dylan"
|
||||
call s:MapDelimitersWithAlternative('//','', '/*','*/')
|
||||
elseif a:filetype == 'ebuild'
|
||||
@@ -342,20 +353,38 @@ 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 == 'gitcommit'
|
||||
call s:MapDelimiters('', '')
|
||||
elseif a:filetype == 'gitconfig'
|
||||
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 == "group"
|
||||
call s:MapDelimiters('','')
|
||||
elseif a:filetype == "grub"
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "gtkrc"
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "haskell"
|
||||
call s:MapDelimitersWithAlternative('--','', '{-', '-}')
|
||||
call s:MapDelimitersWithAlternative('{-','-}', '--', '--')
|
||||
elseif a:filetype == "hb"
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "h"
|
||||
@@ -430,6 +459,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "lilypond"
|
||||
call s:MapDelimiters('%', '')
|
||||
elseif a:filetype == "liquid"
|
||||
call s:MapDelimiters('{%', '%}')
|
||||
elseif a:filetype == "lisp"
|
||||
call s:MapDelimitersWithAlternative(';','', '#|', '|#')
|
||||
elseif a:filetype == "lite"
|
||||
@@ -456,14 +487,20 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
call s:MapDelimiters('dnl ', '')
|
||||
elseif a:filetype == "mail"
|
||||
call s:MapDelimiters('> ','')
|
||||
elseif a:filetype == "mailcap"
|
||||
call s:MapDelimiters('#','')
|
||||
elseif a:filetype == "make"
|
||||
call s:MapDelimiters('#','')
|
||||
elseif a:filetype == "map"
|
||||
call s:MapDelimiters('%', '')
|
||||
elseif a:filetype == "maple"
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "markdown"
|
||||
call s:MapDelimiters('<!--', '-->')
|
||||
elseif a:filetype == "masm"
|
||||
call s:MapDelimiters(';', '')
|
||||
elseif a:filetype == "mason"
|
||||
call s:MapDelimiters('<% #', '%>')
|
||||
elseif a:filetype == "master"
|
||||
call s:MapDelimiters('$', '')
|
||||
elseif a:filetype == "matlab"
|
||||
@@ -478,6 +515,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
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."
|
||||
@@ -506,6 +545,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
call s:MapDelimiters('/*', '')
|
||||
elseif a:filetype == "ncf"
|
||||
call s:MapDelimiters(';', '')
|
||||
elseif a:filetype == "nerdtree"
|
||||
call s:MapDelimiters('', '')
|
||||
elseif a:filetype == "netdict"
|
||||
call s:MapDelimiters('', '')
|
||||
elseif a:filetype == "netrw"
|
||||
@@ -538,10 +579,14 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
call s:MapDelimiters('', '')
|
||||
elseif a:filetype == "ox"
|
||||
call s:MapDelimiters('//', '')
|
||||
elseif a:filetype == "pamconf"
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "pascal"
|
||||
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"
|
||||
@@ -590,6 +635,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "ptcap"
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "pyrex"
|
||||
call s:MapDelimiters('#','')
|
||||
elseif a:filetype == "python"
|
||||
call s:MapDelimiters('#','')
|
||||
elseif a:filetype == "qf"
|
||||
@@ -614,6 +661,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "rexx"
|
||||
call s:MapDelimiters('/*','*/')
|
||||
elseif a:filetype == "rib"
|
||||
call s:MapDelimiters('#','')
|
||||
elseif a:filetype == "robots"
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "rpl"
|
||||
@@ -650,6 +699,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "selectbuf"
|
||||
call s:MapDelimiters('', '')
|
||||
elseif a:filetype == "services"
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "sgml"
|
||||
call s:MapDelimiters('<!','>')
|
||||
elseif a:filetype == "sgmldecl"
|
||||
@@ -668,6 +719,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
call s:MapDelimiters('%', '')
|
||||
elseif a:filetype == "sl"
|
||||
call s:MapDelimiters('/*','*/')
|
||||
elseif a:filetype == "slice"
|
||||
call s:MapDelimitersWithAlternative('//','', '/*','*/')
|
||||
elseif a:filetype == "slrnrc"
|
||||
call s:MapDelimiters('%', '')
|
||||
elseif a:filetype == "sm"
|
||||
@@ -708,10 +761,14 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
call s:MapDelimiters('#', '')
|
||||
elseif a:filetype == "st"
|
||||
call s:MapDelimiters('"','')
|
||||
elseif a:filetype == "stata"
|
||||
call s:MapDelimiters('/*','*/')
|
||||
elseif a:filetype == "stp"
|
||||
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"
|
||||
@@ -720,6 +777,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
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"
|
||||
@@ -730,6 +789,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
call s:MapDelimiters(';', '')
|
||||
elseif a:filetype == "tak"
|
||||
call s:MapDelimiters('$', '')
|
||||
elseif a:filetype == "tar"
|
||||
call s:MapDelimiters('', '')
|
||||
elseif a:filetype == "tasm"
|
||||
call s:MapDelimiters(';', '')
|
||||
elseif a:filetype == "tcl"
|
||||
@@ -782,6 +843,8 @@ function s:SetUpForNewFiletype(filetype, forceReset)
|
||||
call s:MapDelimiters('"','')
|
||||
elseif a:filetype == "viminfo"
|
||||
call s:MapDelimiters('','')
|
||||
elseif a:filetype == "vimperator"
|
||||
call s:MapDelimiters('"','')
|
||||
elseif a:filetype == "virata"
|
||||
call s:MapDelimiters('%', '')
|
||||
elseif a:filetype == "vo_base"
|
||||
@@ -1252,12 +1315,14 @@ function s:CommentLinesSexy(topline, bottomline)
|
||||
call setline(a:topline, theLine)
|
||||
|
||||
"comment the bottom line
|
||||
let theLine = getline(a:bottomline)
|
||||
let lineHasTabs = s:HasLeadingTabs(theLine)
|
||||
if lineHasTabs
|
||||
let theLine = s:ConvertLeadingTabsToSpaces(theLine)
|
||||
if a:bottomline != a:topline
|
||||
let theLine = getline(a:bottomline)
|
||||
let lineHasTabs = s:HasLeadingTabs(theLine)
|
||||
if lineHasTabs
|
||||
let theLine = s:ConvertLeadingTabsToSpaces(theLine)
|
||||
endif
|
||||
let theLine = s:SwapOutterMultiPartDelimsForPlaceHolders(theLine)
|
||||
endif
|
||||
let theLine = s:SwapOutterMultiPartDelimsForPlaceHolders(theLine)
|
||||
let theLine = s:AddRightDelim(spaceString . right, theLine)
|
||||
if lineHasTabs
|
||||
let theLine = s:ConvertLeadingSpacesToTabs(theLine)
|
||||
@@ -1414,7 +1479,7 @@ function s:InvertComment(firstLine, lastLine)
|
||||
|
||||
" if the line is commented normally, uncomment it
|
||||
if s:IsCommentedFromStartOfLine(b:left, theLine) || s:IsCommentedFromStartOfLine(b:leftAlt, theLine)
|
||||
call s:UncommentLines(1, currentLine, currentLine)
|
||||
call s:UncommentLines(currentLine, currentLine)
|
||||
let currentLine = currentLine + 1
|
||||
|
||||
" check if the line is commented sexually
|
||||
@@ -1484,7 +1549,7 @@ function! NERDComment(isVisual, type) range
|
||||
try
|
||||
call s:CommentLinesSexy(firstLine, lastLine)
|
||||
catch /NERDCommenter.Delimiters/
|
||||
call s:NerdEcho("Sexy comments cannot be done with the available delimiters", 0)
|
||||
call s:CommentLines(forceNested, 0, 0, firstLine, lastLine)
|
||||
catch /NERDCommenter.Nesting/
|
||||
call s:NerdEcho("Sexy comment aborted. Nested sexy cannot be nested", 0)
|
||||
endtry
|
||||
@@ -1493,7 +1558,7 @@ function! NERDComment(isVisual, type) range
|
||||
let theLine = getline(firstLine)
|
||||
|
||||
if s:IsInSexyComment(firstLine) || s:IsCommentedFromStartOfLine(b:left, theLine) || s:IsCommentedFromStartOfLine(b:leftAlt, theLine)
|
||||
call s:UncommentLines(1, firstLine, lastLine)
|
||||
call s:UncommentLines(firstLine, lastLine)
|
||||
else
|
||||
call s:CommentLinesToggle(forceNested, firstLine, lastLine)
|
||||
endif
|
||||
@@ -1522,7 +1587,7 @@ function! NERDComment(isVisual, type) range
|
||||
call s:PlaceDelimitersAndInsBetween()
|
||||
|
||||
elseif a:type == 'uncomment'
|
||||
call s:UncommentLines(0, firstLine, lastLine)
|
||||
call s:UncommentLines(firstLine, lastLine)
|
||||
|
||||
elseif a:type == 'yank'
|
||||
if a:isVisual
|
||||
@@ -1681,14 +1746,13 @@ function s:RemoveDelimiters(left, right, line)
|
||||
return line
|
||||
endfunction
|
||||
|
||||
" Function: s:UncommentLines(onlyWholeLineComs, topLine, bottomLine) {{{2
|
||||
" Function: s:UncommentLines(topLine, bottomLine) {{{2
|
||||
" This function uncomments the given lines
|
||||
"
|
||||
" Args:
|
||||
" onlyWholeLineComs: should be 1 for toggle style uncommenting
|
||||
" topLine: the top line of the visual selection to uncomment
|
||||
" bottomLine: the bottom line of the visual selection to uncomment
|
||||
function s:UncommentLines(onlyWholeLineComs, topLine, bottomLine)
|
||||
function s:UncommentLines(topLine, bottomLine)
|
||||
"make local copies of a:firstline and a:lastline and, if need be, swap
|
||||
"them around if the top line is below the bottom
|
||||
let l:firstline = a:topLine
|
||||
@@ -1721,12 +1785,7 @@ function s:UncommentLines(onlyWholeLineComs, topLine, bottomLine)
|
||||
|
||||
"no sexy com was detected so uncomment the line as normal
|
||||
else
|
||||
let theLine = getline(currentLine)
|
||||
if a:onlyWholeLineComs && (s:IsCommentedFromStartOfLine(b:left, theLine) || s:IsCommentedFromStartOfLine(b:leftAlt, theLine))
|
||||
call s:UncommentLinesNormal(currentLine, currentLine)
|
||||
elseif !a:onlyWholeLineComs
|
||||
call s:UncommentLinesNormal(currentLine, currentLine)
|
||||
endif
|
||||
call s:UncommentLinesNormal(currentLine, currentLine)
|
||||
let currentLine = currentLine + 1
|
||||
endif
|
||||
endwhile
|
||||
@@ -1879,16 +1938,16 @@ function s:UncommentLineNormal(line)
|
||||
|
||||
"remove the outter most left comment delim
|
||||
if indxLeft != -1 && (indxLeft < indxLeftAlt || indxLeftAlt == -1)
|
||||
let line = s:ReplaceLeftMostDelim(b:left, '', line)
|
||||
let line = s:RemoveDelimiters(b:left, '', line)
|
||||
elseif indxLeftAlt != -1
|
||||
let line = s:ReplaceLeftMostDelim(b:leftAlt, '', line)
|
||||
let line = s:RemoveDelimiters(b:leftAlt, '', line)
|
||||
endif
|
||||
|
||||
"remove the outter most right comment delim
|
||||
if indxRight != -1 && (indxRight < indxRightAlt || indxRightAlt == -1)
|
||||
let line = s:ReplaceRightMostDelim(b:right, '', line)
|
||||
let line = s:RemoveDelimiters('', b:right, line)
|
||||
elseif indxRightAlt != -1
|
||||
let line = s:ReplaceRightMostDelim(b:rightAlt, '', line)
|
||||
let line = s:RemoveDelimiters('', b:rightAlt, line)
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -2293,12 +2352,12 @@ function s:FindBoundingLinesOfSexyCom(lineNum)
|
||||
let theLine = getline(currentLine)
|
||||
|
||||
"check if the current line is the top of the sexy comment
|
||||
if theLine =~ '^[ \t]*' . left && theLine !~ '.*' . right
|
||||
if currentLine <= a:lineNum && theLine =~ '^[ \t]*' . left && theLine !~ '.*' . right && currentLine < s:NumLinesInBuf()
|
||||
let top = currentLine
|
||||
let currentLine = a:lineNum
|
||||
|
||||
"check if the current line is the bottom of the sexy comment
|
||||
elseif theLine =~ '^[ \t]*' . right && theLine !~ '.*' . left
|
||||
elseif theLine =~ '^[ \t]*' . right && theLine !~ '.*' . left && currentLine > 1
|
||||
let bottom = currentLine
|
||||
|
||||
"the right delimiter is on the same line as the last sexyComMarker
|
||||
|
||||
Reference in New Issue
Block a user