[vim-scripts] 01/11: Update supertab to 2.0
James McCoy
jamessan at debian.org
Thu Aug 15 04:03:09 UTC 2013
This is an automated email from the git hooks/post-receive script.
jamessan pushed a commit to branch master
in repository vim-scripts.
commit 60ef2ca1e9d7d794aee2601c77eb1f0582573f34
Author: James McCoy <jamessan at debian.org>
Date: Thu Jan 17 21:39:37 2013 -0500
Update supertab to 2.0
Signed-off-by: James McCoy <jamessan at debian.org>
---
debian/changelog | 8 ++
debian/patches/disabledby-supertab.diff | 18 ---
debian/patches/series | 1 -
debian/vim-scripts.status | 2 +-
doc/supertab.txt | 59 +++++++--
html/index.html | 2 +-
html/plugin_supertab.vim.html | 199 +++++++++++++++----------------
plugin/supertab.vim | 197 +++++++++++++++++++++++++-----
8 files changed, 324 insertions(+), 162 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index da3ad19..154e918 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+vim-scripts (20121008) UNRELEASED; urgency=low
+
+ * Updated addons:
+ - supertab: Updated to 2.0 (Closes: #698168)
+ + Remove patch disabledby-supertab.diff, merged upstream.
+
+ -- James McCoy <jamessan at debian.org> Thu, 17 Jan 2013 21:32:43 -0500
+
vim-scripts (20121007) unstable; urgency=low
* Update Vcs-* URLs.
diff --git a/debian/patches/disabledby-supertab.diff b/debian/patches/disabledby-supertab.diff
deleted file mode 100644
index 8627a85..0000000
--- a/debian/patches/disabledby-supertab.diff
+++ /dev/null
@@ -1,18 +0,0 @@
-## disabledby-supertab.diff by Stefano Zacchiroli <zack at debian.org>
-
-Index: b/plugin/supertab.vim
-===================================================================
---- a/plugin/supertab.vim
-+++ b/plugin/supertab.vim
-@@ -57,6 +57,11 @@
- finish
- endif
-
-+if exists("loaded_supertab")
-+ finish
-+endif
-+let loaded_supertab=1
-+
- if exists('complType') " Integration with other completion functions.
- finish
- endif
diff --git a/debian/patches/series b/debian/patches/series
index e7f161f..e7358fa 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -5,7 +5,6 @@ disabledby-info.diff
disabledby-omnicppcomplete.diff
disabledby-po.diff
disabledby-securemodelines.diff
-disabledby-supertab.diff
disabledby-tetris.diff
disabledby-color_sample_pack.diff
disabledby-whatdomain.diff
diff --git a/debian/vim-scripts.status b/debian/vim-scripts.status
index 79bb6b3..7882cc2 100644
--- a/debian/vim-scripts.status
+++ b/debian/vim-scripts.status
@@ -322,7 +322,7 @@ email: ervandew at gmail.com
license: BSD [8]
extras: doc/supertab.txt
disabledby: let loaded_supertab = 1
-version: 1.6
+version: 2.0
script_name: plugin/lbdbq.vim
addon: lbdbq
diff --git a/doc/supertab.txt b/doc/supertab.txt
index 038bcb5..b65f528 100644
--- a/doc/supertab.txt
+++ b/doc/supertab.txt
@@ -1,13 +1,8 @@
*supertab.txt*
-Authors:
- Original: Gergely Kontra <kgergely at mcl.hu>
- Current: Eric Van Dewoestine <ervandew at gmail.com> (as of version 0.4)
-
-Contributors:
- Christophe-Marie Duquesne <chm.duquesne at gmail.com> (documentation)
-
-Please direct all correspondence to Eric.
+Author: Eric Van Dewoestine <ervandew at gmail.com>
+ Original concept and versions up to 0.32 written by
+ Gergely Kontra <kgergely at mcl.hu>
This plugin is licensed under the terms of the BSD License. Please see
supertab.vim for the license in its entirety.
@@ -30,6 +25,9 @@ Supertab *supertab*
Inserting true tabs |supertab-mappingtabliteral|
Enhanced longest match support |supertab-longestenhanced|
Preselecting the first entry |supertab-longesthighlight|
+ Mapping <cr> to end completion |supertab-crmapping|
+ Auto close the preview window |supertab-closepreviewonpopupclose|
+ Completion Chaining |supertab-completionchaining|
==============================================================================
1. Introduction *supertab-intro*
@@ -304,4 +302,49 @@ g:SuperTabCrMapping (default value: 1)
When enabled, <cr> will cancel completion mode preserving the current text.
+Compatibility with other plugins:
+ - endwise: compatible
+ - delimitMate: not compatible (disabled if the delimitMate <cr> mapping is
+ detected.)
+
+
+Auto close the preview window *supertab-closepreviewonpopupclose*
+ *g:SuperTabClosePreviewOnPopupClose*
+
+g:SuperTabClosePreviewOnPopupClose (default value: 0)
+
+When enabled, supertab will attempt to close vim's completion preview window
+when the completion popup closes (completion is finished or canceled).
+
+Completion Chaining *supertab-completionchaining*
+
+SuperTab provides the ability to chain one of the completion functions
+(|completefunc| or |omnifunc|) together with a one of the default vim
+completion key sequences (|ins-completion|), giving you the ability to attempt
+completion with the first, and upon no results, fall back to the second.
+
+To utilize this feature you need to call the SuperTabChain function where
+the first argument is the name of a vim compatible |complete-function| and the
+second is one of vim's insert completion (|ins-completion|) key bindings
+(<c-p>, <c-n>, <c-x><c-]>, etc). Calling this function will set the current
+buffer's |completefunc| option to a supertab provided implementation which
+utilizes the supplied arguments to perform the completion. Since the
+|completefunc| option is being set, this feature works best when also
+setting |g:SuperTabDefaultCompletionType| to either "context" or "<c-x><c-u>".
+
+Here is an example that can be added to your .vimrc which will setup the
+supertab chaining for any filetype that has a provided |omnifunc| to first
+try that, then fall back to supertab's default, <c-p>, completion:
+
+ autocmd FileType *
+ \ if &omnifunc != '' |
+ \ call SuperTabChain(&omnifunc, "<c-p>") |
+ \ call SuperTabSetDefaultCompletionType("<c-x><c-u>") |
+ \ endif
+
+Note: This feature does not support chaining any other combination of
+completions (2 or more completion functions, 2 or more key bindings, etc.). It
+can only support 1 completion function followed by 1 key binding. This is due
+to limitations imposed by vim's code completion implementation.
+
vim:tw=78:ts=8:ft=help:norl:
diff --git a/html/index.html b/html/index.html
index 4b3ded0..6547db3 100644
--- a/html/index.html
+++ b/html/index.html
@@ -49,7 +49,7 @@
<li><a href="syntax_CVSAnnotate.vim.html">syntax/CVSAnnotate.vim.html</a></li>
</ul>
<p>
- Page generated on Sat, 13 Aug 2011 22:47:56 -0400
+ Page generated on Thu, 17 Jan 2013 21:38:34 -0500
.
</p>
</body>
diff --git a/html/plugin_supertab.vim.html b/html/plugin_supertab.vim.html
index eb77ee5..70c46fa 100644
--- a/html/plugin_supertab.vim.html
+++ b/html/plugin_supertab.vim.html
@@ -3,7 +3,7 @@
<head>
<link rel="Stylesheet" type="text/css" href="/css/style.css" >
- <title>SuperTab continued. - Do all your insert-mode completion with Tab. : vim online</title>
+ <title>SuperTab - Do all your insert-mode completion with Tab. : 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">
@@ -102,7 +102,7 @@
<td class="sidebarheader"><a href="/docs.php">Documentation</a></td>
</tr>
<tr>
- <td class="sidebarheader"><a href="/download.php">Download</a></td>
+ <td class="sidebarheader download"><a href="/download.php">Download</a></td>
</tr>
<tr>
<td><img src="/images/spacer.gif" alt="" border="0" width="1" height="7"></td>
@@ -158,7 +158,7 @@
<tr>
<td valign="top">
-<span class="txth1">SuperTab continued. : Do all your insert-mode completion with Tab.</span>
+<span class="txth1">SuperTab : Do all your insert-mode completion with Tab.</span>
<br>
<br>
@@ -168,8 +168,8 @@
<tr>
<td class="lightbg"><b> script karma </b></td>
<td>
- Rating <b>1623/499</b>,
- Downloaded by 39586
+ Rating <b>2125/657</b>,
+ Downloaded by 56916
<g:plusone></g:plusone>
</td>
<td class="lightbg">
@@ -190,28 +190,13 @@
<tr><td>utility</td></tr>
<tr><td> </td></tr>
<tr><td class="prompt">description</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. This version contains many
<br>enhancements.
<br>
<br>You can also find supertab in my github repository:
<br><a target="_blank" href="http://github.com/ervandew/supertab">http://github.com/ervandew/supertab</A>
<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> supertab's default.
<br>- When using another completion type (ctrl-x ctrl-f), supertab will
<br> temporarily make that the default allowing you to continue to use tab for
<br> that completion. The duration is configurable to one of 'completion'
<br> (retained until you exit the current completion mode), 'insert' (retained
<br> until you leave insert mode), or 'session' (retained for the remainder of
<br> your vim session).
<br>- Supertab provides a 'context' completion type which examines the text
<br> preceding the cursor to decide which type of completion should be used
<br> (omni, user, file, or keyword). You can also plug in your own functions
<br> which will be used to determine which completion type to use according to
<br> your new functionality.
<br>- The 'context' completion can also be used to set the default completion type
<br> according to what the file supports, based on a discovery mechanism which
<br> you specify.
<br>- For users not yet familiar with all the various insert completion types that
<br> vim supports, supertab also provides a :SuperTabHelp command which opens a
<br> temporary buffer listing all the available types and the ability to easily
<br> switch to that type.
<br>
<br>After installing, see the supertab help for more information (:h supertab).
<br></td></tr>
+<tr><td>Overview
<br>
<br>Supertab allows you to use <Tab> for all your insert completion needs
<br>(:help ins-completion).
<br>
<br>Features
<br>
<br>- Configurable to suit you needs:
<br> - Default completion type to use.
<br> - Prevent <Tab> from completing after/before defined patterns.
<br> - Close vim's completion preview window when code completion is finished.
<br> - When using other completion types, you can configure how long to 'remember'
<br> the current completion type before returning to the default.
<br> - Don't like using <Tab>? You can also configure a different pair of keys to
<br> scroll forwards and backwards through completion results.
<br>- Optional improved 'longest' completion support (after typing some characters,
<br> hitting <Tab> will highlight the next longest match).
<br>- Built in 'context' completion option which chooses the appropriate completion
<br> type based on the text preceding the cursor.
<br> - You can also plug in your own functions to determine which completion type
<br> to use.
<br>- Support for simple completion chaining (falling back to a different
<br> completion type, keyword completion for example, if omni or user completion
<br> returns no results).
<br>
<br>You can also find supertab on github repository:
<br><a target="_blank" href="http://github.com/ervandew/supertab">http://github.com/ervandew/supertab</A>
<br></td></tr>
<tr><td> </td></tr>
<tr><td class="prompt">install details</td></tr>
-<tr><td>1. Download supertab.vba to any directory.
<br>2. Open the file in vim ($ vim supertab.vba).
<br>3. Source the file (:so %).</td></tr>
+<tr><td>1. Download supertab.vmb to any directory.
<br>2. Open the file in vim ($ vim supertab.vmb).
<br>3. Source the file (:so %).</td></tr>
<tr><td> </td></tr>
</table>
-<!-- rating table -->
-<form name="rating">
-<input type="hidden" name="script_id" value="1643">
-<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
- <input type="submit" value="rate">
- </td>
-</tr>
-</table>
-</form>
<span class="txth2">script versions</span> (<a href="add_script_version.php?script_id=1643">upload new version</a>)
<p>
Click on the package to download.
@@ -227,164 +212,172 @@ 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=16104">supertab.vba</a></td>
- <td class="rowodd" valign="top" nowrap><b>1.6</b></td>
- <td class="rowodd" valign="top" nowrap><i>2011-07-20</i></td>
+ <td class="rowodd" valign="top" nowrap><a href="download_script.php?src_id=18075">supertab.vmb</a></td>
+ <td class="rowodd" valign="top" nowrap><b>2.0</b></td>
+ <td class="rowodd" valign="top" nowrap><i>2012-06-01</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">- couple longest enhancement fixes
<br>- added ability to disable supertab via a buffer local variable
<br>- few other miscellaneous fixes.</td>
+ <td class="rowodd" valign="top" width="2000">- added support for chaining two completion types (falls back to the second if not results from the first).
<br>- added setting to close completion preview window when the completion popup closes.
<br>- improved compatibility with other plugins.
<br>- other minor bug fixes.</td>
</tr>
<tr>
- <td class="roweven" valign="top" nowrap><a href="download_script.php?src_id=15029">supertab.vba</a></td>
- <td class="roweven" valign="top" nowrap><b>1.5</b></td>
- <td class="roweven" valign="top" nowrap><i>2011-02-16</i></td>
+ <td class="roweven" valign="top" nowrap><a href="download_script.php?src_id=16104">supertab.vba</a></td>
+ <td class="roweven" valign="top" nowrap><b>1.6</b></td>
+ <td class="roweven" valign="top" nowrap><i>2011-07-20</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">- updated to support user mapped <c-n>/<c-p>
<br>- fix logic to decide whether to scroll up or down based on current completion context
<br>- fix <c-x><c-*> w/ longest enhancement enabled</td>
+ <td class="roweven" valign="top" width="2000">- couple longest enhancement fixes
<br>- added ability to disable supertab via a buffer local variable
<br>- few other miscellaneous fixes.</td>
</tr>
<tr>
- <td class="rowodd" valign="top" nowrap><a href="download_script.php?src_id=14882">supertab.vba</a></td>
- <td class="rowodd" valign="top" nowrap><b>1.4</b></td>
- <td class="rowodd" valign="top" nowrap><i>2011-01-27</i></td>
+ <td class="rowodd" valign="top" nowrap><a href="download_script.php?src_id=15029">supertab.vba</a></td>
+ <td class="rowodd" valign="top" nowrap><b>1.5</b></td>
+ <td class="rowodd" valign="top" nowrap><i>2011-02-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">Fix error that occurs attempting to complete after optional alternate completion mapping or :SuperTabHelp have set the completion type.</td>
+ <td class="rowodd" valign="top" width="2000">- updated to support user mapped <c-n>/<c-p>
<br>- fix logic to decide whether to scroll up or down based on current completion context
<br>- fix <c-x><c-*> w/ longest enhancement enabled</td>
</tr>
<tr>
- <td class="roweven" valign="top" nowrap><a href="download_script.php?src_id=14782">supertab.vba</a></td>
- <td class="roweven" valign="top" nowrap><b>1.3</b></td>
- <td class="roweven" valign="top" nowrap><i>2011-01-18</i></td>
+ <td class="roweven" valign="top" nowrap><a href="download_script.php?src_id=14882">supertab.vba</a></td>
+ <td class="roweven" valign="top" nowrap><b>1.4</b></td>
+ <td class="roweven" valign="top" nowrap><i>2011-01-27</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">- fix error attempting tab completion if buffer was loaded with no autocmds fired
<br>- fix tabbing through completion results with longest enabled when the longest text expanded is the empty string.</td>
+ <td class="roweven" valign="top" width="2000">Fix error that occurs attempting to complete after optional alternate completion mapping or :SuperTabHelp have set the completion type.</td>
</tr>
<tr>
- <td class="rowodd" valign="top" nowrap><a href="download_script.php?src_id=14717">supertab.vba</a></td>
- <td class="rowodd" valign="top" nowrap><b>1.2</b></td>
- <td class="rowodd" valign="top" nowrap><i>2011-01-09</i></td>
+ <td class="rowodd" valign="top" nowrap><a href="download_script.php?src_id=14782">supertab.vba</a></td>
+ <td class="rowodd" valign="top" nowrap><b>1.3</b></td>
+ <td class="rowodd" valign="top" nowrap><i>2011-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">- fix to not break abbreviation expansion on <cr>
<br>- when using longest enhancement, save/restore any previous mappings for <bs>/<c-h>
<br>- fix <cr> mapping to cooperate better with <cr> mappings of other plugins (ex. endwise)
<br>- created variables to set user defined list of before or after patterns for which completion should not be attempted (:h supertab-preventcomplete)</td>
+ <td class="rowodd" valign="top" width="2000">- fix error attempting tab completion if buffer was loaded with no autocmds fired
<br>- fix tabbing through completion results with longest enabled when the longest text expanded is the empty string.</td>
</tr>
<tr>
- <td class="roweven" valign="top" nowrap><a href="download_script.php?src_id=13928">supertab.vba</a></td>
- <td class="roweven" valign="top" nowrap><b>1.1</b></td>
- <td class="roweven" valign="top" nowrap><i>2010-09-27</i></td>
+ <td class="roweven" valign="top" nowrap><a href="download_script.php?src_id=14717">supertab.vba</a></td>
+ <td class="roweven" valign="top" nowrap><b>1.2</b></td>
+ <td class="roweven" valign="top" nowrap><i>2011-01-09</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 optional default <cr> mapping to end completion mode (enabled by default)
<br>- added support for an enhanced longest match completion (disabled by default)
<br>- other minor enhancements + bug fixes</td>
+ <td class="roweven" valign="top" width="2000">- fix to not break abbreviation expansion on <cr>
<br>- when using longest enhancement, save/restore any previous mappings for <bs>/<c-h>
<br>- fix <cr> mapping to cooperate better with <cr> mappings of other plugins (ex. endwise)
<br>- created variables to set user defined list of before or after patterns for which completion should not be attempted (:h supertab-preventcomplete)</td>
</tr>
<tr>
- <td class="rowodd" valign="top" nowrap><a href="download_script.php?src_id=11853">supertab.vba</a></td>
- <td class="rowodd" valign="top" nowrap><b>1.0</b></td>
- <td class="rowodd" valign="top" nowrap><i>2009-12-03</i></td>
+ <td class="rowodd" valign="top" nowrap><a href="download_script.php?src_id=13928">supertab.vba</a></td>
+ <td class="rowodd" valign="top" nowrap><b>1.1</b></td>
+ <td class="rowodd" valign="top" nowrap><i>2010-09-27</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 reverse cycling through result when using <c-n> completion
<br>- now distributed as a vimball with a help file (:h supertab). Thanks to Christophe-Marie Duquesne.</td>
+ <td class="rowodd" valign="top" width="2000">- added optional default <cr> mapping to end completion mode (enabled by default)
<br>- added support for an enhanced longest match completion (disabled by default)
<br>- other minor enhancements + bug fixes</td>
</tr>
<tr>
- <td class="roweven" valign="top" nowrap><a href="download_script.php?src_id=11533">supertab.vim</a></td>
- <td class="roweven" valign="top" nowrap><b>0.61</b></td>
- <td class="roweven" valign="top" nowrap><i>2009-10-16</i></td>
+ <td class="roweven" valign="top" nowrap><a href="download_script.php?src_id=11853">supertab.vba</a></td>
+ <td class="roweven" valign="top" nowrap><b>1.0</b></td>
+ <td class="roweven" valign="top" nowrap><i>2009-12-03</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 a possible error that may occur in some rare conditions.</td>
+ <td class="roweven" valign="top" width="2000">- fixed reverse cycling through result when using <c-n> completion
<br>- now distributed as a vimball with a help file (:h supertab). Thanks to Christophe-Marie Duquesne.</td>
</tr>
<tr>
- <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><a href="download_script.php?src_id=11533">supertab.vim</a></td>
+ <td class="rowodd" valign="top" nowrap><b>0.61</b></td>
+ <td class="rowodd" valign="top" nowrap><i>2009-10-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">- Refactored the contextual completion and default discovery support.
<br> - Context completion now supports plugable functions to determine which
<br> completion type to use.
<br> - Default discovery is now a part of context completion.
<br>- NOTE: Several non-backwards compatible configuration changes where made.
<br> - g:SuperTabRetainCompletionType is now g:SuperTabRetainCompletionDuration
<br> and accepts one of 'none', 'insert', or 'session'.
<br> - new setting g:SuperTabCompletionContexts defines which context completion
<br> functions are consulted.
<br> - g:SuperTabDefaultCompletionTypeDiscovery is now
<br> g:SuperTabContextDiscoverDiscovery and requires that
<br> g:SuperTabContextDefaultCompletionType is set to 'context' and that
<br> 's:ContextDiscover' is in your g:SuperTabCompletionContexts list.
<br>Please see the updated "Global Variables" fold in supertab.vim for additional
<br>details and examples.</td>
+ <td class="rowodd" valign="top" width="2000">Fixed a possible error that may occur in some rare conditions.</td>
</tr>
<tr>
- <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><a href="download_script.php?src_id=11386">supertab.vim</a></td>
+ <td class="roweven" valign="top" nowrap><b>0.60</b></td>
+ <td class="roweven" valign="top" nowrap><i>2009-09-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=6016">Eric Van Dewoestine</a></i></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>
+ <td class="roweven" valign="top" width="2000">- Refactored the contextual completion and default discovery support.
<br> - Context completion now supports plugable functions to determine which
<br> completion type to use.
<br> - Default discovery is now a part of context completion.
<br>- NOTE: Several non-backwards compatible configuration changes where made.
<br> - g:SuperTabRetainCompletionType is now g:SuperTabRetainCompletionDuration
<br> and accepts one of 'none', 'insert', or 'session'.
<br> - new setting g:SuperTabCompletionContexts defines which context completion
<br> functions are consulted.
<br> - g:SuperTabDefaultCompletionTypeDiscovery is now
<br> g:SuperTabContextDiscoverDiscovery and requires that
<br> g:SuperTabContextDefaultCompletionType is set to 'context' and that
<br> 's:ContextDiscover' is in your g:SuperTabCompletionContexts list.
<br>Please see the updated "Global Variables" fold in supertab.vim for additional
<br>details and examples.</td>
</tr>
<tr>
- <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><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>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">Added check for vim 7 or greater, otherwise disable supertab support (suggested by Vincent Lee). Also, removed any remaining pre vim 7 logic that is no longer applicable.</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>
</tr>
<tr>
- <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><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>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 case where new buffer may not be initialized by super tab (thanks to Tammer Saleh for reporting the issue).</td>
+ <td class="roweven" valign="top" width="2000">Added check for vim 7 or greater, otherwise disable supertab support (suggested by Vincent Lee). Also, removed any remaining pre vim 7 logic that is no longer applicable.</td>
</tr>
<tr>
- <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><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>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 command line completion (ctrl-x ctrl-v) when invoked from supertab. Thanks to Frank Chang for the patch.</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>
</tr>
<tr>
- <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><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>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 issue with default completion discovery option if desired type is dependent on file type plugins. Thanks to Andreas Schneider for reporting the issue.</td>
+ <td class="roweven" valign="top" width="2000">Fixed command line completion (ctrl-x ctrl-v) when invoked from supertab. Thanks to Frank Chang for the patch.</td>
</tr>
<tr>
- <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><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>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">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="rowodd" valign="top" width="2000">fixed issue with default completion discovery option if desired type is dependent on file type plugins. Thanks to Andreas Schneider for reporting the issue.</td>
</tr>
<tr>
- <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" 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>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 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="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>
</tr>
<tr>
- <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><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"><i><a href="/account/profile.php?user_id=6016">Eric Van Dewoestine</a></i></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>
+ <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>
</tr>
<tr>
- <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><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>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">With the permission of the original author, this script is now released under the BSD license.</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>
</tr>
<tr>
- <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><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>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">- Added g:SuperTabMidWordCompletion variable to determine if completion should be done within a word (enabled by default). (based on request by Charles Gruenwald)
<br>- Applied patch to fix <s-tab> cycling through completion results. (submitted by Lukasz Krotowski)
<br></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>
</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><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>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>
+ <td class="roweven" valign="top" width="2000">- Added g:SuperTabMidWordCompletion variable to determine if completion should be done within a word (enabled by default). (based on request by Charles Gruenwald)
<br>- Applied patch to fix <s-tab> cycling through completion results. (submitted by Lukasz Krotowski)
<br></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>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>
</tr>
</table>
<!-- finish off the framework -->
diff --git a/plugin/supertab.vim b/plugin/supertab.vim
index 67f8c5c..ae19838 100644
--- a/plugin/supertab.vim
+++ b/plugin/supertab.vim
@@ -1,8 +1,7 @@
-" Author:
-" 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: 1.6
+" Author: Eric Van Dewoestine <ervandew at gmail.com>
+" Original concept and versions up to 0.32 written by
+" Gergely Kontra <kgergely at mcl.hu>
+" Version: 2.0
" GetLatestVimScripts: 1643 1 :AutoInstall: supertab.vim
"
" Description: {{{
@@ -14,7 +13,7 @@
" }}}
"
" License: {{{
-" Copyright (c) 2002 - 2011
+" Copyright (c) 2002 - 2012
" All rights reserved.
"
" Redistribution and use of this software in source and binary forms, with
@@ -123,6 +122,10 @@ set cpo&vim
let g:SuperTabCrMapping = 1
endif
+ if !exists("g:SuperTabClosePreviewOnPopupClose")
+ let g:SuperTabClosePreviewOnPopupClose = 0
+ endif
+
" }}}
" Script Variables {{{
@@ -256,10 +259,22 @@ function! s:InitBuffer()
let b:SuperTabNoCompleteAfter = g:SuperTabNoCompleteAfter
endif
- let b:SuperTabDefaultCompletionType = g:SuperTabDefaultCompletionType
+ if !exists('b:SuperTabDefaultCompletionType')
+ let b:SuperTabDefaultCompletionType = g:SuperTabDefaultCompletionType
+ endif
" set the current completion type to the default
call SuperTabSetCompletionType(b:SuperTabDefaultCompletionType)
+
+ " hack to programatically revert a change to snipmate that breaks supertab
+ " but which the new maintainers don't care about:
+ " http://github.com/garbas/vim-snipmate/issues/37
+ let snipmate = maparg('<tab>', 'i')
+ if snipmate =~ '<C-G>u' && g:SuperTabMappingForward =~? '<tab>'
+ let snipmate = substitute(snipmate, '<C-G>u', '', '')
+ iunmap <tab>
+ exec "inoremap <silent> <tab> " . snipmate
+ endif
endfunction " }}}
" s:ManualCompletionEnter() {{{
@@ -270,6 +285,8 @@ function! s:ManualCompletionEnter()
endif
let complType = nr2char(getchar())
if stridx(s:types, complType) != -1
+ let b:supertab_close_preview = 1
+
if stridx("\<c-e>\<c-y>", complType) != -1 " no memory, just scroll...
return "\<c-x>" . complType
elseif stridx('np', complType) != -1
@@ -322,8 +339,7 @@ function! s:SetCompletionType()
endif
endfunction " }}}
-" s:SetDefaultCompletionType() {{{
-function! s:SetDefaultCompletionType()
+function! s:SetDefaultCompletionType() " {{{
if exists('b:SuperTabDefaultCompletionType') &&
\ (!exists('b:complCommandLine') || !b:complCommandLine)
call SuperTabSetCompletionType(b:SuperTabDefaultCompletionType)
@@ -342,6 +358,8 @@ function! s:SuperTab(command)
call s:InitBuffer()
if s:WillComplete()
+ let b:supertab_close_preview = 1
+
" optionally enable enhanced longest completion
if g:SuperTabLongestEnhanced && &completeopt =~ 'longest'
call s:EnableLongestEnhancement()
@@ -485,8 +503,7 @@ function! s:WillComplete()
return 1
endfunction " }}}
-" s:EnableLongestEnhancement() {{{
-function! s:EnableLongestEnhancement()
+function! s:EnableLongestEnhancement() " {{{
augroup supertab_reset
autocmd!
autocmd InsertLeave,CursorMovedI <buffer>
@@ -495,14 +512,12 @@ function! s:EnableLongestEnhancement()
call s:CaptureKeyPresses()
endfunction " }}}
-" s:CompletionReset(char) {{{
-function! s:CompletionReset(char)
+function! s:CompletionReset(char) " {{{
let b:complReset = 1
return a:char
endfunction " }}}
-" s:CaptureKeyPresses() {{{
-function! s:CaptureKeyPresses()
+function! s:CaptureKeyPresses() " {{{
if !exists('b:capturing') || !b:capturing
let b:capturing = 1
" save any previous mappings
@@ -520,8 +535,23 @@ function! s:CaptureKeyPresses()
endif
endfunction " }}}
-" s:ReleaseKeyPresses() {{{
-function! s:ReleaseKeyPresses()
+function! s:ClosePreview() " {{{
+ if exists('b:supertab_close_preview') && b:supertab_close_preview
+ let preview = 0
+ for bufnum in tabpagebuflist()
+ if getwinvar(bufwinnr(bufnum), '&previewwindow')
+ let preview = 1
+ break
+ endif
+ endfor
+ if preview
+ pclose
+ endif
+ unlet b:supertab_close_preview
+ endif
+endfunction " }}}
+
+function! s:ReleaseKeyPresses() " {{{
if exists('b:capturing') && b:capturing
let b:capturing = 0
for c in split('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_', '.\zs')
@@ -566,8 +596,7 @@ function! s:CommandLineCompletion()
\ "let b:complCommandLine = 0\<cr>"
endfunction " }}}
-" s:ContextCompletion() {{{
-function! s:ContextCompletion()
+function! s:ContextCompletion() " {{{
let contexts = exists('b:SuperTabCompletionContexts') ?
\ b:SuperTabCompletionContexts : g:SuperTabCompletionContexts
@@ -588,8 +617,7 @@ function! s:ContextCompletion()
return ''
endfunction " }}}
-" s:ContextDiscover() {{{
-function! s:ContextDiscover()
+function! s:ContextDiscover() " {{{
let discovery = exists('g:SuperTabContextDiscoverDiscovery') ?
\ g:SuperTabContextDiscoverDiscovery : []
@@ -607,8 +635,7 @@ function! s:ContextDiscover()
endif
endfunction " }}}
-" s:ContextText() {{{
-function! s:ContextText()
+function! s:ContextText() " {{{
let exclusions = exists('g:SuperTabContextTextFileTypeExclusions') ?
\ g:SuperTabContextTextFileTypeExclusions : []
@@ -637,8 +664,7 @@ function! s:ContextText()
endif
endfunction " }}}
-" s:ExpandMap(map) {{{
-function! s:ExpandMap(map)
+function! s:ExpandMap(map) " {{{
let map = a:map
if map =~ '<Plug>'
let plug = substitute(map, '.\{-}\(<Plug>\w\+\).*', '\1', '')
@@ -648,6 +674,53 @@ function! s:ExpandMap(map)
return map
endfunction " }}}
+function! SuperTabChain(completefunc, completekeys) " {{{
+ let b:SuperTabChain = [a:completefunc, a:completekeys]
+ setlocal completefunc=SuperTabCodeComplete
+endfunction " }}}
+
+function! SuperTabCodeComplete(findstart, base) " {{{
+ if !exists('b:SuperTabChain')
+ echoe 'No completion chain has been set.'
+ return -2
+ endif
+
+ if len(b:SuperTabChain) != 2
+ echoe 'Completion chain can only be used with 1 completion function ' .
+ \ 'and 1 fallback completion key binding.'
+ return -2
+ endif
+
+ let Func = function(b:SuperTabChain[0])
+
+ if a:findstart
+ let start = Func(a:findstart, a:base)
+ if start >= 0
+ return start
+ endif
+
+ return col('.') - 1
+ endif
+
+ let results = Func(a:findstart, a:base)
+ if len(results)
+ return results
+ endif
+
+ exec 'let keys = "' . escape(b:SuperTabChain[1], '<') . '"'
+ call feedkeys("\<c-e>" . keys, 'nt')
+ return []
+endfunction " }}}
+
+" Autocmds {{{
+ if g:SuperTabClosePreviewOnPopupClose
+ augroup supertab_close_preview
+ autocmd!
+ autocmd InsertLeave,CursorMovedI * call s:ClosePreview()
+ augroup END
+ endif
+" }}}
+
" Key Mappings {{{
" map a regular tab to ctrl-tab (note: doesn't work in console vim)
exec 'inoremap ' . g:SuperTabMappingTabLiteral . ' <tab>'
@@ -685,7 +758,22 @@ endfunction " }}}
endfunction
if g:SuperTabCrMapping
- if maparg('<CR>','i') =~ '<CR>'
+ let expr_map = 0
+ try
+ let map_dict = maparg('<cr>', 'i', 0, 1)
+ let expr_map = map_dict.expr
+ catch
+ let expr_map = maparg('<cr>', 'i') =~? '\<cr>'
+ endtry
+
+ if expr_map
+ " Not compatible w/ expr mappings. This is most likely a user mapping,
+ " typically with the same functionality anyways.
+ elseif maparg('<CR>', 'i') =~ '<Plug>delimitMateCR'
+ " Not compatible w/ delimitMate since it doesn't play well with others
+ " and will always return a <cr> which we don't want when selecting a
+ " completion.
+ elseif maparg('<CR>','i') =~ '<CR>'
let map = maparg('<cr>', 'i')
let cr = (map =~? '\(^\|[^)]\)<cr>')
let map = s:ExpandMap(map)
@@ -699,6 +787,13 @@ endfunction " }}}
" ugly hack to let other <cr> mappings for other plugins cooperate
" with supertab
let b:supertab_pumwasvisible = 1
+
+ " close the preview window if configured to do so
+ if &completeopt =~ 'preview' && g:SuperTabClosePreviewOnPopupClose
+ let b:supertab_close_preview = 1
+ call s:ClosePreview()
+ endif
+
return "\<c-y>"
endif
@@ -711,10 +806,15 @@ endfunction " }}}
" not so pleasant hack to keep <cr> working for abbreviations
let word = substitute(getline('.'), '^.*\s\+\(.*\%' . col('.') . 'c\).*', '\1', '')
- if maparg(word, 'i', 1) != ''
- call feedkeys("\<c-]>", 't')
- call feedkeys("\<cr>", 'n')
- return ''
+ let result = maparg(word, 'i', 1)
+ if result != ''
+ let bs = ""
+ let i = 0
+ while i < len(word)
+ let bs .= "\<bs>"
+ let i += 1
+ endwhile
+ return bs . result . (a:cr ? "\<cr>" : "")
endif
" only return a cr if nothing else is mapped to it since we don't want
@@ -732,6 +832,43 @@ endfunction " }}}
call s:Init()
+function! TestSuperTabCodeComplete(findstart, base) " {{{
+ " Test supertab completion chaining w/ a minimal vim environment:
+ " $ vim -u NONE -U NONE \
+ " --cmd "set nocp | sy on" \
+ " -c "so ~/.vim/plugin/supertab.vim" \
+ " -c "let g:SuperTabDefaultCompletionType = '<c-x><c-u>'" \
+ " -c "set completefunc=TestSuperTabCodeComplete" \
+ " -c "call SuperTabChain(&completefunc, '<c-p>')"
+ if a:findstart
+ let line = getline('.')
+ let start = col('.') - 1
+ if line[start] =~ '\.'
+ let start -= 1
+ endif
+ while start > 0 && line[start - 1] =~ '\w'
+ let start -= 1
+ endwhile
+ return start
+ else
+ let completions = []
+ if getline('.') =~ 'TestC'
+ call add(completions, {
+ \ 'word': 'test1(',
+ \ 'kind': 'm',
+ \ 'menu': 'test1(...)',
+ \ })
+ call add(completions, {
+ \ 'word': 'testing2(',
+ \ 'kind': 'm',
+ \ 'menu': 'testing2(...)',
+ \ })
+ endif
+
+ return completions
+ endif
+endfunction " }}}
+
let &cpo = s:save_cpo
" vim:ft=vim:fdm=marker
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-vim/vim-scripts.git
More information about the pkg-vim-maintainers
mailing list