r1175 - in /trunk/packages/vim-scripts: debian/changelog debian/copyright debian/vim-scripts.status doc/surround.txt html/index.html html/plugin_surround.vim.html plugin/surround.vim

jamessan at users.alioth.debian.org jamessan at users.alioth.debian.org
Fri Jan 25 06:31:04 UTC 2008


Author: jamessan
Date: Fri Jan 25 06:31:02 2008
New Revision: 1175

URL: http://svn.debian.org/wsvn/pkg-vim/?sc=1&rev=1175
Log:
Add surround plugin (Closes: #462431)

Added:
    trunk/packages/vim-scripts/doc/surround.txt
    trunk/packages/vim-scripts/html/plugin_surround.vim.html
    trunk/packages/vim-scripts/plugin/surround.vim
Modified:
    trunk/packages/vim-scripts/debian/changelog
    trunk/packages/vim-scripts/debian/copyright
    trunk/packages/vim-scripts/debian/vim-scripts.status
    trunk/packages/vim-scripts/html/index.html

Modified: trunk/packages/vim-scripts/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-vim/trunk/packages/vim-scripts/debian/changelog?rev=1175&op=diff
==============================================================================
--- trunk/packages/vim-scripts/debian/changelog (original)
+++ trunk/packages/vim-scripts/debian/changelog Fri Jan 25 06:31:02 2008
@@ -4,7 +4,9 @@
     - Bufexplorer (Closes: #455883), NERD Commenter, Supertab, Align, cvsmenu,
       and gnupg.
   * New addons:
-    - debPlugin (Closes: #442865) and python-indent
+    - debPlugin: Explore .deb packages with Vim (Closes: #442865)
+    - python-indent: Python indent script following PEP 8
+    - surround: Delete, change, and add "surround" text (Closes: #462431)
   * debian/control:
     - Remove vim from Build-Depends-Indep since NERD Commenter now ships its
       documentation.
@@ -13,7 +15,7 @@
   * Add disabledby-pythonindent patch, which allows blacklisting the
     python-indent script.
 
- -- James Vega <jamessan at debian.org>  Fri, 25 Jan 2008 00:39:05 -0500
+ -- James Vega <jamessan at debian.org>  Fri, 25 Jan 2008 01:06:38 -0500
 
 vim-scripts (7.1.4) unstable; urgency=low
 

Modified: trunk/packages/vim-scripts/debian/copyright
URL: http://svn.debian.org/wsvn/pkg-vim/trunk/packages/vim-scripts/debian/copyright?rev=1175&op=diff
==============================================================================
--- trunk/packages/vim-scripts/debian/copyright (original)
+++ trunk/packages/vim-scripts/debian/copyright Fri Jan 25 06:31:02 2008
@@ -35,7 +35,7 @@
 script:  plugin/gnupg.vim
 author:  Markus Braun < markus.braun at krawel.de >
 url:	 http://www.vim.org/scripts/script.php?script_id=661
-license: no license
+license: GNU GPL, see /usr/share/common-licenses/GPL
 
 script:  plugin/taglist.vim
 author:  Yegappan Lakshmanan < yegappan at yahoo.com >
@@ -102,7 +102,7 @@
 url:	 http://www.vim.org/scripts/script.php?script_id=211
 license: license [1], see below
 
-script:  plugin/ColorSchemeMenuMaker.vim
+script:  plugin/themes.vim
 author:  Robert (MetaCosm) < vim at metacosm.dhs.org >
 url:	 http://www.vim.org/scripts/script.php?script_id=625
 license: see colors/*.vim for per color scheme licenses
@@ -140,7 +140,7 @@
 script:  ftplugin/git.vim
 author:  Pierre Habouzit < madcoder at debian.org >
 url:	 http://www.vim.org/scripts/script.php?script_id=1934
-license: no license
+license: license [2], see below
 
 script:  autoload/omni/cpp/complete.vim
 author:  Vissale Neang < fromtonrouge at gmail.com >
@@ -155,7 +155,22 @@
 script:  plugin/lbdbq.vim
 author:  Stefano Zacchiroli < zack at bononia.it >
 url:	 http://www.vim.org/scripts/script.php?script_id=1757
-license: GNU GPL, version 3 or above
+license: GNU GPL, see /usr/share/common-licenses/GPL-3
+
+script:  plugin/debPlugin.vim
+author:  Arno Renevier < arenevier at fdn.fr >
+url:	 http://www.vim.org/scripts/script.php?script_id=1970
+license: GNU GPL, see /usr/share/common-licenses/GPL-2
+
+script:  indent/python.vim
+author:  Eric Mc Sween < em at tomcom.de >
+url:	 http://www.vim.org/scripts/script.php?script_id=974
+license: no license
+
+script:  plugin/surround.vim
+author:  Tim Pope < vimNOSPAM at tpope.info >
+url:	 http://www.vim.org/scripts/script.php?script_id=1697
+license: Vim's license [4], see below
 
 --
 
@@ -186,3 +201,80 @@
   2. The name of the author may not be used to endorse or promote products
      derived from this script without specific prior written permission.
 
+license [4]
+  I)  There are no restrictions on distributing unmodified copies of Vim except
+      that they must include this license text.  You can also distribute
+      unmodified parts of Vim, likewise unrestricted except that they must
+      include this license text.  You are also allowed to include executables
+      that you made from the unmodified Vim sources, plus your own usage
+      examples and Vim scripts.
+
+  II) It is allowed to distribute a modified (or extended) version of Vim,
+      including executables and/or source code, when the following four
+      conditions are met:
+      1) This license text must be included unmodified.
+      2) The modified Vim must be distributed in one of the following five ways:
+         a) If you make changes to Vim yourself, you must clearly describe in
+          the distribution how to contact you.  When the maintainer asks you
+          (in any way) for a copy of the modified Vim you distributed, you
+          must make your changes, including source code, available to the
+          maintainer without fee.  The maintainer reserves the right to
+          include your changes in the official version of Vim.  What the
+          maintainer will do with your changes and under what license they
+          will be distributed is negotiable.  If there has been no negotiation
+          then this license, or a later version, also applies to your changes.
+          The current maintainer is Bram Moolenaar <Bram at vim.org>.  If this
+          changes it will be announced in appropriate places (most likely
+          vim.sf.net, www.vim.org and/or comp.editors).  When it is completely
+          impossible to contact the maintainer, the obligation to send him
+          your changes ceases.  Once the maintainer has confirmed that he has
+          received your changes they will not have to be sent again.
+         b) If you have received a modified Vim that was distributed as
+          mentioned under a) you are allowed to further distribute it
+          unmodified, as mentioned at I).  If you make additional changes the
+          text under a) applies to those changes.
+         c) Provide all the changes, including source code, with every copy of
+          the modified Vim you distribute.  This may be done in the form of a
+          context diff.  You can choose what license to use for new code you
+          add.  The changes and their license must not restrict others from
+          making their own changes to the official version of Vim.
+         d) When you have a modified Vim which includes changes as mentioned
+          under c), you can distribute it without the source code for the
+          changes if the following three conditions are met:
+          - The license that applies to the changes permits you to distribute
+            the changes to the Vim maintainer without fee or restriction, and
+            permits the Vim maintainer to include the changes in the official
+            version of Vim without fee or restriction.
+          - You keep the changes for at least three years after last
+            distributing the corresponding modified Vim.  When the maintainer
+            or someone who you distributed the modified Vim to asks you (in
+            any way) for the changes within this period, you must make them
+            available to him.
+          - You clearly describe in the distribution how to contact you.  This
+            contact information must remain valid for at least three years
+            after last distributing the corresponding modified Vim, or as long
+            as possible.
+         e) When the GNU General Public License (GPL) applies to the changes,
+          you can distribute the modified Vim under the GNU GPL version 2 or
+          any later version.
+      3) A message must be added, at least in the output of the ":version"
+         command and in the intro screen, such that the user of the modified Vim
+         is able to see that it was modified.  When distributing as mentioned
+         under 2)e) adding the message is only required for as far as this does
+         not conflict with the license used for the changes.
+      4) The contact information as required under 2)a) and 2)d) must not be
+         removed or changed, except that the person himself can make
+         corrections.
+
+  III) If you distribute a modified version of Vim, you are encouraged to use
+       the Vim license for your changes and make them available to the
+       maintainer, including the source code.  The preferred way to do this is
+       by e-mail or by uploading the files to a server and e-mailing the URL.
+       If the number of changes is small (e.g., a modified Makefile) e-mailing a
+       context diff will do.  The e-mail address to be used is
+       <maintainer at vim.org>
+
+  IV)  It is not allowed to remove this license from the distribution of the Vim
+       sources, parts of it or from a modified version.  You may use this
+       license for previous Vim releases instead of the license that they came
+       with, at your option.

Modified: trunk/packages/vim-scripts/debian/vim-scripts.status
URL: http://svn.debian.org/wsvn/pkg-vim/trunk/packages/vim-scripts/debian/vim-scripts.status?rev=1175&op=diff
==============================================================================
--- trunk/packages/vim-scripts/debian/vim-scripts.status (original)
+++ trunk/packages/vim-scripts/debian/vim-scripts.status Fri Jan 25 06:31:02 2008
@@ -367,6 +367,18 @@
 disabledby:  let loaded_python_indent = 1
 version:     0.3
 
+script_name: plugin/surround.vim
+addon:       surround
+description: easily delete, change, and add "surround" of text
+script_url:  http://www.vim.org/scripts/script.php?script_id=1697
+author:      Tim Pope
+author_url:  http://www.vim.org/account/profile.php?user_id=9012
+email:       vimNOSPAM at tpope.info
+license:     Vim's license [4], see below
+extras:      doc/surround.txt
+disabledby:  let loaded_surround = 1
+version:     1.27
+
 --
 
 Licenses referenced above
@@ -396,3 +408,80 @@
   2. The name of the author may not be used to endorse or promote products
      derived from this script without specific prior written permission.
 
+license [4]
+  I)  There are no restrictions on distributing unmodified copies of Vim except
+      that they must include this license text.  You can also distribute
+      unmodified parts of Vim, likewise unrestricted except that they must
+      include this license text.  You are also allowed to include executables
+      that you made from the unmodified Vim sources, plus your own usage
+      examples and Vim scripts.
+
+  II) It is allowed to distribute a modified (or extended) version of Vim,
+      including executables and/or source code, when the following four
+      conditions are met:
+      1) This license text must be included unmodified.
+      2) The modified Vim must be distributed in one of the following five ways:
+         a) If you make changes to Vim yourself, you must clearly describe in
+          the distribution how to contact you.  When the maintainer asks you
+          (in any way) for a copy of the modified Vim you distributed, you
+          must make your changes, including source code, available to the
+          maintainer without fee.  The maintainer reserves the right to
+          include your changes in the official version of Vim.  What the
+          maintainer will do with your changes and under what license they
+          will be distributed is negotiable.  If there has been no negotiation
+          then this license, or a later version, also applies to your changes.
+          The current maintainer is Bram Moolenaar <Bram at vim.org>.  If this
+          changes it will be announced in appropriate places (most likely
+          vim.sf.net, www.vim.org and/or comp.editors).  When it is completely
+          impossible to contact the maintainer, the obligation to send him
+          your changes ceases.  Once the maintainer has confirmed that he has
+          received your changes they will not have to be sent again.
+         b) If you have received a modified Vim that was distributed as
+          mentioned under a) you are allowed to further distribute it
+          unmodified, as mentioned at I).  If you make additional changes the
+          text under a) applies to those changes.
+         c) Provide all the changes, including source code, with every copy of
+          the modified Vim you distribute.  This may be done in the form of a
+          context diff.  You can choose what license to use for new code you
+          add.  The changes and their license must not restrict others from
+          making their own changes to the official version of Vim.
+         d) When you have a modified Vim which includes changes as mentioned
+          under c), you can distribute it without the source code for the
+          changes if the following three conditions are met:
+          - The license that applies to the changes permits you to distribute
+            the changes to the Vim maintainer without fee or restriction, and
+            permits the Vim maintainer to include the changes in the official
+            version of Vim without fee or restriction.
+          - You keep the changes for at least three years after last
+            distributing the corresponding modified Vim.  When the maintainer
+            or someone who you distributed the modified Vim to asks you (in
+            any way) for the changes within this period, you must make them
+            available to him.
+          - You clearly describe in the distribution how to contact you.  This
+            contact information must remain valid for at least three years
+            after last distributing the corresponding modified Vim, or as long
+            as possible.
+         e) When the GNU General Public License (GPL) applies to the changes,
+          you can distribute the modified Vim under the GNU GPL version 2 or
+          any later version.
+      3) A message must be added, at least in the output of the ":version"
+         command and in the intro screen, such that the user of the modified Vim
+         is able to see that it was modified.  When distributing as mentioned
+         under 2)e) adding the message is only required for as far as this does
+         not conflict with the license used for the changes.
+      4) The contact information as required under 2)a) and 2)d) must not be
+         removed or changed, except that the person himself can make
+         corrections.
+
+  III) If you distribute a modified version of Vim, you are encouraged to use
+       the Vim license for your changes and make them available to the
+       maintainer, including the source code.  The preferred way to do this is
+       by e-mail or by uploading the files to a server and e-mailing the URL.
+       If the number of changes is small (e.g., a modified Makefile) e-mailing a
+       context diff will do.  The e-mail address to be used is
+       <maintainer at vim.org>
+
+  IV)  It is not allowed to remove this license from the distribution of the Vim
+       sources, parts of it or from a modified version.  You may use this
+       license for previous Vim releases instead of the license that they came
+       with, at your option.

Added: trunk/packages/vim-scripts/doc/surround.txt
URL: http://svn.debian.org/wsvn/pkg-vim/trunk/packages/vim-scripts/doc/surround.txt?rev=1175&op=file
==============================================================================
--- trunk/packages/vim-scripts/doc/surround.txt (added)
+++ trunk/packages/vim-scripts/doc/surround.txt Fri Jan 25 06:31:02 2008
@@ -1,0 +1,224 @@
+*surround.txt*  Plugin for deleting, changing, and adding "surroundings"
+
+Author:  Tim Pope <vimNOSPAM at tpope.info>        *surround-author*
+License: Same terms as Vim itself (see |license|)
+
+This plugin is only available if 'compatible' is not set.
+
+INTRODUCTION                                    *surround*
+
+This plugin is a tool for dealing with pairs of "surroundings."  Examples
+of surroundings include parentheses, quotes, and HTML tags.  They are
+closely related to what Vim refers to as |text-objects|.  Provided
+are mappings to allow for removing, changing, and adding surroundings.
+
+Details follow on the exact semantics, but first, consider the following
+examples.  An asterisk (*) is used to denote the cursor position.
+
+  Old text                  Command     New text ~
+  "Hello *world!"           ds"         Hello world!
+  [123+4*56]/2              cs])        (123+456)/2
+  "Look ma, I'm *HTML!"     cs"<q>      <q>Look ma, I'm HTML!</q>
+  if *x>3 {                 ysW(        if ( x>3 ) {
+  my $str = *whee!;         vlllls'     my $str = 'whee!';
+
+While a few features of this plugin will work in older versions of Vim,
+Vim 7 is recommended for full functionality.
+
+MAPPINGS                                        *surround-mappings*
+
+Delete surroundings is *ds* .  The next character given determines the target
+to delete.  The exact nature of the target are explained in |surround-targets|
+but essentially it is the last character of a |text-object|.  This mapping
+deletes the difference between the "inner" object and "an" object.  This is
+easiest to understand with some examples:
+
+  Old text                  Command     New text ~
+  "Hello *world!"           ds"         Hello world!
+  (123+4*56)/2              ds)         123+456/2
+  <div>Yo!*</div>           dst         Yo!
+
+Change surroundings is *cs* .  It takes two arguments, a target like with
+|ds|, and a replacement.  Details about the second argument can be found
+below in |surround-replacements|.  Once again, examples are in order.
+
+  Old text                  Command     New text ~
+  "Hello *world!"           cs"'        'Hello world!'
+  "Hello *world!"           cs"<q>      <q>Hello world!</q>
+  (123+4*56)/2              cs)]        [123+456]/2
+  (123+4*56)/2              cs)[        [ 123+456 ]/2
+  <div>Yo!*</div>           cst<p>      <p>Yo!</p>
+
+*ys* takes an valid Vim motion or text object as the first object, and wraps
+it using the second argument as with |cs|.  (Unfortunately there's no good
+mnemonic for "ys".)
+
+  Old text                  Command     New text ~
+  Hello w*orld!             ysiw)       Hello (world)!
+
+As a special case, *yss* operates on the current line, ignoring leading
+whitespace.
+
+  Old text                  Command     New text ~
+      Hello w*orld!         yssB            {Hello world!}
+
+There is also *yS* and *ySS* which indent the surrounded text and place it
+on a line of its own.
+
+In visual mode, a simple "s" with an argument wraps the selection.  This is
+referred to as the *vs* mapping, although ordinarily there will be
+additional keystrokes between the v and s.  In linewise visual mode, the
+surroundings are placed on separate lines.  In blockwise visual mode, each
+line is surrounded.
+
+An "S" in visual mode (*vS*) behaves similarly but always places the
+surroundings on separate lines.  Additionally, the surrounded text is
+indented.  In blockwise visual mode, using "S" instead of "s" instead skips
+trailing whitespace.
+
+Note that "s" and "S" already have valid meaning in visual mode, but it is
+identical to "c".  If you have muscle memory for "s" and would like to use a
+different key, add your own mapping and the existing one will be disabled.
+>
+  vmap <Leader>s <Plug>Vsurround
+  vmap <Leader>S <Plug>VSurround
+<
+                                                *i_CTRL-G_s* *i_CTRL-G_S*
+Finally, there is an experimental insert mode mapping on <C-G>s and <C-S>.
+Beware that the latter won't work on terminals with flow control (if you
+accidentally freeze your terminal, use <C-Q> to unfreeze it).  The mapping
+inserts the specified surroundings and puts the cursor between them.  If,
+immediately after the mapping and before the replacement, a second <C-S> or
+carriage return is pressed, the prefix, cursor, and suffix will be placed on
+three separate lines.  <C-G>S (not <C-G>s) also exhibits this behavior.
+
+TARGETS                                         *surround-targets*
+
+The |ds| and |cs| commands both take a target as their first argument.  The
+possible targets are based closely on the |text-objects| provided by Vim.
+In order for a target to work, the corresponding text object must be
+supported in the version of Vim used (Vim 7 adds several text objects, and
+thus is highly recommended).  All targets are currently just one character.
+
+Eight punctuation marks, (, ), {, }, [, ], <, and >, represent themselves
+and their counterpart.  If the opening mark is used, contained whitespace is
+also trimmed.  The targets b, B, r, and a are aliases for ), }, ], and >
+(the first two mirror Vim; the second two are completely arbitrary and
+subject to change).
+
+Three quote marks, ', ", `, represent themselves, in pairs.  They are only
+searched for on the current line.
+
+A t is a pair of HTML or XML tags.  See |tag-blocks| for details.  Remember
+that you can specify a numerical argument if you want to get to a tag other
+than the innermost one.
+
+The letters w, W, and s correspond to a |word|, a |WORD|, and a |sentence|,
+respectively.  These are special in that they have nothing to delete, and
+used with |ds| they are a no-op.  With |cs|, one could consider them a
+slight shortcut for ysi (cswb == ysiwb, more or less).
+
+A p represents a |paragraph|.  This behaves similarly to w, W, and s above;
+however, newlines are sometimes added and/or removed.
+
+REPLACEMENTS                                    *surround-replacements*
+
+A replacement argument is a single character, and is required by |cs|, |ys|,
+and |vs|.  Undefined replacement characters (with the exception of alphabetic
+characters) default to placing themselves at the beginning and end of the
+destination, which can be useful for characters like / and |.
+
+If either ), }, ], or > is used, the text is wrapped in the appropriate pair
+of characters.  Similar behavior can be found with (, {, and [ (but not <),
+which append an additional space to the inside.  Like with the targets above,
+b, B, r, and a are aliases for ), }, ], and >.  To fulfill the common need for
+code blocks in C-style languages, <C-}> (which is really <C-]>) adds braces on
+lines separate from the content.
+
+If t or < is used, Vim prompts for an HTML/XML tag to insert.  You may specify
+attributes here and they will be stripped from the closing tag.  End your
+input by pressing <CR> or >.  If <C-T> is used, the tags will appear on lines
+by themselves.
+
+A deprecated replacement of a LaTeX environment is provided on \ and l.  The
+name of the environment and any arguments will be input from a prompt.  This
+will be removed once a more fully functional customization system is
+implemented.  The following shows the resulting environment from
+csp\tabular}{lc<CR>
+>
+  \begin{tabular}{lc}
+  \end{tabular}
+<
+CUSTOMIZING                                     *surround-customizing*
+
+The following adds a potential replacement on "-" (ASCII 45) in PHP files.
+(To determine the ASCII code to use, :echo char2nr("-")).  The carriage
+return will be replaced by the original text.
+>
+  autocmd FileType php let b:surround_45 = "<?php \r ?>"
+<
+This can be used in a PHP file as in the following example.
+
+  Old text                  Command     New text ~
+  print "Hello *world!"     yss-        <?php print "Hello world!" ?>
+
+Additionally, one can use a global variable for globally available
+replacements.
+>
+  let g:surround_45 = "<% \r %>"
+  let g:surround_61 = "<%= \r %>"
+<
+Advanced, experimental, and subject to change:  One can also prompt for
+replacement text.  The syntax for this is to surround the replacement in pairs
+of low numbered controller characters.  If this sounds confusing, that's
+because it is (but it makes the parsing easy).  Consider the following example
+for a LaTeX environment on the "l" replacement.
+>
+  let g:surround_108 = "\\begin{\1environment: \1}\r\\end{\1\1}"
+<
+When this replacement is used,  the user is prompted with an "environment: "
+prompt for input.  This input is inserted between each set of \1's.
+Additional inputs up to \7 can be used.
+
+Furthermore, one can specify a regular expression substitution to apply.
+>
+  let g:surround_108 = "\\begin{\1environment: \1}\r\\end{\1\r}.*\r\1}"
+<
+This will remove anything after the first } in the input when the text is
+placed within the \end{} slot.  The first \r marks where the pattern begins,
+and the second where the replacement text begins.
+
+Here's a second example for creating an HTML <div>.  The substitution cleverly
+prompts for an id, but only adds id="" if it is non-blank.  You may have to
+read this one a few times slowly before you understand it.
+>
+  let g:surround_{char2nr("d")} = "<div\1id: \r..*\r id=\"&\"\1>\r</div>"
+<
+Inputting text replacements is a proof of concept at this point. The ugly,
+unintuitive interface and the brevity of the documentation reflect this.
+
+Finally, It is possible to always append a string to surroundings in insert
+mode (and only insert mode).  This is useful with certain plugins and mappings
+that allow you to jump to such markings.
+>
+  let g:surround_insert_tail = "<++>"
+<
+ISSUES                                          *surround-issues*
+
+Vim could potentially get confused when deleting/changing occurs at the very
+end of the line.  Please report any repeatable instances of this.
+
+Do we need to use |inputsave()|/|inputrestore()| with the tag replacement?
+
+Customization isn't very flexible.  Need a system that allows for prompting,
+like with HTML tags and LaTeX environments.  (There is an experimental
+interface for this now).
+
+Indenting is handled haphazardly.  Need to decide the most appropriate
+behavior and implement it.  Right now one can do :let b:surround_indent = 1
+(or the global equivalent) to enable automatic re-indenting by Vim via |=|;
+should this be the default?
+
+It would be nice if |.| would work to repeat an operation.
+
+ vim:tw=78:ts=8:ft=help:norl:

Modified: trunk/packages/vim-scripts/html/index.html
URL: http://svn.debian.org/wsvn/pkg-vim/trunk/packages/vim-scripts/html/index.html?rev=1175&op=diff
==============================================================================
--- trunk/packages/vim-scripts/html/index.html (original)
+++ trunk/packages/vim-scripts/html/index.html Fri Jan 25 06:31:02 2008
@@ -35,6 +35,7 @@
    <li><a href="plugin_project.vim.html">plugin/project.vim.html</a></li>
    <li><a href="plugin_sokoban.vim.html">plugin/sokoban.vim.html</a></li>
    <li><a href="plugin_supertab.vim.html">plugin/supertab.vim.html</a></li>
+   <li><a href="plugin_surround.vim.html">plugin/surround.vim.html</a></li>
    <li><a href="plugin_taglist.vim.html">plugin/taglist.vim.html</a></li>
    <li><a href="plugin_tetris.vim.html">plugin/tetris.vim.html</a></li>
    <li><a href="plugin_themes.vim.html">plugin/themes.vim.html</a></li>
@@ -46,7 +47,7 @@
    <li><a href="syntax_CVSAnnotate.vim.html">syntax/CVSAnnotate.vim.html</a></li>
   </ul>
   <p>
-  Page generated on Wed, 12 Dec 2007 09:29:57 -0500
+  Page generated on Fri, 25 Jan 2008 01:22:58 -0500
 .
   </p>
  </body>

Added: trunk/packages/vim-scripts/html/plugin_surround.vim.html
URL: http://svn.debian.org/wsvn/pkg-vim/trunk/packages/vim-scripts/html/plugin_surround.vim.html?rev=1175&op=file
==============================================================================
--- trunk/packages/vim-scripts/html/plugin_surround.vim.html (added)
+++ trunk/packages/vim-scripts/html/plugin_surround.vim.html Fri Jan 25 06:31:02 2008
@@ -1,0 +1,345 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+
+<head>
+  <link rel="Stylesheet" type="text/css" href="/css/style.css" >
+  <title>surround.vim - Delete/change/add parentheses/quotes/XML-tags/much more with ease : vim online</title>
+  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+  <meta name="KEYWORDS" content="Vim, Vi IMproved, text editor, home, documentation, tips, scripts, news">
+  <link rel="shortcut icon" type="image/x-icon" href="/images/vim_shortcut.ico">
+</head>
+
+<body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0" bgcolor="#ffffff"> 
+
+<!-- HEADER, SPONSOR IMAGE, VIM IMAGE AND BOOK AD -->
+<table width="100%" cellpadding="0" cellspacing="0" border="0" bordercolor="red">
+  <tr>
+    <td colspan="4" class="lightbg"><img src="/images/spacer.gif" width="1" height="5" alt=""></td>
+  </tr>
+  <tr>
+  <td class="lightbg">&nbsp;&nbsp;&nbsp;</td>
+  <td class="lightbg" align="left"><a href="/sponsor/index.php"><img src="/images/sponsorvim.gif" alt="sponsor Vim development" border="0"></a></td>
+    <td class="lightbg" align="center"><a href="/index.php"><img src="/images/vim_header.gif" border="0" alt="Vim logo"></a></td>
+    <td class="lightbg" align="right"><a href="http://iccf-holland.org/click5.html"><img src="/images/buyhelplearn.gif" alt="Vim Book Ad" border="0"></a></td>
+  </tr>
+  <tr>
+    <td colspan="4" class="lightbg"><img src="/images/spacer.gif" width="1" height="5" alt=""></td>
+  </tr>
+  <tr>
+    <td colspan="4" class="darkbg"><img src="/images/spacer.gif" width="1" height="10" alt=""></td>
+  </tr>
+</table>
+<!-- THE PAGE BODY: BETWEEN HEADER AND FOOTER -->
+
+<table cellpadding="0" cellspacing="0" border="0" width="100%">
+  <col width="180">
+  <col width="1">
+
+  <tr valign="top">
+    <td class="sidebar">
+      <table width="180" cellpadding="4" cellspacing="0" border="0">
+        <tr valign="top">
+          <td class="sidebar">
+
+<!-- INCLUDE THE PAGE NAVIGATION -->
+<table width="100%" cellpadding="0" cellspacing="0" border="0" bordercolor="red">
+    <tr>
+        <td><small>not logged in (<a href="/login.php">login</a>)</small></td>
+    </tr>
+    <tr>
+        <td><img src="/images/spacer.gif" alt="" border="0" width="1" height="1"></td>
+    </tr>
+    <tr>
+        <td class="darkbg"><img src="/images/spacer.gif" alt='' border="0" height="3"></td>
+    </tr>
+    <tr>
+        <td><img src="/images/spacer.gif" alt="" border="0" width="1" height="2"></td>
+    </tr>
+        <tr>
+            <td class="sidebarheader"><a href="/index.php">Home</a></td>
+        </tr>
+        <tr>
+            <td class="sidebarheader"><a href="/search.php">Search</a></td>
+        </tr>
+    <tr>
+        <td><img src="/images/spacer.gif" alt="" border="0" width="1" height="7"></td>
+    </tr>
+    <tr>
+        <td class="checker"><img src="/images/spacer.gif" alt='' border="0" height="1"></td>
+    </tr>
+    <tr>
+        <td><img src="/images/spacer.gif" alt="" border="0" width="1" height="7"></td>
+    </tr>
+        <tr>
+            <td class="sidebarheader"><a href="/about.php">About Vim</a></td>
+        </tr>
+        <tr>
+            <td class="sidebarheader"><a href="/community.php">Community</a></td>
+        </tr>
+        <tr>
+            <td class="sidebarheader"><a href="/news/news.php">News</a></td>
+        </tr>
+        <tr>
+            <td class="sidebarheader"><a href="/sponsor/index.php">Sponsoring</a></td>
+        </tr>
+        <tr>
+            <td class="sidebarheader"><a href="/trivia.php">Trivia</a></td>
+        </tr>
+        <tr>
+            <td class="sidebarheader"><a href="/docs.php">Documentation</a></td>
+        </tr>
+        <tr>
+            <td class="sidebarheader"><a href="/download.php">Download</a></td>
+        </tr>
+    <tr>
+        <td><img src="/images/spacer.gif" alt="" border="0" width="1" height="7"></td>
+    </tr>
+    <tr>
+        <td class="checker"><img src="/images/spacer.gif" alt='' border="0" height="1"></td>
+    </tr>
+    <tr>
+        <td><img src="/images/spacer.gif" alt="" border="0" width="1" height="7"></td>
+    </tr>
+        <tr>
+            <td class="sidebarheader"><a href="/scripts/index.php">Scripts</a></td>
+        </tr>
+        <tr>
+            <td class="sidebarheader"><a href="/tips/index.php">Tips</a></td>
+        </tr>
+        <tr>
+            <td class="sidebarheader"><a href="/account/index.php">My Account</a></td>
+        </tr>
+    <tr>
+        <td><img src="/images/spacer.gif" alt="" border="0" width="1" height="7"></td>
+    </tr>
+    <tr>
+        <td class="checker"><img src="/images/spacer.gif" alt='' border="0" height="1"></td>
+    </tr>
+    <tr>
+        <td><img src="/images/spacer.gif" alt="" border="0" width="1" height="7"></td>
+    </tr>
+        <tr>
+            <td class="sidebarheader"><a href="/huh.php">Site Help</a></td>
+        </tr>
+</table>
+
+            <table width="172" cellpadding="0" cellspacing="0" border="0">
+              <tr><td><img src="/images/spacer.gif" alt="" border="0" width="1" height="8"></td></tr>
+              <tr><td class="darkbg"><img src="/images/spacer.gif" width="1" height="3" alt=""></td></tr>
+            </table>
+            <br>
+
+<!-- INCLUDE THE PAGE SIDEBAR TEXT -->
+&nbsp;
+
+          </td>
+        </tr>
+      </table>
+    </td>
+
+    <td class="darkbg"><img src="/images/spacer.gif" width="1" height="1" border="0" alt=""><br></td>
+    <td>
+      <table width="100%" cellpadding="10" cellspacing="0" border="0" bordercolor="red">
+        <tr>
+          <td valign="top">
+
+<span class="txth1">surround.vim : Delete/change/add parentheses/quotes/XML-tags/much more with ease</span> 
+
+<br>
+<br>
+
+<!-- karma table -->
+<table cellpadding="4" cellspacing="0" border="1" bordercolor="#000066">
+<tr>
+  <td class="lightbg"><b>&nbsp;script karma&nbsp;</b></td>
+  <td>
+    Rating <b>453/128</b>,
+    Downloaded by 3213  </td>
+</tr>
+</table>
+<p>
+
+<table cellspacing="0" cellpadding="0" border="0">
+<tr><td class="prompt">created by</td></tr>
+<tr><td><a href="/account/profile.php?user_id=9012">Tim Pope</a></td></tr>
+<tr><td>&nbsp;</td></tr>
+<tr><td class="prompt">script type</td></tr>
+<tr><td>utility</td></tr>
+<tr><td>&nbsp;</td></tr>
+<tr><td class="prompt">description</td></tr>
+<tr><td>Surround.vim is all about &quot;surroundings&quot;: parentheses, brackets, quotes, XML tags, and more.&nbsp;&nbsp;The plugin provides mappings to easily delete, change and add such surroundings in pairs.&nbsp;&nbsp;While it works under Vim 6, much of the functionality requires Vim 7.
<br>
<br>Examples follow.&nbsp;&nbsp;It is difficult to provide good examples in the variable width font of this site; check the documentation for more.
<br>
<br>Press cs&quot;' (that's c, s, double quote, single quote) inside
<br>
<br>&quot;Hello world!&quot;
<br>
<br>to change it to
<br>
<br>'Hello world!'
<br>
<br>Now press cs'&lt;q&gt; to change it to
<br>
<br>&lt;q&gt;Hello world!&lt;/q&gt;
<br>
<br>To go full circle, press cst&quot; to get
<br>
<br>&quot;Hello world!&quot;
<br>
<br>To remove the delimiters entirely, press ds' .
<br>
<br>Hello world!
<br>
<br>Now with the cursor on &quot;Hello&quot;, press ysiw] (iw is a text object).
<br>
<br>[Hello] world!
<br>
<br>Let's make that braces and add some space (use &quot;}&quot; instead of &quot;{&quot; for no space): cs]{
<br>
<br>{ Hello } world!
<br>
<br>Now wrap the entire line in parentheses with yssb or yss) .
<br>
<br>({ Hello } world!)
<br>
<br>Revert to the original text: ds{ds)
<br>
<br>Hello world!
<br>
<br>Emphasize hello: ysiw&lt;em&gt;
<br>
<br>&lt;em&gt;Hello&lt;/em&gt; world!
<br>
<br>Finally, let's try out visual mode. Press a capital V (for linewise visual mode)
<br>followed by S&lt;p class=&quot;important&quot;&gt;.
<br>
<br>&lt;p class=&quot;important&quot;&gt;
<br>&nbsp;&nbsp;&lt;em&gt;Hello&lt;/em&gt; world!
<br>&lt;/p&gt;
<br>
<br>This plugin is very powerful for HTML and XML editing, a niche which currently seems underfilled in Vim land.&nbsp;&nbsp;(As opposed to HTML/XML *inserting*, for which many plugins are available).&nbsp;&nbsp;Adding, changing, and removing pairs of tags simultaneously is a breeze.
<br>
<br>I am currrently seeking input on the ideal semantics of this plugin.&nbsp;&nbsp;For example, how exactly should indenting be handled?&nbsp;&nbsp;What behavior do you think is most desirable?</td></tr>
+<tr><td>&nbsp;</td></tr>
+<tr><td class="prompt">install details</td></tr>
+<tr><td>Extract to ~/.vim, or ~\vimfiles (Windows).&nbsp;&nbsp;You'll need to regenerate helptags (fill in the install path below)
<br>
<br>:helptags ~/.vim/doc</td></tr>
+<tr><td>&nbsp;</td></tr>
+</table>
+
+<!-- rating table -->
+<form name="rating">
+<input type="hidden" name="script_id" value="1697">
+<table cellpadding="4" cellspacing="0" border="1" bordercolor="#000066">
+<tr>
+  <td class="lightbg"><b>rate this script</b></td>
+  <td valign="middle">
+    <input type="radio" name="rating" value="life_changing">Life Changing
+    <input type="radio" name="rating" value="helpful">Helpful
+    <input type="radio" name="rating" value="unfulfilling">Unfulfilling&nbsp;
+    <input type="submit" value="rate">
+  </td>
+</tr>
+</table>
+</form>
+<span class="txth2">script versions</span> (<a href="add_script_version.php?script_id=1697">upload new version</a>)
+<p>
+Click on the package to download.
+<p>
+
+<table cellspacing="2" cellpadding="4" border="0" width="100%">
+<tr class='tableheader'>
+        <th valign="top">package</th>
+    <th valign="top">script version</th>
+    <th valign="top">date</th>
+    <th valign="top">Vim version</th>
+    <th valign="top">user</th>
+    <th valign="top">release notes</th>
+</tr>
+<tr>
+        <td class="rowodd" valign="top" nowrap><a href="download_script.php?src_id=7744">surround.zip</a></td>
+    <td class="rowodd" valign="top" nowrap><b>1.27</b></td>
+    <td class="rowodd" valign="top" nowrap><i>2007-10-03</i></td>
+    <td class="rowodd" valign="top" nowrap>7.0</td>
+    <td class="rowodd" valign="top"><i><a href="/account/profile.php?user_id=9012">Tim Pope</a></i></td>
+    <td class="rowodd" valign="top" width="2000">Fixed multiline surrounds in insert mode 
<br></td>
+</tr>
+<tr>
+        <td class="roweven" valign="top" nowrap><a href="download_script.php?src_id=7434">surround.vim</a></td>
+    <td class="roweven" valign="top" nowrap><b>1.26</b></td>
+    <td class="roweven" valign="top" nowrap><i>2007-07-31</i></td>
+    <td class="roweven" valign="top" nowrap>7.0</td>
+    <td class="roweven" valign="top"><i><a href="/account/profile.php?user_id=9012">Tim Pope</a></i></td>
+    <td class="roweven" valign="top" width="2000">Added a /* C style comment */ target.
<br>Insert mode indenting limited to multiline insertions.</td>
+</tr>
+<tr>
+        <td class="rowodd" valign="top" nowrap><a href="download_script.php?src_id=7093">surround.zip</a></td>
+    <td class="rowodd" valign="top" nowrap><b>1.24</b></td>
+    <td class="rowodd" valign="top" nowrap><i>2007-05-10</i></td>
+    <td class="rowodd" valign="top" nowrap>7.0</td>
+    <td class="rowodd" valign="top"><i><a href="/account/profile.php?user_id=9012">Tim Pope</a></i></td>
+    <td class="rowodd" valign="top" width="2000">surround_indent now works in insert mode.
<br>Added &lt;C-]&gt; to add braces on separate lines.</td>
+</tr>
+<tr>
+        <td class="roweven" valign="top" nowrap><a href="download_script.php?src_id=6747">surround.zip</a></td>
+    <td class="roweven" valign="top" nowrap><b>1.23</b></td>
+    <td class="roweven" valign="top" nowrap><i>2007-02-16</i></td>
+    <td class="roweven" valign="top" nowrap>7.0</td>
+    <td class="roweven" valign="top"><i><a href="/account/profile.php?user_id=9012">Tim Pope</a></i></td>
+    <td class="roweven" valign="top" width="2000">xmap rather than vmap, to avoid interfering with select mode.
<br>surround_insert_tail to specify a universal suffix for use in insert mode.</td>
+</tr>
+<tr>
+        <td class="rowodd" valign="top" nowrap><a href="download_script.php?src_id=6737">surround.zip</a></td>
+    <td class="rowodd" valign="top" nowrap><b>1.22</b></td>
+    <td class="rowodd" valign="top" nowrap><i>2007-02-11</i></td>
+    <td class="rowodd" valign="top" nowrap>7.0</td>
+    <td class="rowodd" valign="top"><i><a href="/account/profile.php?user_id=9012">Tim Pope</a></i></td>
+    <td class="rowodd" valign="top" width="2000">Function properly when clipboard=unnamed
<br>Very experimental custom prompting for substitution text</td>
+</tr>
+<tr>
+        <td class="roweven" valign="top" nowrap><a href="download_script.php?src_id=6411">surround.zip</a></td>
+    <td class="roweven" valign="top" nowrap><b>1.18</b></td>
+    <td class="roweven" valign="top" nowrap><i>2006-11-13</i></td>
+    <td class="roweven" valign="top" nowrap>7.0</td>
+    <td class="roweven" valign="top"><i><a href="/account/profile.php?user_id=9012">Tim Pope</a></i></td>
+    <td class="roweven" valign="top" width="2000">Zip file instead of documentation extraction hack</td>
+</tr>
+<tr>
+        <td class="rowodd" valign="top" nowrap><a href="download_script.php?src_id=6399">surround.vim</a></td>
+    <td class="rowodd" valign="top" nowrap><b>1.17</b></td>
+    <td class="rowodd" valign="top" nowrap><i>2006-11-09</i></td>
+    <td class="rowodd" valign="top" nowrap>6.0</td>
+    <td class="rowodd" valign="top"><i><a href="/account/profile.php?user_id=9012">Tim Pope</a></i></td>
+    <td class="rowodd" valign="top" width="2000">Insert mode mapping that doesn't conflict with flow control.
<br>Fixed edge case with ys where one too many characters would be grabbed.</td>
+</tr>
+<tr>
+        <td class="roweven" valign="top" nowrap><a href="download_script.php?src_id=6379">surround.vim</a></td>
+    <td class="roweven" valign="top" nowrap><b>1.16</b></td>
+    <td class="roweven" valign="top" nowrap><i>2006-11-05</i></td>
+    <td class="roweven" valign="top" nowrap>7.0</td>
+    <td class="roweven" valign="top"><i><a href="/account/profile.php?user_id=9012">Tim Pope</a></i></td>
+    <td class="roweven" valign="top" width="2000">S in blockwise visual mode strips trailing whitespace.</td>
+</tr>
+<tr>
+        <td class="rowodd" valign="top" nowrap><a href="download_script.php?src_id=6357">surround.vim</a></td>
+    <td class="rowodd" valign="top" nowrap><b>1.12</b></td>
+    <td class="rowodd" valign="top" nowrap><i>2006-10-31</i></td>
+    <td class="rowodd" valign="top" nowrap>7.0</td>
+    <td class="rowodd" valign="top"><i><a href="/account/profile.php?user_id=9012">Tim Pope</a></i></td>
+    <td class="rowodd" valign="top" width="2000">Lots of tiny bug fixes and cleanup.
<br>&quot;S&quot; mappings to force surroundings onto a separate line.
<br>Support for blockwise visual mode.</td>
+</tr>
+<tr>
+        <td class="roweven" valign="top" nowrap><a href="download_script.php?src_id=6348">surround.vim</a></td>
+    <td class="roweven" valign="top" nowrap><b>1.6</b></td>
+    <td class="roweven" valign="top" nowrap><i>2006-10-29</i></td>
+    <td class="roweven" valign="top" nowrap>7.0</td>
+    <td class="roweven" valign="top"><i><a href="/account/profile.php?user_id=9012">Tim Pope</a></i></td>
+    <td class="roweven" valign="top" width="2000">Initial upload</td>
+</tr>
+</table>
+<!-- finish off the framework -->
+          </td>
+        </tr>
+      </table>
+    </td>
+  </tr>
+</table>
+
+<!-- END OF THE PAGE BODY: BETWEEN HEADER AND FOOTER -->
+
+<table width="100%" cellpadding="0" cellspacing="0" border="0" bordercolor="red">
+  <tr><td colspan="4"><img src="/images/spacer.gif" width="1" height="5" alt=""></td></tr>
+  <tr><td colspan="4" bgcolor="#000000"><img src="/images/spacer.gif" height="2" width="1" alt=""></td></tr>
+  <tr><td colspan="4"><img src="/images/spacer.gif" width="1" height="5" alt=""></td></tr>
+  <tr>
+    <td><img src="/images/spacer.gif" width="5" height="1" alt=""></td>
+
+    <td align="left" valign="top"><small>
+      If you have questions or remarks about this site, visit the
+      <a href="http://vimonline.sf.net">vimonline development</a> pages.
+      Please use this site responsibly.
+      <br> 
+      
+      Questions about <a href="http://www.vim.org/about.php">Vim</a> should go
+      to the <a href="http://www.vim.org/maillist.php">maillist</a>.
+      Help Bram <a href="http://iccf-holland.org/">help Uganda</a>.
+      </small>
+	&nbsp;
+	&nbsp;
+
+	<!-- Start of StatCounter Code -->
+	<script type="text/javascript" language="javascript">
+	var sc_project=1417324; 
+	var sc_invisible=1; 
+	var sc_partition=11; 
+	var sc_security="d41633bc"; 
+	</script>
+
+	<script type="text/javascript" language="javascript" src="http://www.statcounter.com/counter/counter.js"></script><noscript><a href="http://www.statcounter.com/" target="_blank"><img  src="http://c12.statcounter.com/counter.php?sc_project=1417324&java=0&security=d41633bc&invisible=0" alt="free tracking" border="0"></a> </noscript>
+	<!-- End of StatCounter Code -->
+          </td>
+
+    <td align="right" valign="top">
+      	<a href="http://www.webconceptgroup.net"><img src="/images/logo_sponsor_wcg.jpg" width="131" height="30" border="0" alt="Sponsored by Web Concept Group Inc."></a>
+	<a href="http://sourceforge.net"><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=8&type=1" width="88" height="31" border="0" alt="SourceForge.net Logo" /></a>
+    </td>
+
+    <td><img src="/images/spacer.gif" width="5" height="1" alt=""></td>
+  </tr>
+
+    
+  <tr><td colspan="4"><img src="/images/spacer.gif" width="1" height="5" alt=""></td>
+  
+  </tr>
+</table>
+
+</body>
+</html>
+

Added: trunk/packages/vim-scripts/plugin/surround.vim
URL: http://svn.debian.org/wsvn/pkg-vim/trunk/packages/vim-scripts/plugin/surround.vim?rev=1175&op=file
==============================================================================
--- trunk/packages/vim-scripts/plugin/surround.vim (added)
+++ trunk/packages/vim-scripts/plugin/surround.vim Fri Jan 25 06:31:02 2008
@@ -1,0 +1,631 @@
+" surround.vim - Surroundings
+" Author:       Tim Pope <vimNOSPAM at tpope.info>
+" GetLatestVimScripts: 1697 1 :AutoInstall: surround.vim
+" $Id: surround.vim,v 1.27 2007-10-01 15:27:33 tpope Exp $
+"
+" See surround.txt for help.  This can be accessed by doing
+"
+" :helptags ~/.vim/doc
+" :help surround
+"
+" Licensed under the same terms as Vim itself.
+
+" ============================================================================
+
+" Exit quickly when:
+" - this plugin was already loaded (or disabled)
+" - when 'compatible' is set
+if (exists("g:loaded_surround") && g:loaded_surround) || &cp
+    finish
+endif
+let g:loaded_surround = 1
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+" Input functions {{{1
+
+function! s:getchar()
+    let c = getchar()
+    if c =~ '^\d\+$'
+        let c = nr2char(c)
+    endif
+    return c
+endfunction
+
+function! s:inputtarget()
+    let c = s:getchar()
+    while c =~ '^\d\+$'
+        let c = c . s:getchar()
+    endwhile
+    if c == " "
+        let c = c . s:getchar()
+    endif
+    if c =~ "\<Esc>\|\<C-C>\|\0"
+        return ""
+    else
+        return c
+    endif
+endfunction
+
+function! s:inputreplacement()
+    "echo '-- SURROUND --'
+    let c = s:getchar()
+    if c == " "
+        let c = c . s:getchar()
+    endif
+    if c =~ "\<Esc>" || c =~ "\<C-C>"
+        return ""
+    else
+        return c
+    endif
+endfunction
+
+function! s:beep()
+    exe "norm! \<Esc>"
+    return ""
+endfunction
+
+function! s:redraw()
+    redraw
+    return ""
+endfunction
+
+" }}}1
+
+" Wrapping functions {{{1
+
+function! s:extractbefore(str)
+    if a:str =~ '\r'
+        return matchstr(a:str,'.*\ze\r')
+    else
+        return matchstr(a:str,'.*\ze\n')
+    endif
+endfunction
+
+function! s:extractafter(str)
+    if a:str =~ '\r'
+        return matchstr(a:str,'\r\zs.*')
+    else
+        return matchstr(a:str,'\n\zs.*')
+    endif
+endfunction
+
+function! s:repeat(str,count)
+    let cnt = a:count
+    let str = ""
+    while cnt > 0
+        let str = str . a:str
+        let cnt = cnt - 1
+    endwhile
+    return str
+endfunction
+
+function! s:fixindent(str,spc)
+    let str = substitute(a:str,'\t',s:repeat(' ',&sw),'g')
+    let spc = substitute(a:spc,'\t',s:repeat(' ',&sw),'g')
+    let str = substitute(str,'\(\n\|\%^\).\@=','\1'.spc,'g')
+    if ! &et
+        let str = substitute(str,'\s\{'.&ts.'\}',"\t",'g')
+    endif
+    return str
+endfunction
+
+function! s:process(string)
+    let i = 0
+    while i < 7
+        let i = i + 1
+        let repl_{i} = ''
+        let m = matchstr(a:string,nr2char(i).'.\{-\}\ze'.nr2char(i))
+        if m != ''
+            let m = substitute(strpart(m,1),'\r.*','','')
+            let repl_{i} = input(substitute(m,':\s*$','','').': ')
+        endif
+    endwhile
+    let s = ""
+    let i = 0
+    while i < strlen(a:string)
+        let char = strpart(a:string,i,1)
+        if char2nr(char) < 8
+            let next = stridx(a:string,char,i+1)
+            if next == -1
+                let s = s . char
+            else
+                let insertion = repl_{char2nr(char)}
+                let subs = strpart(a:string,i+1,next-i-1)
+                let subs = matchstr(subs,'\r.*')
+                while subs =~ '^\r.*\r'
+                    let sub = matchstr(subs,"^\r\\zs[^\r]*\r[^\r]*")
+                    let subs = strpart(subs,strlen(sub)+1)
+                    let r = stridx(sub,"\r")
+                    let insertion = substitute(insertion,strpart(sub,0,r),strpart(sub,r+1),'')
+                endwhile
+                let s = s . insertion
+                let i = next
+            endif
+        else
+            let s = s . char
+        endif
+        let i = i + 1
+    endwhile
+    return s
+endfunction
+
+function! s:wrap(string,char,type,...)
+    let keeper = a:string
+    let newchar = a:char
+    let type = a:type
+    let linemode = type ==# 'V' ? 1 : 0
+    let special = a:0 ? a:1 : 0
+    let before = ""
+    let after  = ""
+    if type == "V"
+        let initspaces = matchstr(keeper,'\%^\s*')
+    else
+        let initspaces = matchstr(getline('.'),'\%^\s*')
+    endif
+    " Duplicate b's are just placeholders (removed)
+    let pairs = "b()B{}r[]a<>"
+    let extraspace = ""
+    if newchar =~ '^ '
+        let newchar = strpart(newchar,1)
+        let extraspace = ' '
+    endif
+    let idx = stridx(pairs,newchar)
+    if newchar == ' '
+        let before = ''
+        let after  = ''
+    elseif exists("b:surround_".char2nr(newchar))
+        let all    = s:process(b:surround_{char2nr(newchar)})
+        let before = s:extractbefore(all)
+        let after  =  s:extractafter(all)
+    elseif exists("g:surround_".char2nr(newchar))
+        let all    = s:process(g:surround_{char2nr(newchar)})
+        let before = s:extractbefore(all)
+        let after  =  s:extractafter(all)
+    elseif newchar ==# "p"
+        let before = "\n"
+        let after  = "\n\n"
+    elseif newchar =~# "[tT\<C-T><,]"
+        let dounmapp = 0
+        let dounmapb = 0
+        if !maparg(">","c")
+            let dounmapb= 1
+            " Hide from AsNeeded
+            exe "cn"."oremap > <CR>"
+            exe "cn"."oremap % %<C-V>"
+            "cm ap > <C-R>=getcmdline() =~ '^[^%?].*[%?]$' ? "\026\076" : "\026\076\015"<CR>
+        endif
+        let default = ""
+        if !maparg("%","c")
+            " This is to help when typing things like
+            " <a href="/images/<%= @image.filename %>">
+            " The downside is it breaks backspace, so lets disable it for now
+            "let dounmapp= 1
+            "exe "cn"."oremap % %<C-V>"
+        endif
+        if newchar ==# "T"
+            if !exists("s:lastdel")
+                let s:lastdel = ""
+            endif
+            let default = matchstr(s:lastdel,'<\zs.\{-\}\ze>')
+        endif
+        let tag = input("<",default)
+        echo "<".substitute(tag,'>*$','>','')
+        "if dounmapr
+            "silent! cunmap <CR>
+        "endif
+        if dounmapb
+            silent! cunmap >
+        endif
+        if dounmapp
+            silent! cunmap %
+        endif
+        if tag != ""
+            let tag = substitute(tag,'>*$','','')
+            let before = '<'.tag.'>'
+            if tag =~ '/$'
+                let after = ''
+            else
+                let after  = '</'.substitute(tag,' .*','','').'>'
+            endif
+            if newchar == "\<C-T>" || newchar == ","
+                if type ==# "v" || type ==# "V"
+                    let before = before . "\n\t"
+                endif
+                if type ==# "v"
+                    let after  = "\n". after
+                endif
+            endif
+        endif
+    elseif newchar ==# 'l' || newchar == '\'
+        " LaTeX
+        let env = input('\begin{')
+        let env = '{' . env
+        let env = env . s:closematch(env)
+        echo '\begin'.env
+        if env != ""
+            let before = '\begin'.env
+            let after  = '\end'.matchstr(env,'[^}]*').'}'
+        endif
+        "if type ==# 'v' || type ==# 'V'
+            "let before = before ."\n\t"
+        "endif
+        "if type ==# 'v'
+            "let after  = "\n".initspaces.after
+        "endif
+    elseif newchar ==# 'f' || newchar ==# 'F'
+        let fnc = input('function: ')
+        if fnc != ""
+            let before = substitute(fnc,'($','','').'('
+            let after  = ')'
+            if newchar ==# 'F'
+                let before = before . ' '
+                let after  = ' ' . after
+            endif
+        endif
+    elseif idx >= 0
+        let spc = (idx % 3) == 1 ? " " : ""
+        let idx = idx / 3 * 3
+        let before = strpart(pairs,idx+1,1) . spc
+        let after  = spc . strpart(pairs,idx+2,1)
+    elseif newchar == "\<C-[>" || newchar == "\<C-]>"
+        let before = "{\n\t"
+        let after  = "\n}"
+    elseif newchar !~ '\a'
+        let before = newchar
+        let after  = newchar
+    else
+        let before = ''
+        let after  = ''
+    endif
+    "let before = substitute(before,'\n','\n'.initspaces,'g')
+    let after  = substitute(after ,'\n','\n'.initspaces,'g')
+    "let after  = substitute(after,"\n\\s*\<C-U>\\s*",'\n','g')
+    if type ==# 'V' || (special && type ==# "v")
+        let before = substitute(before,' \+$','','')
+        let after  = substitute(after ,'^ \+','','')
+        if after !~ '^\n'
+            let after  = initspaces.after
+        endif
+        if keeper !~ '\n$' && after !~ '^\n'
+            let keeper = keeper . "\n"
+        elseif keeper =~ '\n$' && after =~ '^\n'
+            let after = strpart(after,1)
+        endif
+        if before !~ '\n\s*$'
+            let before = before . "\n"
+            if special
+                let before = before . "\t"
+            endif
+        endif
+    endif
+    if type ==# 'V'
+        let before = initspaces.before
+    endif
+    if before =~ '\n\s*\%$'
+        if type ==# 'v'
+            let keeper = initspaces.keeper
+        endif
+        let padding = matchstr(before,'\n\zs\s\+\%$')
+        let before  = substitute(before,'\n\s\+\%$','\n','')
+        let keeper = s:fixindent(keeper,padding)
+    endif
+    if type ==# 'V'
+        let keeper = before.keeper.after
+    elseif type =~ "^\<C-V>"
+        " Really we should be iterating over the buffer
+        let repl = substitute(before,'[\\~]','\\&','g').'\1'.substitute(after,'[\\~]','\\&','g')
+        let repl = substitute(repl,'\n',' ','g')
+        let keeper = substitute(keeper."\n",'\(.\{-\}\)\('.(special ? '\s\{-\}' : '').'\n\)',repl.'\n','g')
+        let keeper = substitute(keeper,'\n\%$','','')
+    else
+        let keeper = before.extraspace.keeper.extraspace.after
+    endif
+    return keeper
+endfunction
+
+function! s:wrapreg(reg,char,...)
+    let orig = getreg(a:reg)
+    let type = substitute(getregtype(a:reg),'\d\+$','','')
+    let special = a:0 ? a:1 : 0
+    let new = s:wrap(orig,a:char,type,special)
+    call setreg(a:reg,new,type)
+endfunction
+" }}}1
+
+function! s:insert(...) " {{{1
+    " Optional argument causes the result to appear on 3 lines, not 1
+    "call inputsave()
+    let linemode = a:0 ? a:1 : 0
+    let char = s:inputreplacement()
+    while char == "\<CR>" || char == "\<C-S>"
+        " TODO: use total count for additional blank lines
+        let linemode = linemode + 1
+        let char = s:inputreplacement()
+    endwhile
+    "call inputrestore()
+    if char == ""
+        return ""
+    endif
+    "call inputsave()
+    let cb_save = &clipboard
+    let reg_save = @@
+    call setreg('"',"\r",'v')
+    call s:wrapreg('"',char,linemode)
+    " If line mode is used and the surrounding consists solely of a suffix,
+    " remove the initial newline.  This fits a use case of mine but is a
+    " little inconsistent.  Is there anyone that would prefer the simpler
+    " behavior of just inserting the newline?
+    if linemode && match(getreg('"'),'^\n\s*\zs.*') == 0
+        call setreg('"',matchstr(getreg('"'),'^\n\s*\zs.*'),getregtype('"'))
+    endif
+    " This can be used to append a placeholder to the end
+    if exists("g:surround_insert_tail")
+        call setreg('"',g:surround_insert_tail,"a".getregtype('"'))
+    endif
+    "if linemode
+        "call setreg('"',substitute(getreg('"'),'^\s\+','',''),'c')
+    "endif
+    if col('.') >= col('$')
+        norm! ""p
+    else
+        norm! ""P
+    endif
+    if linemode
+        call s:reindent()
+    endif
+    norm! `]
+    call search('\r','bW')
+    let @@ = reg_save
+    let &clipboard = cb_save
+    return "\<Del>"
+endfunction " }}}1
+
+function! s:reindent() " {{{1
+    if exists("b:surround_indent") ? b:surround_indent : (exists("g:surround_indent") && g:surround_indent)
+        silent norm! '[=']
+    endif
+endfunction " }}}1
+
+function! s:dosurround(...) " {{{1
+    let scount = v:count1
+    let char = (a:0 ? a:1 : s:inputtarget())
+    let spc = ""
+    if char =~ '^\d\+'
+        let scount = scount * matchstr(char,'^\d\+')
+        let char = substitute(char,'^\d\+','','')
+    endif
+    if char =~ '^ '
+        let char = strpart(char,1)
+        let spc = 1
+    endif
+    if char == 'a'
+        let char = '>'
+    endif
+    if char == 'r'
+        let char = ']'
+    endif
+    let newchar = ""
+    if a:0 > 1
+        let newchar = a:2
+        if newchar == "\<Esc>" || newchar == "\<C-C>" || newchar == ""
+            return s:beep()
+        endif
+    endif
+    let cb_save = &clipboard
+    set clipboard-=unnamed
+    let append = ""
+    let original = getreg('"')
+    let otype = getregtype('"')
+    call setreg('"',"")
+    let strcount = (scount == 1 ? "" : scount)
+    if char == '/'
+        exe 'norm '.strcount.'[/d'.strcount.']/'
+    else
+        exe 'norm d'.strcount.'i'.char
+    endif
+    "exe "norm vi".char."d"
+    let keeper = getreg('"')
+    let okeeper = keeper " for reindent below
+    if keeper == ""
+        call setreg('"',original,otype)
+        let &clipboard = cb_save
+        return ""
+    endif
+    let oldline = getline('.')
+    let oldlnum = line('.')
+    if char ==# "p"
+        "let append = matchstr(keeper,'\n*\%$')
+        "let keeper = substitute(keeper,'\n*\%$','','')
+        call setreg('"','','V')
+    elseif char ==# "s" || char ==# "w" || char ==# "W"
+        " Do nothing
+        call setreg('"','')
+    elseif char =~ "[\"'`]"
+        exe "norm! i \<Esc>d2i".char
+        call setreg('"',substitute(getreg('"'),' ','',''))
+    elseif char == '/'
+        norm! "_x
+        call setreg('"','/**/',"c")
+        let keeper = substitute(substitute(keeper,'^/\*\s\=','',''),'\s\=\*$','','')
+    else
+        exe "norm! da".char
+    endif
+    let removed = getreg('"')
+    let rem2 = substitute(removed,'\n.*','','')
+    let oldhead = strpart(oldline,0,strlen(oldline)-strlen(rem2))
+    let oldtail = strpart(oldline,  strlen(oldline)-strlen(rem2))
+    let regtype = getregtype('"')
+    if char == 'p'
+        let regtype = "V"
+    endif
+    if char =~# '[\[({<T]' || spc
+        let keeper = substitute(keeper,'^\s\+','','')
+        let keeper = substitute(keeper,'\s\+$','','')
+    endif
+    if col("']") == col("$") && col('.') + 1 == col('$')
+        "let keeper = substitute(keeper,'^\n\s*','','')
+        "let keeper = substitute(keeper,'\n\s*$','','')
+        if oldhead =~# '^\s*$' && a:0 < 2
+            "let keeper = substitute(keeper,oldhead.'\%$','','')
+            let keeper = substitute(keeper,'\%^\n'.oldhead.'\(\s*.\{-\}\)\n\s*\%$','\1','')
+        endif
+        let pcmd = "p"
+    else
+        if oldhead == "" && a:0 < 2
+            "let keeper = substitute(keeper,'\%^\n\(.*\)\n\%$','\1','')
+        endif
+        let pcmd = "P"
+    endif
+    if line('.') < oldlnum && regtype ==# "V"
+        let pcmd = "p"
+    endif
+    call setreg('"',keeper,regtype)
+    if newchar != ""
+        call s:wrapreg('"',newchar)
+    endif
+    silent exe 'norm! ""'.pcmd.'`['
+    if removed =~ '\n' || okeeper =~ '\n' || getreg('"') =~ '\n'
+        call s:reindent()
+    else
+    endif
+    if getline('.') =~ '^\s\+$' && keeper =~ '^\s*\n'
+        silent norm! cc
+    endif
+    call setreg('"',removed,regtype)
+    let s:lastdel = removed
+    let &clipboard = cb_save
+endfunction " }}}1
+
+function! s:changesurround() " {{{1
+    let a = s:inputtarget()
+    if a == ""
+        return s:beep()
+    endif
+    let b = s:inputreplacement()
+    if b == ""
+        return s:beep()
+    endif
+    call s:dosurround(a,b)
+endfunction " }}}1
+
+function! s:opfunc(type,...) " {{{1
+    let char = s:inputreplacement()
+    if char == ""
+        return s:beep()
+    endif
+    let reg = '"'
+    let sel_save = &selection
+    let &selection = "inclusive"
+    let cb_save  = &clipboard
+    set clipboard-=unnamed
+    let reg_save = getreg(reg)
+    let reg_type = getregtype(reg)
+    "call setreg(reg,"\n","c")
+    let type = a:type
+    if a:type == "char"
+        silent exe 'norm! v`[o`]"'.reg.'y'
+        let type = 'v'
+    elseif a:type == "line"
+        silent exe 'norm! `[V`]"'.reg.'y'
+        let type = 'V'
+    elseif a:type ==# "v" || a:type ==# "V" || a:type ==# "\<C-V>"
+        silent exe 'norm! gv"'.reg.'y'
+    elseif a:type =~ '^\d\+$'
+        let type = 'v'
+        silent exe 'norm! ^v'.a:type.'$h"'.reg.'y'
+        if mode() == 'v'
+            norm! v
+            return s:beep()
+        endif
+    else
+        let &selection = sel_save
+        let &clipboard = cb_save
+        return s:beep()
+    endif
+    let keeper = getreg(reg)
+    if type == "v" && a:type != "v"
+        let append = matchstr(keeper,'\_s\@<!\s*$')
+        let keeper = substitute(keeper,'\_s\@<!\s*$','','')
+    endif
+    call setreg(reg,keeper,type)
+    call s:wrapreg(reg,char,a:0)
+    if type == "v" && a:type != "v" && append != ""
+        call setreg(reg,append,"ac")
+    endif
+    silent exe 'norm! gv'.(reg == '"' ? '' : '"' . reg).'p`['
+    if type == 'V' || (getreg(reg) =~ '\n' && type == 'v')
+        call s:reindent()
+    endif
+    call setreg(reg,reg_save,reg_type)
+    let &selection = sel_save
+    let &clipboard = cb_save
+endfunction
+
+function! s:opfunc2(arg)
+    call s:opfunc(a:arg,1)
+endfunction " }}}1
+
+function! s:closematch(str) " {{{1
+    " Close an open (, {, [, or < on the command line.
+    let tail = matchstr(a:str,'.[^\[\](){}<>]*$')
+    if tail =~ '^\[.\+'
+        return "]"
+    elseif tail =~ '^(.\+'
+        return ")"
+    elseif tail =~ '^{.\+'
+        return "}"
+    elseif tail =~ '^<.+'
+        return ">"
+    else
+        return ""
+    endif
+endfunction " }}}1
+
+nnoremap <silent> <Plug>Dsurround  :<C-U>call <SID>dosurround(<SID>inputtarget())<CR>
+nnoremap <silent> <Plug>Csurround  :<C-U>call <SID>changesurround()<CR>
+nnoremap <silent> <Plug>Yssurround :<C-U>call <SID>opfunc(v:count1)<CR>
+nnoremap <silent> <Plug>YSsurround :<C-U>call <SID>opfunc2(v:count1)<CR>
+" <C-U> discards the numerical argument but there's not much we can do with it
+nnoremap <silent> <Plug>Ysurround  :<C-U>set opfunc=<SID>opfunc<CR>g@
+nnoremap <silent> <Plug>YSurround  :<C-U>set opfunc=<SID>opfunc2<CR>g@
+vnoremap <silent> <Plug>Vsurround  :<C-U>call <SID>opfunc(visualmode())<CR>
+vnoremap <silent> <Plug>VSurround  :<C-U>call <SID>opfunc2(visualmode())<CR>
+inoremap <silent> <Plug>Isurround  <C-R>=<SID>insert()<CR>
+inoremap <silent> <Plug>ISurround  <C-R>=<SID>insert(1)<CR>
+
+if !exists("g:surround_no_mappings") || ! g:surround_no_mappings
+    nmap          ds   <Plug>Dsurround
+    nmap          cs   <Plug>Csurround
+    nmap          ys   <Plug>Ysurround
+    nmap          yS   <Plug>YSurround
+    nmap          yss  <Plug>Yssurround
+    nmap          ySs  <Plug>YSsurround
+    nmap          ySS  <Plug>YSsurround
+    if !hasmapto("<Plug>Vsurround","v")
+        if exists(":xmap")
+            xmap  s    <Plug>Vsurround
+        else
+            vmap  s    <Plug>Vsurround
+        endif
+    endif
+    if !hasmapto("<Plug>VSurround","v")
+        if exists(":xmap")
+            xmap  S    <Plug>VSurround
+        else
+            vmap  S    <Plug>VSurround
+        endif
+    endif
+    if !hasmapto("<Plug>Isurround","i") && "" == mapcheck("<C-S>","i")
+        imap     <C-S> <Plug>Isurround
+    endif
+    imap        <C-G>s <Plug>Isurround
+    imap        <C-G>S <Plug>ISurround
+    "Implemented internally instead
+    "imap     <C-S><C-S> <Plug>ISurround
+endif
+
+let &cpo = s:cpo_save
+
+" vim:set ft=vim sw=4 sts=4 et:




More information about the pkg-vim-maintainers mailing list