[SCM] vim-scripts packaging branch, master, updated. v20091011-7-g153d936
James Vega
jamessan at debian.org
Tue Jan 26 22:20:34 UTC 2010
The following commit has been merged in the master branch:
commit c6e3d2508fb5ac3bc4814547ca27655223a492ea
Author: James Vega <jamessan at debian.org>
Date: Tue Jan 26 16:37:27 2010 -0500
Update supertab to 1.0
Signed-off-by: James Vega <jamessan at debian.org>
diff --git a/debian/changelog b/debian/changelog
index 48783f2..c0c43bd 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,8 @@ vim-scripts (20091012) UNRELEASED; urgency=low
* Rename "colors sampler pack" to "colors-sampler-pack" so it's easier to
manage with vim-addon-manager. (Closes: #555621)
+ * Updated addons:
+ - supertab: Updated to 1.0
-- James Vega <jamessan at debian.org> Sun, 24 Jan 2010 17:10:16 -0500
diff --git a/debian/patches/disabledby-supertab.diff b/debian/patches/disabledby-supertab.diff
index 5e4288a..c2cabc0 100644
--- a/debian/patches/disabledby-supertab.diff
+++ b/debian/patches/disabledby-supertab.diff
@@ -4,7 +4,7 @@ Index: vim-scripts/plugin/supertab.vim
===================================================================
--- vim-scripts.orig/plugin/supertab.vim
+++ vim-scripts/plugin/supertab.vim
-@@ -58,6 +58,11 @@
+@@ -59,6 +59,11 @@
finish
endif
diff --git a/debian/vim-scripts.status b/debian/vim-scripts.status
index d153d28..09cdc1e 100644
--- a/debian/vim-scripts.status
+++ b/debian/vim-scripts.status
@@ -320,8 +320,9 @@ author: Eric Van Dewoestine
author_url: http://www.vim.org/account/profile.php?user_id=6016
email: ervandew at gmail.com
license: BSD, see /usr/share/common-licenses/BSD
+extras: doc/supertab.txt
disabledby: let loaded_supertab = 1
-version: 0.60
+version: 1.0
script_name: plugin/lbdbq.vim
addon: lbdbq
diff --git a/doc/supertab.txt b/doc/supertab.txt
new file mode 100644
index 0000000..3eadefe
--- /dev/null
+++ b/doc/supertab.txt
@@ -0,0 +1,308 @@
+*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.
+
+This plugin is licensed under the terms of the BSD License. Please see
+supertab.vim for the license in its entirety.
+
+==============================================================================
+Supertab *supertab*
+
+1. Introduction |supertab-intro|
+2. Supertab Usage |supertab-usage|
+3. Supertab Options |supertab-options|
+ Default completion type |supertab-defaultcompletion|
+ Secondary default completion type |supertab-contextdefault|
+ Completion contexts |supertab-completioncontexts|
+ Context text |supertab-contexttext|
+ Context Discover |supertab-contextdiscover|
+ Example |supertab-contextexample|
+ Completion Duration |supertab-duration|
+ Midword completion |supertab-midword|
+ Changing default mapping |supertab-forwardbackward|
+ Inserting true tabs |supertab-mappingtabliteral|
+ Preselecting the first entry |supertab-longesthighlight|
+
+==============================================================================
+1. Introduction *supertab-intro*
+
+Supertab is a plugin which allows you to perform all your insert completion
+(|ins-completion|) using the tab key.
+
+Supertab requires Vim version 7.0 or above.
+
+==============================================================================
+2. Supertab usage *supertab-usage*
+
+Using Supertab is as easy as hitting <Tab> or <S-Tab> (shift+tab) while in
+insert mode, with at least one non whitespace character before the cursor, to
+start the completion and then <Tab> or <S-Tab> again to cycle forwards or
+backwards through the available completions.
+
+Example ('|' denotes the cursor location):
+
+bar
+baz
+b|<Tab> Hitting <Tab> here will start the completion, allowing you to
+ then cycle through the suggested words ('bar' and 'baz').
+
+==============================================================================
+3. Supertab Options *supertab-options*
+
+Supertab is configured via several global variables that you can set in your
+|vimrc| file according to your needs. Below is a comprehensive list of
+the variables available.
+
+g:SuperTabDefaultCompletionType |supertab-defaultcompletion|
+ The default completion type to use. If you program in languages that support
+ omni or user completions, it is highly recommended setting this to
+ 'context'.
+
+ For help about built in completion types in vim, see |i_CTRL-X_index|.
+
+g:SuperTabContextDefaultCompletionType |supertab-contextdefault|
+ The default completion type to use when 'context' is the global default, but
+ context completion has determined that neither omni, user, or file
+ completion should be used in the current context.
+
+g:SuperTabCompletionContexts |supertab-completioncontexts|
+ Used to configure a list of function names which are used when the global
+ default type is 'context'. These functions will be consulted in order to
+ determine which completion type to use. Advanced users can plug in their own
+ functions here to customize their 'context' completion.
+
+g:SuperTabRetainCompletionDuration |supertab-duration|
+ This setting determines how long a non-default completion type should be
+ retained as the temporary default. By default supertab will retain the
+ alternate completion type until you leave insert mode.
+
+g:SuperTabMidWordCompletion |supertab-midword|
+ This can be used to turn off completion if you are in the middle of a word
+ (word characters immediately preceding and following the cursor).
+
+g:SuperTabMappingForward |supertab-forwardbackward|
+g:SuperTabMappingBackward |supertab-forwardbackward|
+ If using the tab key for completion isn't for you, then you can use these to
+ set an alternate key to be used for your insert completion needs.
+
+g:SuperTabMappingTabLiteral |supertab-mappingtabliteral|
+ For those rare cases where supertab would normal want to start insert
+ completion, but you just want to insert a tab, this setting is used to
+ define the key combination to use to do just that. By default Ctrl-Tab is
+ used.
+
+g:SuperTabLongestHighlight |supertab-longesthighlight|
+ When enabled and you have the completion popup enable and 'longest' in your
+ completeopt, supertab will auto highlight the first selection in the popup.
+
+
+Default Completion Type *supertab-defaultcompletion*
+ *g:SuperTabDefaultCompletionType*
+
+g:SuperTabDefaultCompletionType (default value: "<c-p>")
+
+Used to set the default completion type. There is no need to escape this
+value as that will be done for you when the type is set.
+
+ Example: setting the default completion to 'user' completion:
+
+ let g:SuperTabDefaultCompletionType = "<c-x><c-u>"
+
+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
+references containing '/'.
+
+ let g:SuperTabDefaultCompletionType = "context"
+
+ /usr/l<tab> # will use filename completion
+ myvar.t<tab> # will use user completion if completefunc set,
+ # or omni completion if omnifunc set.
+ myvar-><tab> # same as above
+
+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>")
+
+
+Secondary default completion type *supertab-contextdefault*
+ *g:SuperTabContextDefaultCompletionType*
+
+g:SuperTabContextDefaultCompletionType (default value: "<c-p>")
+
+Sets the default completion type used when g:SuperTabDefaultCompletionType is
+set to 'context' and no completion type is returned by any of the configured
+contexts.
+
+
+Completion contexts *supertab-completioncontexts*
+ *g:SuperTabCompletionContexts*
+
+g:SuperTabCompletionContexts (default value: ['s:ContextText'])
+
+Sets the list of contexts used for context completion. This value should
+be a list of function names which provide the context implementation.
+
+When supertab starts the default completion, each of these contexts will be
+consulted, in the order they were supplied, 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 *supertab-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 '/'.
+
+ /usr/l<tab> # will use filename completion
+ myvar.t<tab> # will use user completion if completefunc set, or
+ # omni completion if omnifunc set.
+ myvar-><tab> # 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 precedence 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 *supertab-contextdiscover*
+
+ This context will use the 'g:SuperTabContextDiscoverDiscovery' variable to
+ determine the completion type to use. It will evaluate each value, in the
+ order they were defined, 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: *supertab-contextexample*
+
+ 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>").
+
+ 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.
+
+
+Completion Duration *supertab-duration*
+ *g:SuperTabRetainCompletionDuration*
+
+g:SuperTabRetainCompletionDuration (default value: 'insert')
+
+Determines if, and for how long, the current completion type is retained.
+The possible values include:
+'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.
+
+
+Midword completion *supertab-midword*
+ *g:SuperTabMidWordCompletion*
+
+g:SuperTabMidWordCompletion (default value: 1)
+
+Sets whether or not mid word completion is enabled. 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).
+
+
+Changing the default mapping *supertab-forwardbackward*
+ *g:SuperTabMappingForward*
+ *g:SuperTabMappingBackward*
+
+g:SuperTabMappingForward (default value: '<tab>')
+g:SuperTabMappingBackward (default value: '<s-tab>')
+
+These two variables allow you to set the keys used to kick off the current
+completion. By default this is <tab> and <s-tab>. To change to something
+like <c-space> and <s-c-space>, you can add the following to your |vimrc|.
+
+ let g:SuperTabMappingForward = '<c-space>'
+ let g:SuperTabMappingBackward = '<s-c-space>'
+
+Note: if the above does not have the desired effect (which may happen in
+console version of vim), you can try the following mappings. Although the
+backwards mapping still doesn't seem to work in the console for me, your
+milage may vary.
+
+ let g:SuperTabMappingForward = '<nul>'
+ let g:SuperTabMappingBackward = '<s-nul>'
+
+
+Inserting true tabs *supertab-mappingtabliteral*
+ *g:SuperTabMappingTabLiteral*
+
+g:SuperTabMappingTabLiteral (default value: '<c-tab>')
+
+Sets the key mapping used to insert a literal tab where supertab would
+otherwise attempt to kick off insert completion. The default is '<c-tab>'
+(ctrl-tab) which unfortunately might not work at the console. So if you are
+using a console vim and want this functionality, you may have to change it to
+something that is supported. Alternatively, you can escape the <tab> with
+<c-v> (see |i_CTRL-V| for more infos).
+
+
+Preselecting the first entry *supertab-longesthighlight*
+ *g:SuperTabLongestHighlight*
+
+g:SuperTabLongestHighlight (default value: 0)
+
+Sets whether or not to pre-highlight the first match when completeopt has the
+popup menu enabled and the 'longest' option as well. When enabled, <tab> will
+kick off completion and pre-select the first entry in the popup menu, allowing
+you to simply hit <enter> to use it.
+
+vim:tw=78:ts=8:ft=help:norl:
diff --git a/html/index.html b/html/index.html
index 7c76be6..ffa2d9d 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:53:39 -0400
+ Page generated on Tue, 26 Jan 2010 16:21:20 -0500
.
</p>
</body>
diff --git a/html/plugin_supertab.vim.html b/html/plugin_supertab.vim.html
index b6dc4b5..ede55ec 100644
--- a/html/plugin_supertab.vim.html
+++ b/html/plugin_supertab.vim.html
@@ -166,8 +166,8 @@
<tr>
<td class="lightbg"><b> script karma </b></td>
<td>
- Rating <b>950/289</b>,
- Downloaded by 17979 </td>
+ Rating <b>1081/332</b>,
+ Downloaded by 21205 </td>
</tr>
</table>
<p>
@@ -180,10 +180,10 @@
<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>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>Supertab provides various settings allowing you to fully customize supertab to
<br>your tastes (the "Global Variables" fold in supertab.vim contains more details
<br>and examples):
<br>- g:SuperTabDefaultCompletionType - The default completion type to use. If
<br> you program in languages that support omni or user completions, I highly
<br> recommend setting this to 'context'.
<br>- g:SuperTabContextDefaultCompletionType - The default completion type to use
<br> when 'context' is the global default, but context completion has determined
<br> that neither omni, user, or file completion should be used in the current
<br> context.
<br>- g:SuperTabCompletionContexts - Used to configure a list of function names
<br> which are used when the global default type is 'context'. These functions
<br> will be consulted in order to determine which completion type to use.
<br> Advanced users can plug in their own functions here to customize their
<br> 'context' completion.
<br>- g:SuperTabRetainCompletionDuration - This setting determines how long a
<br> non-default completion type should be retained as the temporary default. By
<br> default supertab will retain the alternate completion type until you leave
<br> insert mode.
<br>- g:SuperTabMidWordCompletion - This can be used to turn off completion if you
<br> are in the middle of a word.
<br>- g:SuperTabMappingForward, g:SuperTabMappingBackward - If using the tab key
<br> for completion isn't for you, then you can use these to set an alternate key
<br> to be used for your insert completion needs.
<br>- g:SuperTabMappingTabLiteral - For those rare cases where supertab would
<br> normal want to start insert completion, but you just want to insert a tab,
<br> this setting is used to define the key combination to use to do just that.
<br> By default Ctrl-Tab is used.
<br>- g:SuperTabLongestHighlight - When enabled and you have the completion popup
<br> enable and 'longest' in your completeopt, supertab will auto highlight the
<br> first selection in the popup.
<br>- g:SuperTabContextDiscoverDiscovery - If you have 's:ContextDiscover' in your
<br> g:SuperTabCompletionContexts list, then this setting will be consulted for a
<br> list of simple variable:completion type pairs which will set the default
<br> completion type to the first type whose variable evaluates to a non-zero or
<br> 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>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 vimfiles github repository:
<br><a target="_blank" href="http://github.com/ervandew/vimfiles">http://github.com/ervandew/vimfiles</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> </td></tr>
<tr><td class="prompt">install details</td></tr>
-<tr><td>Place the file in your plugins directory.</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> </td></tr>
</table>
@@ -217,6 +217,22 @@ 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=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>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>
+</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>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>
+</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>
diff --git a/plugin/supertab.vim b/plugin/supertab.vim
index e646b5c..48efda8 100644
--- a/plugin/supertab.vim
+++ b/plugin/supertab.vim
@@ -2,7 +2,8 @@
" 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.60
+" Version: 1.0
+" GetLatestVimScripts: 1643 1 :AutoInstall: supertab.vim
"
" Description: {{{
" Use your tab key to do all your completion in insert mode!
@@ -62,155 +63,31 @@ if exists('complType') " Integration with other completion functions.
finish
endif
+let s:save_cpo=&cpo
+set cpo&vim
+
" Global Variables {{{
- " Used to set the default completion type.
- " There is no need to escape this value as that will be done for you when
- " the type is set.
- " Ex. let g:SuperTabDefaultCompletionType = "<c-x><c-u>"
- "
- " 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
- " references containing '/'.
- " Ex. let g:SuperTabDefaultCompletionType = 'context'
- " /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
- "
- " 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 no completion type is returned by any of the
- " configured contexts.
if !exists("g:SuperTabContextDefaultCompletionType")
let g:SuperTabContextDefaultCompletionType = "<c-p>"
endif
- " 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:
- " '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 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
- " The following two variables allow you to set the key mapping used to kick
- " off the current completion. By default this is <tab> and <s-tab>. To
- " change to something like <c-space> and <s-c-space>, you can add the
- " following to your vimrc.
- "
- " let g:SuperTabMappingForward = '<c-space>'
- " let g:SuperTabMappingBackward = '<s-c-space>'
- "
- " Note: if the above does not have the desired effect (which may happen in
- " console version of vim), you can try the following mappings. Although the
- " backwards mapping still doesn't seem to work in the console for me, your
- " milage may vary.
- "
- " let g:SuperTabMappingForward = '<nul>'
- " let g:SuperTabMappingBackward = '<s-nul>'
- "
if !exists("g:SuperTabMappingForward")
let g:SuperTabMappingForward = '<tab>'
endif
@@ -218,19 +95,10 @@ endif
let g:SuperTabMappingBackward = '<s-tab>'
endif
- " Sets the key mapping used to insert a literal tab where supertab would
- " otherwise attempt to kick off insert completion.
- " The default is '<c-tab>' (ctrl-tab) which unfortunately might not work at
- " the console. So if you are using a console vim and want this
- " functionality, you'll have to change it to something that is supported.
if !exists("g:SuperTabMappingTabLiteral")
let g:SuperTabMappingTabLiteral = '<c-tab>'
endif
- " Sets whether or not to pre-highlight first match when completeopt has
- " the popup menu enabled and the 'longest' option as well.
- " When enabled, <tab> will kick off completion and pre-select the first
- " entry in the popup menu, allowing you to simply hit <enter> to use it.
if !exists("g:SuperTabLongestHighlight")
let g:SuperTabLongestHighlight = 0
endif
@@ -411,7 +279,8 @@ endfunction " }}}
" s:SetDefaultCompletionType() {{{
function! s:SetDefaultCompletionType()
- if exists('b:SuperTabDefaultCompletionType') && !b:complCommandLine
+ if exists('b:SuperTabDefaultCompletionType') &&
+ \ (!exists('b:complCommandLine') || !b:complCommandLine)
call SuperTabSetCompletionType(b:SuperTabDefaultCompletionType)
endif
endfunction " }}}
@@ -439,6 +308,11 @@ function! s:SuperTab(command)
\ (b:complType == 'context' &&
\ tolower(g:SuperTabContextDefaultCompletionType) == '<c-p>'))
return "\<c-n>"
+ elseif a:command == 'p' &&
+ \ (b:complType == "\<c-n>" ||
+ \ (b:complType == 'context' &&
+ \ tolower(g:SuperTabContextDefaultCompletionType) == '<c-n>'))
+ return "\<c-p>"
endif
" handle 'context' completion.
@@ -631,4 +505,6 @@ endfunction " }}}
call s:Init()
+let &cpo = s:save_cpo
+
" vim:ft=vim:fdm=marker
--
vim-scripts packaging
More information about the pkg-vim-maintainers
mailing list