[SCM] vim-scripts packaging branch, master, updated. 59b09f3f177490b0c833417ad01d927f643ebc46

James Vega jamessan at debian.org
Sun Oct 11 16:44:13 UTC 2009


The following commit has been merged in the master branch:
commit a334e4667d874c01753f53db94c2923ec40e8165
Author: James Vega <jamessan at debian.org>
Date:   Sun Oct 11 10:59:49 2009 -0400

    supertab: Updated to 0.60

diff --git a/debian/NEWS b/debian/NEWS
index 4b536f3..b25ccd2 100644
--- a/debian/NEWS
+++ b/debian/NEWS
@@ -1,3 +1,18 @@
+vim-scripts (20091011-1) unstable; urgency=low
+
+  * The supertab plugin has made various backwards-incompatible changes to its
+    options.
+    - g:SuperTabRetainCompletionType is now g:SuperTabRetainCompletionDuration
+      and accepts one of 'none', 'insert', or 'session'.
+    - new setting g:SuperTabCompletionContexts defines which context completion
+      functions are consulted.
+    - g:SuperTabDefaultCompletionTypeDiscovery is now
+      g:SuperTabContextDiscoverDiscovery and requires that
+      g:SuperTabContextDefaultCompletionType is set to 'context' and that
+      's:ContextDiscover' is in your g:SuperTabCompletionContexts list
+
+ -- James Vega <jamessan at debian.org>  Sun, 11 Oct 2009 10:55:53 -0400
+
 vim-scripts (7.1.3) unstable; urgency=low
 
   * NERD Commenter rename and mapleader changes.
diff --git a/debian/changelog b/debian/changelog
index 8d112d0..47a4fce 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -9,6 +9,7 @@ vim-scripts (20090211-2) UNRELEASED; urgency=low
       VCSCommand, Align, gnupg
     - calendar: Updated to 1.8
     - cvsmenu: Updated to 1.150
+    - supertab: Updated to 0.60
   * Add disabledby-doxygentoolkit.diff patch, which enables the commented out
     plugin loaded check.
   * Add xml-nodocs.diff patch, which disables xmledit's "automatic
diff --git a/debian/vim-scripts.status b/debian/vim-scripts.status
index 576a2d0..c32ed63 100644
--- a/debian/vim-scripts.status
+++ b/debian/vim-scripts.status
@@ -318,10 +318,10 @@ description: use the tab key for all insert-mode completion
 script_url:  http://www.vim.org/scripts/script.php?script_id=1643
 author:      Eric Van Dewoestine
 author_url:  http://www.vim.org/account/profile.php?user_id=6016
-email:       ervandew at yahoo.com
+email:       ervandew at gmail.com
 license:     BSD, see /usr/share/common-licenses/BSD
 disabledby:  let loaded_supertab = 1
-version:     0.51
+version:     0.60
 
 script_name: plugin/lbdbq.vim
 addon:       lbdbq
diff --git a/html/index.html b/html/index.html
index 3b195e6..7c76be6 100644
--- a/html/index.html
+++ b/html/index.html
@@ -50,7 +50,7 @@
    <li><a href="syntax_mkd.vim.html">syntax/mkd.vim.html</a></li>
   </ul>
   <p>
-  Page generated on Sun, 11 Oct 2009 10:45:29 -0400
+  Page generated on Sun, 11 Oct 2009 10:53:39 -0400
 .
   </p>
  </body>
diff --git a/html/plugin_supertab.vim.html b/html/plugin_supertab.vim.html
index 3bc673e..b6dc4b5 100644
--- a/html/plugin_supertab.vim.html
+++ b/html/plugin_supertab.vim.html
@@ -166,8 +166,8 @@
 <tr>
   <td class="lightbg"><b>&nbsp;script karma&nbsp;</b></td>
   <td>
-    Rating <b>889/273</b>,
-    Downloaded by 16892  </td>
+    Rating <b>950/289</b>,
+    Downloaded by 17979  </td>
 </tr>
 </table>
 <p>
@@ -180,7 +180,7 @@
 <tr><td>utility</td></tr>
 <tr><td>&nbsp;</td></tr>
 <tr><td class="prompt">description</td></tr>
