SuperTab continued. : Do all your insert-mode completion with Tab.
script karma |
Rating 950/289,
Downloaded by 17979 |
created by |
Eric Van Dewoestine |
|
script type |
utility |
|
description |
Supertab aims to provide tab completion to satisfy all your insert completion
needs (:help ins-completion).
This version is a continuation of vimscript #182 by Gergely Kontra, who has
asked me to take over support and maintenance. This version contains many
enhancements.
Supertab provides several features to enhance your insert completion
experience:
- You can set your favorite insert completion type (keyword, omni, etc.) as
supertab's default.
- When using another completion type (ctrl-x ctrl-f), supertab will
temporarily make that the default allowing you to continue to use tab for
that completion. The duration is configurable to one of 'completion'
(retained until you exit the current completion mode), 'insert' (retained
until you leave insert mode), or 'session' (retained for the remainder of
your vim session).
- Supertab provides a 'context' completion type which examines the text
preceding the cursor to decide which type of completion should be used
(omni, user, file, or keyword). You can also plug in your own functions
which will be used to determine which completion type to use according to
your new functionality.
- The 'context' completion can also be used to set the default completion type
according to what the file supports, based on a discovery mechanism which
you specify.
- For users not yet familiar with all the various insert completion types that
vim supports, supertab also provides a :SuperTabHelp command which opens a
temporary buffer listing all the available types and the ability to easily
switch to that type.
Supertab provides various settings allowing you to fully customize supertab to
your tastes (the "Global Variables" fold in supertab.vim contains more details
and examples):
- g:SuperTabDefaultCompletionType - The default completion type to use. If
you program in languages that support omni or user completions, I highly
recommend setting this to 'context'.
- g:SuperTabContextDefaultCompletionType - 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 - 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 - 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 - This can be used to turn off completion if you
are in the middle of a word.
- g:SuperTabMappingForward, g:SuperTabMappingBackward - 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 - 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 - When enabled and you have the completion popup
enable and 'longest' in your completeopt, supertab will auto highlight the
first selection in the popup.
- g:SuperTabContextDiscoverDiscovery - If you have 's:ContextDiscover' in your
g:SuperTabCompletionContexts list, then this setting will be consulted for a
list of simple variable:completion type pairs which will set the default
completion type to the first type whose variable evaluates to a non-zero or
non-empty value.
In addition to these settings, be sure to familiarize yourself with vim's own
'completeopt' option (:help 'completeopt') to customize vim's completion
behavior.
|
|
install details |
Place the file in your plugins directory. |
|
script versions (upload new version)
Click on the package to download.
supertab.vim |
0.60 |
2009-09-16 |
7.0 |
Eric Van Dewoestine |
- Refactored the contextual completion and default discovery support.
- Context completion now supports plugable functions to determine which
completion type to use.
- Default discovery is now a part of context completion.
- NOTE: Several non-backwards compatible configuration changes where made.
- 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.
Please see the updated "Global Variables" fold in supertab.vim for additional
details and examples. |
supertab.vim |
0.51 |
2009-07-11 |
7.0 |
Eric Van Dewoestine |
Replaced internal function s:IsWordChar with vim's keyword character class (Thanks to Ingo Karkat for the patch). |
supertab.vim |
0.50 |
2009-06-26 |
7.0 |
Eric Van Dewoestine |
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. |
supertab.vim |
0.49 |
2009-02-05 |
7.0 |
Eric Van Dewoestine |
fixed case where new buffer may not be initialized by super tab (thanks to Tammer Saleh for reporting the issue). |
supertab.vim |
0.48 |
2009-01-18 |
7.0 |
Eric Van Dewoestine |
Fixed command line completion (ctrl-x ctrl-v) when invoked from supertab. Thanks to Frank Chang for the patch. |
supertab.vim |
0.47 |
2009-01-11 |
7.0 |
Eric Van Dewoestine |
fixed issue with default completion discovery option if desired type is dependent on file type plugins. Thanks to Andreas Schneider for reporting the issue. |
supertab.vim |
0.46 |
2008-11-15 |
7.0 |
Eric Van Dewoestine |
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).
|
supertab.vim |
0.45 |
2007-12-18 |
6.0 |
Eric Van Dewoestine |
- fixed possible completion error on first buffer as supertab may not have been properly initialized (thanks to bill emmons for discovering the error). |
supertab.vim |
0.44 |
2007-11-08 |
6.0 |
Eric Van Dewoestine |
- 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)
- added config variables to changed the default mappings for forward backwards completion. (based on request by Li Chaoqun)
- added config variable to preselect the first entry when completeopt has 'menu' and 'longest'. (based on suggestion and patch by Mike Lundy) |
supertab.vim |
0.43 |
2007-07-12 |
6.0 |
Eric Van Dewoestine |
With the permission of the original author, this script is now released under the BSD license. |
supertab.vim |
0.42 |
2007-06-11 |
6.0 |
Eric Van Dewoestine |
- Added g:SuperTabMidWordCompletion variable to determine if completion should be done within a word (enabled by default). (based on request by Charles Gruenwald)
- Applied patch to fix <s-tab> cycling through completion results. (submitted by Lukasz Krotowski)
|
supertab.vim |
0.41 |
2006-08-30 |
6.0 |
Eric Van Dewoestine |
Initial upload |
|