-<tr><td>This is a continuation of <a href="/scripts/script.php?script_id=182">vimscript #182</a> by Gergely Kontra, who has
<br>asked me to take over support and maintenance.&nbsp;&nbsp;So if you have any
<br>questions or suggestions, please direct them to me.&nbsp;&nbsp;Please read the
<br>description below as some enhancements have been made as well.
<br>
<br>Description:
<br>&nbsp;&nbsp;This script allows you to use the tab key to do all your insert
<br>&nbsp;&nbsp;completion (:help ins-completion).
<br>
<br>&nbsp;&nbsp;Ex. To complete the word bar or baz
<br>&nbsp;&nbsp;&nbsp;&nbsp;foo bar baz
<br>&nbsp;&nbsp;&nbsp;&nbsp;b&lt;Tab&gt;
<br>
<br>
<br>&nbsp;&nbsp;This version of SuperTab supports several configuration options:
<br>&nbsp;&nbsp;NOTE: Please see the &quot;Global Variables&quot; fold in the script for more details.
<br>&nbsp;&nbsp;- The default completion type (defaults to keyword completion)
<br>&nbsp;&nbsp;- The duration that a non-default completion type will be retained before
<br>&nbsp;&nbsp;&nbsp;&nbsp;switching back to the default (defaults to retaining the current
<br>&nbsp;&nbsp;&nbsp;&nbsp;completion type until you manually kick off a different one).
<br>&nbsp;&nbsp;- Disabling of mid-word (word character to the left and right) completion
<br>&nbsp;&nbsp;&nbsp;&nbsp;(defaults to mid-word completion enabled).
<br>&nbsp;&nbsp;- Ability to change the default mapping to kick off forward or backward
<br>&nbsp;&nbsp;&nbsp;&nbsp;completion (defaults to &lt;tab&gt; and &lt;s-tab&gt;).
<br>&nbsp;&nbsp;- A discovery list to determine the default completion type to use for any
<br>&nbsp;&nbsp;&nbsp;&nbsp;given buffer (defaults to no discovery).
<br>&nbsp;&nbsp;- Option to highlight the first entry in the results if your completeopt has
<br>&nbsp;&nbsp;&nbsp;&nbsp;'menu' and 'longest'.
<br>
<br>&nbsp;&nbsp;This version also adds a command (:SuperTabHelp) which opens up a buffer
<br>&nbsp;&nbsp;listing all various completion types, where you can simply hit &lt;enter&gt; on
<br>&nbsp;&nbsp;the completion type you wish to switch to.</td></tr>
+<tr><td>Supertab aims to provide tab completion to satisfy all your insert completion
<br>needs (:help ins-completion).
<br>
<br>This version is a continuation of <a href="/scripts/script.php?script_id=182">vimscript #182</a> by Gergely Kontra, who has
<br>asked me to take over support and maintenance.&nbsp;&nbsp;This version contains many
<br>enhancements.
<br>
<br>Supertab provides several features to enhance your insert completion
<br>experience:
<br>- You can set your favorite insert completion type (keyword, omni, etc.) as
<br>&nbsp;&nbsp;supertab's default.
<br>- When using another completion type (ctrl-x ctrl-f), supertab will
<br>&nbsp;&nbsp;temporarily make that the default allowing you to continue to use tab for
<br>&nbsp;&nbsp;that completion. The duration is configurable to one of 'completion'
<br>&nbsp;&nbsp;(retained until you exit the current completion mode), 'insert' (retained
<br>&nbsp;&nbsp;until you leave insert mode), or 'session' (retained for the remainder of
<br>&nbsp;&nbsp;your vim session).
<br>- Supertab provides a 'context' completion type which examines the text
<br>&nbsp;&nbsp;preceding the cursor to decide which type of completion should be used
<br>&nbsp;&nbsp;(omni, user, file, or keyword).&nbsp;&nbsp;You can also plug in your own functions
<br>&nbsp;&nbsp;which will be used to determine which completion type to use according to
<br>&nbsp;&nbsp;your new functionality.
<br>- The 'context' completion can also be used to set the default completion type
<br>&nbsp;&nbsp;according to what the file supports, based on a discovery mechanism which
<br>&nbsp;&nbsp;you specify.
<br>- For users not yet familiar with all the various insert completion types that
<br>&nbsp;&nbsp;vim supports, supertab also provides a :SuperTabHelp command which opens a
<br>&nbsp;&nbsp;temporary buffer listing all the available types and the ability to easily
<br>&nbsp;&nbsp;switch to that type.
<br>
<br>Supertab provides various settings allowing you to fully customize supertab to
<br>your tastes (the &quot;Global Variables&quot; fold in supertab.vim contains more details
<br>and examples):
<br>- g:SuperTabDefaultCompletionType - The default completion type to use.&nbsp;&nbsp;If
<br>&nbsp;&nbsp;you program in languages that support omni or user completions, I highly
<br>&nbsp;&nbsp;recommend setting this to 'context'.
<br>- g:SuperTabContextDefaultCompletionType - The default completion type to use
<br>&nbsp;&nbsp;when 'context' is the global default, but context completion has determined
<br>&nbsp;&nbsp;that neither omni, user, or file completion should be used in the current
<br>&nbsp;&nbsp;context.
<br>- g:SuperTabCompletionContexts - Used to configure a list of function names
<br>&nbsp;&nbsp;which are used when the global default type is 'context'.&nbsp;&nbsp;These functions
<br>&nbsp;&nbsp;will be consulted in order to determine which completion type to use.
<br>&nbsp;&nbsp;Advanced users can plug in their own functions here to customize their
<br>&nbsp;&nbsp;'context' completion.
<br>- g:SuperTabRetainCompletionDuration - This setting determines how long a
<br>&nbsp;&nbsp;non-default completion type should be retained as the temporary default.&nbsp;&nbsp;By
<br>&nbsp;&nbsp;default supertab will retain the alternate completion type until you leave
<br>&nbsp;&nbsp;insert mode.
<br>- g:SuperTabMidWordCompletion - This can be used to turn off completion if you
<br>&nbsp;&nbsp;are in the middle of a word.
<br>- g:SuperTabMappingForward, g:SuperTabMappingBackward - If using the tab key
<br>&nbsp;&nbsp;for completion isn't for you, then you can use these to set an alternate key
<br>&nbsp;&nbsp;to be used for your insert completion needs.
<br>- g:SuperTabMappingTabLiteral - For those rare cases where supertab would
<br>&nbsp;&nbsp;normal want to start insert completion, but you just want to insert a tab,
<br>&nbsp;&nbsp;this setting is used to define the key combination to use to do just that.
<br>&nbsp;&nbsp;By default Ctrl-Tab is used.
<br>- g:SuperTabLongestHighlight - When enabled and you have the completion popup
<br>&nbsp;&nbsp;enable and 'longest' in your completeopt, supertab will auto highlight the
<br>&nbsp;&nbsp;first selection in the popup.
<br>- g:SuperTabContextDiscoverDiscovery - If you have 's:ContextDiscover' in your
<br>&nbsp;&nbsp;g:SuperTabCompletionContexts list, then this setting will be consulted for a
<br>&nbsp;&nbsp;list of simple variable:completion type pairs which will set the default
<br>&nbsp;&nbsp;completion type to the first type whose variable evaluates to a non-zero or
<br>&nbsp;&nbsp;non-empty value.
<br>
<br>In addition to these settings, be sure to familiarize yourself with vim's own
<br>'completeopt' option (:help 'completeopt') to customize vim's completion
<br>behavior.
<br></td></tr>
 <tr><td>&nbsp;</td></tr>
 <tr><td class="prompt">install details</td></tr>
 <tr><td>Place the file in your plugins directory.</td></tr>
@@ -217,92 +217,100 @@ Click on the package to download.
     <th valign="top">release notes</th>
 </tr>
 <tr>
-        <td class="rowodd" valign="top" nowrap><a href="download_script.php?src_id=10998">supertab.vim</a></td>
-    <td class="rowodd" valign="top" nowrap><b>0.51</b></td>
-    <td class="rowodd" valign="top" nowrap><i>2009-07-11</i></td>
+        <td class="rowodd" valign="top" nowrap><a href="download_script.php?src_id=11386">supertab.vim</a></td>
+    <td class="rowodd" valign="top" nowrap><b>0.60</b></td>
+    <td class="rowodd" valign="top" nowrap><i>2009-09-16</i></td>
     <td class="rowodd" valign="top" nowrap>7.0</td>
     <td class="rowodd" valign="top"><i><a href="/account/profile.php?user_id=6016">Eric Van Dewoestine</a></i></td>
-    <td class="rowodd" valign="top" width="2000">Replaced internal function s:IsWordChar with vim's keyword character class (Thanks to Ingo Karkat for the patch).</td>
+    <td class="rowodd" valign="top" width="2000">- Refactored the contextual completion and default discovery support.
<br>&nbsp;&nbsp;- Context completion now supports plugable functions to determine which
<br>&nbsp;&nbsp;&nbsp;&nbsp;completion type to use.
<br>&nbsp;&nbsp;- Default discovery is now a part of context completion.
<br>- NOTE: Several non-backwards compatible configuration changes where made.
<br>&nbsp;&nbsp;- g:SuperTabRetainCompletionType is now g:SuperTabRetainCompletionDuration
<br>&nbsp;&nbsp;&nbsp;&nbsp;and accepts one of 'none', 'insert', or 'session'.
<br>&nbsp;&nbsp;- new setting g:SuperTabCompletionContexts defines which context completion
<br>&nbsp;&nbsp;&nbsp;&nbsp;functions are consulted.
<br>&nbsp;&nbsp;- g:SuperTabDefaultCompletionTypeDiscovery is now
<br>&nbsp;&nbsp;&nbsp;&nbsp;g:SuperTabContextDiscoverDiscovery and requires that
<br>&nbsp;&nbsp;&nbsp;&nbsp;g:SuperTabContextDefaultCompletionType is set to 'context' and that
<br>&nbsp;&nbsp;&nbsp;&nbsp;'s:ContextDiscover' is in your g:SuperTabCompletionContexts list.
<br>Please see the updated &quot;Global Variables&quot; fold in supertab.vim for additional
<br>details and examples.</td>
 </tr>
 <tr>
-        <td class="roweven" valign="top" nowrap><a href="download_script.php?src_id=10900">supertab.vim</a></td>
-    <td class="roweven" valign="top" nowrap><b>0.50</b></td>
-    <td class="roweven" valign="top" nowrap><i>2009-06-26</i></td>
+        <td class="roweven" valign="top" nowrap><a href="download_script.php?src_id=10998">supertab.vim</a></td>
+    <td class="roweven" valign="top" nowrap><b>0.51</b></td>
+    <td class="roweven" valign="top" nowrap><i>2009-07-11</i></td>
     <td class="roweven" valign="top" nowrap>7.0</td>
     <td class="roweven" valign="top"><i><a href="/account/profile.php?user_id=6016">Eric Van Dewoestine</a></i></td>
-    <td class="roweven" valign="top" width="2000">Added check for vim 7 or greater, otherwise disable supertab support (suggested by Vincent Lee).&nbsp;&nbsp;Also, removed any remaining pre vim 7 logic that is no longer applicable.</td>
+    <td class="roweven" valign="top" width="2000">Replaced internal function s:IsWordChar with vim's keyword character class (Thanks to Ingo Karkat for the patch).</td>
 </tr>
 <tr>
-        <td class="rowodd" valign="top" nowrap><a href="download_script.php?src_id=9918">supertab.vim</a></td>
-    <td class="rowodd" valign="top" nowrap><b>0.49</b></td>
-    <td class="rowodd" valign="top" nowrap><i>2009-02-05</i></td>
+        <td class="rowodd" valign="top" nowrap><a href="download_script.php?src_id=10900">supertab.vim</a></td>
+    <td class="rowodd" valign="top" nowrap><b>0.50</b></td>
+    <td class="rowodd" valign="top" nowrap><i>2009-06-26</i></td>
     <td class="rowodd" valign="top" nowrap>7.0</td>
     <td class="rowodd" valign="top"><i><a href="/account/profile.php?user_id=6016">Eric Van Dewoestine</a></i></td>
-    <td class="rowodd" valign="top" width="2000">fixed case where new buffer may not be initialized by super tab (thanks to Tammer Saleh for reporting the issue).</td>
+    <td class="rowodd" valign="top" width="2000">Added check for vim 7 or greater, otherwise disable supertab support (suggested by Vincent Lee).&nbsp;&nbsp;Also, removed any remaining pre vim 7 logic that is no longer applicable.</td>
 </tr>
 <tr>
-        <td class="roweven" valign="top" nowrap><a href="download_script.php?src_id=9837">supertab.vim</a></td>
-    <td class="roweven" valign="top" nowrap><b>0.48</b></td>
-    <td class="roweven" valign="top" nowrap><i>2009-01-18</i></td>
+        <td class="roweven" valign="top" nowrap><a href="download_script.php?src_id=9918">supertab.vim</a></td>
+    <td class="roweven" valign="top" nowrap><b>0.49</b></td>
+    <td class="roweven" valign="top" nowrap><i>2009-02-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=6016">Eric Van Dewoestine</a></i></td>
-    <td class="roweven" valign="top" width="2000">Fixed command line completion (ctrl-x ctrl-v) when invoked from supertab.&nbsp;&nbsp;Thanks to Frank Chang for the patch.</td>
+    <td class="roweven" valign="top" width="2000">fixed case where new buffer may not be initialized by super tab (thanks to Tammer Saleh for reporting the issue).</td>
 </tr>
 <tr>
-        <td class="rowodd" valign="top" nowrap><a href="download_script.php?src_id=9795">supertab.vim</a></td>
-    <td class="rowodd" valign="top" nowrap><b>0.47</b></td>
-    <td class="rowodd" valign="top" nowrap><i>2009-01-11</i></td>
+        <td class="rowodd" valign="top" nowrap><a href="download_script.php?src_id=9837">supertab.vim</a></td>
+    <td class="rowodd" valign="top" nowrap><b>0.48</b></td>
+    <td class="rowodd" valign="top" nowrap><i>2009-01-18</i></td>
     <td class="rowodd" valign="top" nowrap>7.0</td>
     <td class="rowodd" valign="top"><i><a href="/account/profile.php?user_id=6016">Eric Van Dewoestine</a></i></td>
-    <td class="rowodd" valign="top" width="2000">fixed issue with default completion discovery option if desired type is dependent on file type plugins.&nbsp;&nbsp;Thanks to Andreas Schneider for reporting the issue.</td>
+    <td class="rowodd" valign="top" width="2000">Fixed command line completion (ctrl-x ctrl-v) when invoked from supertab.&nbsp;&nbsp;Thanks to Frank Chang for the patch.</td>
 </tr>
 <tr>
-        <td class="roweven" valign="top" nowrap><a href="download_script.php?src_id=9510">supertab.vim</a></td>
-    <td class="roweven" valign="top" nowrap><b>0.46</b></td>
-    <td class="roweven" valign="top" nowrap><i>2008-11-15</i></td>
+        <td class="roweven" valign="top" nowrap><a href="download_script.php?src_id=9795">supertab.vim</a></td>
+    <td class="roweven" valign="top" nowrap><b>0.47</b></td>
+    <td class="roweven" valign="top" nowrap><i>2009-01-11</i></td>
     <td class="roweven" valign="top" nowrap>7.0</td>
     <td class="roweven" valign="top"><i><a href="/account/profile.php?user_id=6016">Eric Van Dewoestine</a></i></td>
-    <td class="roweven" valign="top" width="2000">Added support for default completion type 'context', which will result in super tab attempting to determine which completion type to use (file, user/omni, keyword) based on the text preceding the cursor (Based on suggestion by François Beaubert).
<br></td>
+    <td class="roweven" valign="top" width="2000">fixed issue with default completion discovery option if desired type is dependent on file type plugins.&nbsp;&nbsp;Thanks to Andreas Schneider for reporting the issue.</td>
 </tr>
 <tr>
-        <td class="rowodd" valign="top" nowrap><a href="download_script.php?src_id=8070">supertab.vim</a></td>
-    <td class="rowodd" valign="top" nowrap><b>0.45</b></td>
-    <td class="rowodd" valign="top" nowrap><i>2007-12-18</i></td>
-    <td class="rowodd" valign="top" nowrap>6.0</td>
+        <td class="rowodd" valign="top" nowrap><a href="download_script.php?src_id=9510">supertab.vim</a></td>
+    <td class="rowodd" valign="top" nowrap><b>0.46</b></td>
+    <td class="rowodd" valign="top" nowrap><i>2008-11-15</i></td>
+    <td class="rowodd" valign="top" nowrap>7.0</td>
     <td class="rowodd" valign="top"><i><a href="/account/profile.php?user_id=6016">Eric Van Dewoestine</a></i></td>
-    <td class="rowodd" valign="top" width="2000">- fixed possible completion error on first buffer as supertab may not have been properly initialized (thanks to bill emmons for discovering the error).</td>
+    <td class="rowodd" valign="top" width="2000">Added support for default completion type 'context', which will result in super tab attempting to determine which completion type to use (file, user/omni, keyword) based on the text preceding the cursor (Based on suggestion by François Beaubert).
<br></td>
 </tr>
 <tr>
-        <td class="roweven" valign="top" nowrap><a href="download_script.php?src_id=7904">supertab.vim</a></td>
-    <td class="roweven" valign="top" nowrap><b>0.44</b></td>
-    <td class="roweven" valign="top" nowrap><i>2007-11-08</i></td>
+        <td class="roweven" valign="top" nowrap><a href="download_script.php?src_id=8070">supertab.vim</a></td>
+    <td class="roweven" valign="top" nowrap><b>0.45</b></td>
+    <td class="roweven" valign="top" nowrap><i>2007-12-18</i></td>
     <td class="roweven" valign="top" nowrap>6.0</td>
     <td class="roweven" valign="top"><i><a href="/account/profile.php?user_id=6016">Eric Van Dewoestine</a></i></td>
-    <td class="roweven" valign="top" width="2000">- added config variable to specify discovery list used to determine the default completion type to use for the current buffer. (based on request by Den Yao)
<br>- added config variables to changed the default mappings for forward backwards completion. (based on request by Li Chaoqun)
<br>- added config variable to preselect the first entry when completeopt has 'menu' and 'longest'. (based on suggestion and patch by Mike Lundy)</td>
+    <td class="roweven" valign="top" width="2000">- fixed possible completion error on first buffer as supertab may not have been properly initialized (thanks to bill emmons for discovering the error).</td>
 </tr>
 <tr>
-        <td class="rowodd" valign="top" nowrap><a href="download_script.php?src_id=7344">supertab.vim</a></td>
-    <td class="rowodd" valign="top" nowrap><b>0.43</b></td>
-    <td class="rowodd" valign="top" nowrap><i>2007-07-12</i></td>
+        <td class="rowodd" valign="top" nowrap><a href="download_script.php?src_id=7904">supertab.vim</a></td>
+    <td class="rowodd" valign="top" nowrap><b>0.44</b></td>
+    <td class="rowodd" valign="top" nowrap><i>2007-11-08</i></td>
     <td class="rowodd" valign="top" nowrap>6.0</td>
     <td class="rowodd" valign="top"><i><a href="/account/profile.php?user_id=6016">Eric Van Dewoestine</a></i></td>
-    <td class="rowodd" valign="top" width="2000">With the permission of the original author, this script is now released under the BSD license.</td>
+    <td class="rowodd" valign="top" width="2000">- added config variable to specify discovery list used to determine the default completion type to use for the current buffer. (based on request by Den Yao)
<br>- added config variables to changed the default mappings for forward backwards completion. (based on request by Li Chaoqun)
<br>- added config variable to preselect the first entry when completeopt has 'menu' and 'longest'. (based on suggestion and patch by Mike Lundy)</td>
 </tr>
 <tr>
-        <td class="roweven" valign="top" nowrap><a href="download_script.php?src_id=7228">supertab.vim</a></td>
-    <td class="roweven" valign="top" nowrap><b>0.42</b></td>
-    <td class="roweven" valign="top" nowrap><i>2007-06-11</i></td>
+        <td class="roweven" valign="top" nowrap><a href="download_script.php?src_id=7344">supertab.vim</a></td>
+    <td class="roweven" valign="top" nowrap><b>0.43</b></td>
+    <td class="roweven" valign="top" nowrap><i>2007-07-12</i></td>
     <td class="roweven" valign="top" nowrap>6.0</td>
     <td class="roweven" valign="top"><i><a href="/account/profile.php?user_id=6016">Eric Van Dewoestine</a></i></td>
-    <td class="roweven" valign="top" width="2000">- Added g:SuperTabMidWordCompletion variable to determine if completion should be done within a word (enabled by default).&nbsp;&nbsp;(based on request by Charles Gruenwald)
<br>- Applied patch to fix &lt;s-tab&gt; cycling through completion results. (submitted by Lukasz Krotowski)
<br></td>
+    <td class="roweven" valign="top" width="2000">With the permission of the original author, this script is now released under the BSD license.</td>
 </tr>
 <tr>
-        <td class="rowodd" valign="top" nowrap><a href="download_script.php?src_id=6114">supertab.vim</a></td>
-    <td class="rowodd" valign="top" nowrap><b>0.41</b></td>
-    <td class="rowodd" valign="top" nowrap><i>2006-08-30</i></td>
+        <td class="rowodd" valign="top" nowrap><a href="download_script.php?src_id=7228">supertab.vim</a></td>
+    <td class="rowodd" valign="top" nowrap><b>0.42</b></td>
+    <td class="rowodd" valign="top" nowrap><i>2007-06-11</i></td>
     <td class="rowodd" valign="top" nowrap>6.0</td>
     <td class="rowodd" valign="top"><i><a href="/account/profile.php?user_id=6016">Eric Van Dewoestine</a></i></td>
-    <td class="rowodd" valign="top" width="2000">Initial upload</td>
+    <td class="rowodd" valign="top" width="2000">- Added g:SuperTabMidWordCompletion variable to determine if completion should be done within a word (enabled by default).&nbsp;&nbsp;(based on request by Charles Gruenwald)
<br>- Applied patch to fix &lt;s-tab&gt; cycling through completion results. (submitted by Lukasz Krotowski)
<br></td>
+</tr>
+<tr>
+        <td class="roweven" valign="top" nowrap><a href="download_script.php?src_id=6114">supertab.vim</a></td>
+    <td class="roweven" valign="top" nowrap><b>0.41</b></td>
+    <td class="roweven" valign="top" nowrap><i>2006-08-30</i></td>
+    <td class="roweven" valign="top" nowrap>6.0</td>
+    <td class="roweven" valign="top"><i><a href="/account/profile.php?user_id=6016">Eric Van Dewoestine</a></i></td>
+    <td class="roweven" valign="top" width="2000">Initial upload</td>
 </tr>
 </table>
 <!-- finish off the framework -->
diff --git a/plugin/supertab.vim b/plugin/supertab.vim
index cda61bd..e646b5c 100644
--- a/plugin/supertab.vim
+++ b/plugin/supertab.vim
@@ -2,7 +2,7 @@
 "   Original: Gergely Kontra <kgergely at mcl.hu>
 "   Current:  Eric Van Dewoestine <ervandew at gmail.com> (as of version 0.4)
 "   Please direct all correspondence to Eric.
-" Version: 0.51
+" Version: 0.60
 "
 " Description: {{{
 "   Use your tab key to do all your completion in insert mode!
@@ -69,7 +69,7 @@ endif
   " the type is set.
   " Ex.  let g:SuperTabDefaultCompletionType = "<c-x><c-u>"
   "
-  " Note that a special value of 'context' is supported which will result in
+  " Note: a special value of 'context' is supported which will result in
   " super tab attempting to use the text preceding the cursor to decide which
   " type of completion to attempt.  Currently super tab can recognize method
   " calls or attribute references via '.', '::' or '->', and file path
@@ -82,59 +82,115 @@ endif
   "
   " When using context completion, super tab will fall back to a secondary
   " default completion type set by g:SuperTabContextDefaultCompletionType.
+  "
+  " Note: once the buffer has been initialized, changing the value of this
+  " setting will not change the default complete type used.  If you want to
+  " change the default completion type for the current buffer after it has
+  " been set, perhaps in an ftplugin, you'll need to call
+  " SuperTabSetDefaultCompletionType like so, supplying the completion type
+  " you wish to switch to:
+  "   call SuperTabSetDefaultCompletionType("<c-x><c-u>")
   if !exists("g:SuperTabDefaultCompletionType")
     let g:SuperTabDefaultCompletionType = "<c-p>"
   endif
 
   " Sets the default completion type used when g:SuperTabDefaultCompletionType
-  " is set to 'context' and the text preceding the cursor does not match any
-  " patterns mapped to other specific completion types.
+  " is set to 'context' and no completion type is returned by any of the
+  " configured contexts.
   if !exists("g:SuperTabContextDefaultCompletionType")
     let g:SuperTabContextDefaultCompletionType = "<c-p>"
   endif
 
-  " When 'context' completion is enabled, this setting can be used to fallback
-  " to g:SuperTabContextDefaultCompletionType as the default for files whose
-  " file type occurs in this configured list.  This allows you to provide an
-  " exclusion for which 'context' completion is not activated.
-  if !exists("g:SuperTabContextFileTypeExclusions")
-    let g:SuperTabContextFileTypeExclusions = []
-  endif
-
-  " Used to set a list of variable, completion type pairs used to determine
-  " the default completion type to use for the current buffer.  If the
-  " variable is non-zero and non-empty then the associated completion type
-  " will be used.
-  " Ex. To use omni or user completion when available, but fall back to the
-  " global default otherwise:
-  "   let g:SuperTabDefaultCompletionTypeDiscovery = [
-  "       \ "&completefunc:<c-x><c-u>",
-  "       \ "&omnifunc:<c-x><c-o>",
-  "     \ ]
-  if !exists("g:SuperTabDefaultCompletionTypeDiscovery")
-    let g:SuperTabDefaultCompletionTypeDiscovery = []
+  " Sets the list of contexts used for context completion.  This value should
+  " be a list of function names which provide the context implementation.
+  "
+  " When super tab starts the default completion, each of these contexts will
+  " be consulted in order to determine the completion type to use.  If a
+  " context returns a completion type, that type will be used, otherwise the
+  " next context in the list will be consulted.  If after executing all the
+  " context functions, no completion type has been determined, then the value
+  " of g:SuperTabContextDefaultCompletionType will be used.
+  "
+  " Built in completion contexts:
+  "   s:ContextText - The text context will examine the text near the cursor
+  "     to decide which type of completion to attempt.  Currently the text
+  "     context can recognize method calls or attribute references via '.',
+  "     '::' or '->', and file path references containing '/'.
+  "     Ex.
+  "     /usr/l<tab>  # will use filename completion
+  "     myvar.t      # will use user completion if completefunc set, or omni
+  "                  # completion if omnifunc set.
+  "     myvar->      # same as above
+  "
+  "     Supported configuration attributes:
+  "       g:SuperTabContextTextFileTypeExclusions
+  "         List of file types for which the text context will be skipped.
+  "       g:SuperTabContextTextOmniPrecedence
+  "         List of omni completion option names in the order of precendence
+  "         that they should be used if available. By default, user completion
+  "         will be given precedence over omni completion, but you can use
+  "         this variable to give omni completion higher precedence by placing
+  "         it first in the list.
+  "
+  "  s:ContextDiscover - This context will use the
+  "    'g:SuperTabContextDiscoverDiscovery' variable to determine the
+  "    completion type to use.  It will evaluate each value in order until a
+  "    variable evaluates to a non-zero or non-empty value, then the
+  "    associated completion type is used.
+  "
+  "     Supported configuration properties:
+  "       g:SuperTabContextDiscoverDiscovery:
+  "         List of variable:completionType mappings.
+  "
+  "  Example context configuration:
+  "    let g:SuperTabCompletionContexts = ['s:ContextText', 's:ContextDiscover']
+  "    let g:SuperTabContextTextOmniPrecedence = ['&omnifunc', '&completefunc']
+  "    let g:SuperTabContextDiscoverDiscovery =
+  "      \ ["&completefunc:<c-x><c-u>", "&omnifunc:<c-x><c-o>"]
+  "
+  "  In addition to the default completion contexts, you can plug in your own
+  "  implementation by creating a globally accessible function that returns
+  "  the completion type to use (eg. "\<c-x>\<c-u>").
+  "
+  "  Ex.
+  "    function MyTagContext()
+  "      if filereadable(expand('%:p:h') . '/tags')
+  "        return "\<c-x>\<c-]>"
+  "      endif
+  "      " no return will result in the evaluation of the next configured context
+  "    endfunction
+  "    let g:SuperTabCompletionContexts =
+  "      \ ['MyTagContext', 's:ContextText', 's:ContextDiscover']
+  "
+  "  Note: supertab also supports the b:SuperTabCompletionContexts variable
+  "  allowing you to set the list of contexts separately for the current
+  "  buffer, like from an ftplugin for example.
+  "
+  if !exists("g:SuperTabCompletionContexts")
+    let g:SuperTabCompletionContexts = ['s:ContextText']
   endif
 
   " Determines if, and for how long, the current completion type is retained.
   " The possible values include:
-  " 0 - The current completion type is only retained for the current completion.
-  "     Once you have chosen a completion result or exited the completion
-  "     mode, the default completion type is restored.
-  " 1 - The current completion type is saved for the duration of your vim
-  "     session or until you enter a different completion mode.
-  "     (SuperTab default).
-  " 2 - The current completion type is saved until you exit insert mode (via
-  "     ESC).  Once you exit insert mode the default completion type is
-  "     restored.
-  if !exists("g:SuperTabRetainCompletionType")
-    let g:SuperTabRetainCompletionType = 1
+  " 'completion' - The current completion type is only retained for the
+  "                current completion.  Once you have chosen a completion
+  "                result or exited the completion mode, the default
+  "                completion type is restored.
+  " 'insert'     - The current completion type is saved until you exit insert
+  "                mode (via ESC).  Once you exit insert mode the default
+  "                completion type is restored. (supertab default)
+  " 'session'    - The current completion type is saved for the duration of
+  "                your vim session or until you enter a different completion
+  "                mode.
+  if !exists("g:SuperTabRetainCompletionDuration")
+    let g:SuperTabRetainCompletionDuration = 'insert'
   endif
 
   " Sets whether or not mid word completion is enabled.
-  " When enabled, <tab> will kick off completion when ever a word character is
-  " to the left of the cursor.  When disabled, completion will only occur if
-  " the char to the left is a word char and the char to the right is not (you
-  " are at the end of the word).
+  " When enabled, <tab> will kick off completion when ever a non whitespace
+  " character is to the left of the cursor.  When disabled, completion will
+  " only occur if the char to the left is non whitespace char and the char to
+  " the right is not a keyword character (you are at the end of the word).
   if !exists("g:SuperTabMidWordCompletion")
     let g:SuperTabMidWordCompletion = 1
   endif
@@ -213,50 +269,60 @@ endif
 
 " }}}
 
-" CtrlXPP() {{{
-" Handles entrance into completion mode.
-function! CtrlXPP()
-  if &smd
-    echo '' | echo '-- ^X++ mode (' . s:modes . ')'
-  endif
-  let complType = nr2char(getchar())
-  if stridx(s:types, complType) != -1
-    if stridx("\<c-e>\<c-y>", complType) != -1 " no memory, just scroll...
-      return "\<c-x>" . complType
-    elseif stridx('np', complType) != -1
-      let complType = nr2char(char2nr(complType) - 96)
-    else
-      let complType = "\<c-x>" . complType
-    endif
-
-    if g:SuperTabRetainCompletionType
-      let b:complType = complType
-    endif
-
-    " Hack to workaround appent bug when invoking command line completion via
-    " <c-r>=
-    if complType == "\<c-x>\<c-v>"
-      return s:CommandLineCompletion()
-    endif
+" SuperTabSetDefaultCompletionType(type) {{{
+" Globally available function that users can use to set the default
+" completion type for the current buffer, like in an ftplugin.
+function! SuperTabSetDefaultCompletionType(type)
+  " init hack for <c-x><c-v> workaround.
+  let b:complCommandLine = 0
 
-    return complType
-  endif
+  let b:SuperTabDefaultCompletionType = a:type
 
-  echohl "Unknown mode"
-  return complType
+  " set the current completion type to the default
+  call SuperTabSetCompletionType(b:SuperTabDefaultCompletionType)
 endfunction " }}}
 
 " SuperTabSetCompletionType(type) {{{
-" Globally available function that user's can use to create mappings to
-" quickly switch completion modes.  Useful when a user wants to restore the
-" default or switch to another mode without having to kick off a completion
-" of that type or use SuperTabHelp.
-" Example mapping to restore SuperTab default:
+" Globally available function that users can use to create mappings to quickly
+" switch completion modes.  Useful when a user wants to restore the default or
+" switch to another mode without having to kick off a completion of that type
+" or use SuperTabHelp.  Note, this function only changes the current
+" completion type, not the default, meaning that the default will still be
+" restored once the configured retension duration has been met (see
+" g:SuperTabRetainCompletionDuration).  To change the default for the current
+" buffer, use SuperTabDefaultCompletionType(type) instead.  Example mapping to
+" restore SuperTab default:
 "   nmap <F6> :call SetSuperTabCompletionType("<c-p>")<cr>
 function! SuperTabSetCompletionType(type)
   exec "let b:complType = \"" . escape(a:type, '<') . "\""
 endfunction " }}}
 
+" SuperTabAlternateCompletion(type) {{{
+" Function which can be mapped to a key to kick off an alternate completion
+" other than the default.  For instance, if you have 'context' as the default
+" and want to map ctrl+space to issue keyword completion.
+" Note: due to the way vim expands ctrl characters in mappings, you cannot
+" create the alternate mapping like so:
+"    imap <c-space> <c-r>=SuperTabAlternateCompletion("<c-p>")<cr>
+" instead, you have to use \<lt> to prevent vim from expanding the key
+" when creating the mapping.
+"    gvim:
+"      imap <c-space> <c-r>=SuperTabAlternateCompletion("\<lt>c-p>")<cr>
+"    console:
+"      imap <nul> <c-r>=SuperTabAlternateCompletion("\<lt>c-p>")<cr>
+function! SuperTabAlternateCompletion(type)
+  call SuperTabSetCompletionType(a:type)
+  " end any current completion before attempting to start the new one.
+  " use feedkeys to prevent possible remapping of <c-e> from causing issues.
+  "call feedkeys("\<c-e>", 'n')
+  " ^ since we can't detect completion mode vs regular insert mode, we force
+  " vim into keyword completion mode and end that mode to prevent the regular
+  " insert behavior of <c-e> from occurring.
+  call feedkeys("\<c-x>\<c-p>\<c-e>", 'n')
+  call feedkeys(b:complType)
+  return ''
+endfunction " }}}
+
 " s:Init {{{
 " Global initilization when supertab is loaded.
 function! s:Init()
@@ -273,8 +339,8 @@ function! s:Init()
   augroup END
 
   " Setup mechanism to restore orignial completion type upon leaving insert
-  " mode if g:SuperTabRetainCompletionType == 2
-  if g:SuperTabRetainCompletionType == 2
+  " mode if configured to do so
+  if g:SuperTabRetainCompletionDuration == 'insert'
     augroup supertab_retain
       autocmd!
       autocmd InsertLeave * call s:SetDefaultCompletionType()
@@ -292,34 +358,42 @@ function! s:InitBuffer()
   " init hack for <c-x><c-v> workaround.
   let b:complCommandLine = 0
 
-  if !exists("b:SuperTabDefaultCompletionType")
-    " loop through discovery list to find the default
-    if !empty(g:SuperTabDefaultCompletionTypeDiscovery)
-      " backward compatiability with old string value.
-      if type(g:SuperTabDefaultCompletionTypeDiscovery) == 1
-        let dlist = split(g:SuperTabDefaultCompletionTypeDiscovery, ',')
-      else
-        let dlist = g:SuperTabDefaultCompletionTypeDiscovery
-      endif
-      for pair in dlist
-        let var = substitute(pair, '\(.*\):.*', '\1', '')
-        let type = substitute(pair, '.*:\(.*\)', '\1', '')
-        exec 'let value = ' . var
-        if value !~ '^\s*$' && value != '0'
-          let b:SuperTabDefaultCompletionType = type
-          break
-        endif
-      endfor
+  let b:SuperTabDefaultCompletionType = g:SuperTabDefaultCompletionType
+
+  " set the current completion type to the default
+  call SuperTabSetCompletionType(b:SuperTabDefaultCompletionType)
+endfunction " }}}
+
+" s:ManualCompletionEnter() {{{
+" Handles manual entrance into completion mode.
+function! s:ManualCompletionEnter()
+  if &smd
+    echo '' | echohl ModeMsg | echo '-- ^X++ mode (' . s:modes . ')' | echohl None
+  endif
+  let complType = nr2char(getchar())
+  if stridx(s:types, complType) != -1
+    if stridx("\<c-e>\<c-y>", complType) != -1 " no memory, just scroll...
+      return "\<c-x>" . complType
+    elseif stridx('np', complType) != -1
+      let complType = nr2char(char2nr(complType) - 96)
+    else
+      let complType = "\<c-x>" . complType
     endif
 
-    " fallback to configured default.
-    if !exists("b:SuperTabDefaultCompletionType")
-      let b:SuperTabDefaultCompletionType = g:SuperTabDefaultCompletionType
+    if index(['insert', 'session'], g:SuperTabRetainCompletionDuration) != -1
+      let b:complType = complType
+    endif
+
+    " Hack to workaround bug when invoking command line completion via <c-r>=
+    if complType == "\<c-x>\<c-v>"
+      return s:CommandLineCompletion()
     endif
+
+    return complType
   endif
 
-  " set the default completion type.
-  call SuperTabSetCompletionType(b:SuperTabDefaultCompletionType)
+  echohl "Unknown mode"
+  return complType
 endfunction " }}}
 
 " s:SetCompletionType() {{{
@@ -367,29 +441,17 @@ function! s:SuperTab(command)
       return "\<c-n>"
     endif
 
+    " handle 'context' completion.
     if b:complType == 'context'
-      if index(g:SuperTabContextFileTypeExclusions, &ft) == -1
-        let curline = getline('.')
-        let cnum = col('.')
-        let synname = synIDattr(synID(line('.'), cnum - 1, 1), 'name')
-        if curline =~ '.*/\w*\%' . cnum . 'c' ||
-          \ ((has('win32') || has('win64')) && curline =~ '.*\\\w*\%' . cnum . 'c')
-          return "\<c-x>\<c-f>" . key
-        elseif curline =~ '.*\(\w\|[\])]\)\(\.\|::\|->\)\w*\%' . cnum . 'c' &&
-          \ synname !~ '\(String\|Comment\)'
-          if &completefunc != ''
-            return "\<c-x>\<c-u>" . key
-          elseif &omnifunc != ''
-            return "\<c-x>\<c-o>" . key
-          endif
-        endif
+      let complType = s:ContextCompletion()
+      if complType == ''
+        exec "let complType = \"" .
+          \ escape(g:SuperTabContextDefaultCompletionType, '<') . "\""
       endif
-      exec "let complType = \"" . escape(g:SuperTabContextDefaultCompletionType, '<') . "\""
       return complType . key
     endif
 
-    " Hack to workaround appent bug when invoking command line completion via
-    " <c-r>=
+    " Hack to workaround bug when invoking command line completion via <c-r>=
     if b:complType == "\<c-x>\<c-v>"
       return s:CommandLineCompletion()
     endif
@@ -471,11 +533,82 @@ function! s:CommandLineCompletion()
     \ "let b:complCommandLine = 0\<cr>"
 endfunction " }}}
 
+" s:ContextCompletion() {{{
+function! s:ContextCompletion()
+  let contexts = exists('b:SuperTabCompletionContexts') ?
+    \ b:SuperTabCompletionContexts : g:SuperTabCompletionContexts
+
+  for context in contexts
+    try
+      let Context = function(context)
+      let complType = Context()
+      unlet Context
+      if type(complType) == 1 && complType != ''
+        return complType
+      endif
+    catch /E700/
+      echohl Error
+      echom 'supertab: no context function "' . context . '" found.'
+      echohl None
+    endtry
+  endfor
+  return ''
+endfunction " }}}
+
+" s:ContextDiscover() {{{
+function! s:ContextDiscover()
+  let discovery = exists('g:SuperTabContextDiscoverDiscovery') ?
+    \ g:SuperTabContextDiscoverDiscovery : []
+
+  " loop through discovery list to find the default
+  if !empty(discovery)
+    for pair in discovery
+      let var = substitute(pair, '\(.*\):.*', '\1', '')
+      let type = substitute(pair, '.*:\(.*\)', '\1', '')
+      exec 'let value = ' . var
+      if value !~ '^\s*$' && value != '0'
+        exec "let complType = \"" . escape(type, '<') . "\""
+        return complType
+      endif
+    endfor
+  endif
+endfunction " }}}
+
+" s:ContextText() {{{
+function! s:ContextText()
+  let exclusions = exists('g:SuperTabContextTextFileTypeExclusions') ?
+    \ g:SuperTabContextTextFileTypeExclusions : []
+
+  if index(exclusions, &ft) == -1
+    let curline = getline('.')
+    let cnum = col('.')
+    let synname = synIDattr(synID(line('.'), cnum - 1, 1), 'name')
+    if curline =~ '.*/\w*\%' . cnum . 'c' ||
+      \ ((has('win32') || has('win64')) && curline =~ '.*\\\w*\%' . cnum . 'c')
+      return "\<c-x>\<c-f>"
+
+    elseif curline =~ '.*\(\w\|[\])]\)\(\.\|::\|->\)\w*\%' . cnum . 'c' &&
+      \ synname !~ '\(String\|Comment\)'
+      let omniPrecedence = exists('g:SuperTabContextTextOmniPrecedence') ?
+        \ g:SuperTabContextTextOmniPrecedence : ['&completefunc', '&omnifunc']
+
+      for omniFunc in omniPrecedence
+        if omniFunc !~ '^&'
+          let omniFunc = '&' . omniFunc
+        endif
+        if getbufvar(bufnr('%'), omniFunc) != ''
+          return omniFunc == '&omnifunc' ? "\<c-x>\<c-o>" : "\<c-x>\<c-u>"
+        endif
+      endfor
+    endif
+  endif
+endfunction " }}}
+
 " Key Mappings {{{
   " map a regular tab to ctrl-tab (note: doesn't work in console vim)
   exec 'inoremap ' . g:SuperTabMappingTabLiteral . ' <tab>'
 
-  imap <c-x> <c-r>=CtrlXPP()<cr>
+  imap <c-x> <c-r>=<SID>ManualCompletionEnter()<cr>
 
   " From the doc |insert.txt| improved
   exec 'imap ' . g:SuperTabMappingForward . ' <c-n>'

-- 
vim-scripts packaging



More information about the pkg-vim-maintainers mailing list