Commits

Nick Piepmeier committed a235ec7 Merge

Merged in state from bitbucket head.

Comments (0)

Files changed (4)

 *.pyc
 .*.swp
 vim/.netrwhist
+vim/plugin/perforce.vim
 vim/last-session.vim
 vim/google.vimrc
 .git

vim/personal.vimrc

 augroup END
 
 " to ignore .pyc files in NERDTree:
-let NERDTreeIgnore=['\.pyc$', '\.pyc-2\.4', '^tags$', '\~$']
+let NERDTreeIgnore=['\.pyc$', '\.pyc-2\.4', '^tags$', '\~$', '\.o$']
 
 command -nargs=0 ToggleProj call ToggleProjFun()
 function ToggleProjFun()
 " Third+ tabs cycle through results
 set wildmode=list:longest,full
 set wildmenu
-set wildignorecase
+if has("wildignorecase")
+  set wildignorecase
+endif
 
 " Remap ` to '
 nnoremap ' `

vim/plugin/perforce.vim

-" perforce.vim: Interface with perforce SCM through p4.
-" Author: Hari Krishna (hari_vim at yahoo dot com)
-" Last Change: 02-Sep-2006 @ 19:56
-" Created:     Sometime before 20-Apr-2001
-" Requires:    Vim-7.0, genutils.vim(2.3)
-" Version:     4.1.3
-" Licence: This program is free software; you can redistribute it and/or
-"          modify it under the terms of the GNU General Public License.
-"          See http://www.gnu.org/copyleft/gpl.txt 
-" Acknowledgements:
-"     See ":help perforce-acknowledgements".
-" Download From:
-"     http://www.vim.org//script.php?script_id=240
-" Usage:
-"     For detailed help, see ":help perforce" or read doc/perforce.txt. 
-"
-" TODO: {{{
-"   - Launch from describe window is not using the local path.
-"
-"   - I need a test suite to stop things from breaking.
-"   - Should the client returned by g:p4CurPresetExpr be made permanent?
-"   - curPresetExpr can't support password, so how is the expression going to
-"     change password?
-"   - If you actually use python to execute, you may be able to display the
-"     output incrementally.
-"   - There seems to be a problem with 'autoread' change leaking. Not sure if
-"     we explicitly set it somewhere, check if we are using try block.
-"   - Buffer local autocommads are pretty useful for perforce plugin, send
-"     feedback.
-"   - Verify that the buffers/autocommands are not leaking.
-" TODO }}}
-"
-" BEGIN NOTES {{{
-"   - Now that we increase the level of escaping in the ParseOptions(), we
-"     need to be careful in reparsing the options (by not using
-"     scriptOrigin=2). When you CreateArgString() using these escaped
-"     arguments as if they were typed in by user, they get sent to p4 as they
-"     are, with incorrect number of back-slashes.
-"   - When issuing sub-commands, we should remember to use the s:p4Options
-"     that was passed to the main command (unless the main command already
-"     generated a new window, in which case the original s:p4Options are
-"     remembered through b:p4Options and automatically reused for the
-"     subcommands), or the user will see incorrect behavior or at the worst,
-"     errors.
-"   - The p4FullCmd now can have double-quotes surrounding each of the
-"     individual arguments if the shell is cmd.exe or command.com, so while
-"     manipulating it directly, we need to use "\?.
-"   - With the new mode of scriptOrigin=2, the changes done to the s:p4*
-"     variables will not get reflected in the s:p4WinName, unless there is
-"     some other relevant processing done in PFIF.
-"   - With the new mode of scriptOrigin=2, there is no reason to use
-"     scriptOrigin=1 in most of the calls from handlers.
-"   - The s:PFSetupBufAutoCommand and its cousines expect the buffer name to
-"     be plain with no escaping, as they do their own escaping.
-"   - Wherever we normally expect a depot name, we should use the s:p4Depot
-"     instead of hardcoded 'depot'. We should also consider the client name
-"     here.
-"   - Eventhough DefFileChangedShell event handling is now localized, we still
-"     need to depend on s:currentCommand to determine the 'autoread' value,
-"     this is because some other plugin might have already installed a
-"     FileChangedShell event to DefFileChangedShell, resulting in us receiving
-"     callbacks anytime, so we need a variable that has a lifespace only for
-"     the duration of the execution of p4 commands?
-"   - We need to pass special characters such as <space>, *, ?, [, (, &, |, ', $
-"     and " to p4 without getting interpreted by the shell. We may have to use
-"     appropriate quotes around the characters when the shell treats them
-"     specially. Windows+native is the least bothersome of all as it doesn't
-"     treat most of the characters specially and the arguments can be
-"     sorrounded in double-quotes and embedded double-quotes can be easily
-"     passed in by just doubling them.
-"   - I am aware of the following unique ways in which external commands are
-"     executed (not sure if this is same for all of the variations possible: 
-"     ":[{range}][read|write]!cmd | filter" and "system()"):
-"     For :! command 
-"       On Windoze+native:
-"         cmd /c <command>
-"       On Windoze+sh:
-"         sh -c "<command>"
-"       On Unix+sh:
-"         sh -c (<command>) 
-"   - By the time we parse arguments, we protect all the back-slashes, which
-"     means that we would never see a single-back-slash.
-"   - Using back-slashes on Cygwin vim is unique and causes E303. This is
-"     because it thinks it is on UNIX where it is not a special character, but
-"     underlying Windows obviously treats it special and so it bails out.
-"   - Using back-slashes on Windows+sh also seems to be different. Somewhere in
-"     the execution line (most probably the path from CreateProcess() to sh,
-"     as it doesn't happen in all other types of interfaces) consumes one
-"     level of extra back-slashes. If it is even number it becomes half, and
-"     if it is odd then the last unpaired back-slash is left as it is.
-"   - Some test cases for special character handling:
-"     - PF fstat a\b
-"     - PF fstat a\ b
-"     - PF fstat a&b
-"     - PF fstat a\&b
-"     - PF fstat a\#b
-"     - PF fstat a\|b
-"   - Careful using s:PFIF(1) from within script, as it doesn't redirect the
-"     call to the corresponding handler (if any).
-"   - Careful using ":PF" command from within handlers, especially if you are
-"     executing the same s:p4Command again as it will result in a recursion.
-"   - The outputType's -2 and -1 are local to the s:PFrangeIF() interface, the
-"     actual s:PFImpl() or any other methods shouldn't know anything about it.
-"     Which is why this outputType should be used only for those commands that
-"     don't have a handler. Besides this scheme will not even work if a
-"     handler exists, as the outputType will get permanently set to 4 by the
-"     time it gets redirected back to s:PFrangeIF() through the handler. (If
-"     this should ever be a requirement, we will need another state variable
-"     called s:orgOutputType.)
-"   - Be careful to pass argument 0 to s:PopP4Context() whenever the logical
-"     p4 operation ends, to avoid getting the s:errCode carried over. This is
-"     currently taken care of for all the known recursive or ignorable error
-"     cases.
-"   - We need to use s:outputType as much as possible, not a:outputType, which
-"     is there only to pass it on to s:ParseOptions(). After calling s:PFIF()
-"     the outputType is established in s:outputType.
-"   - s:errCode is reset by ParseOptions(). For cases that Push and Pop context
-"     even before the first call to ParseOptions() (such as the
-"     s:GetClientInfo() function), we have to check for s:errCode before we
-"     pop context, or we will just carry on an error code from a previous bad
-"     run (applies to mostly utility functions).
-" END NOTES }}}
-
-if exists('loaded_perforce')
-  finish
-endif
-if v:version < 700
-  echomsg 'Perforce: You need at least Vim 7.0'
-  finish
-endif
-
-
-" We need these scripts at the time of initialization itself.
-if !exists('loaded_genutils')
-  runtime plugin/genutils.vim
-endif
-if !exists('loaded_genutils') || loaded_genutils < 203
-  echomsg 'perforce: You need a newer version of genutils.vim plugin'
-  finish
-endif
-let loaded_perforce=400
-
-" Make sure line-continuations won't cause any problem. This will be restored
-"   at the end
-let s:save_cpo = &cpo
-set cpo&vim
-
-" User option initialization {{{
-function! s:CondDefSetting(settingName, def)
-  if !exists(a:settingName)
-    let {a:settingName} = a:def
-  endif
-endfunction
- 
-call s:CondDefSetting('g:p4CmdPath', 'p4')
-call s:CondDefSetting('g:p4ClientRoot', '')
-call s:CondDefSetting('g:p4DefaultListSize', '100')
-call s:CondDefSetting('g:p4DefaultDiffOptions', '')
-call s:CondDefSetting('g:p4DefaultPreset', -1)
-call s:CondDefSetting('g:p4Depot', 'depot')
-call s:CondDefSetting('g:p4Presets', '')
-call s:CondDefSetting('g:p4DefaultOptions', '')
-call s:CondDefSetting('g:p4UseGUIDialogs', 0)
-call s:CondDefSetting('g:p4PromptToCheckout', 1)
-call s:CondDefSetting('g:p4MaxLinesInDialog', 1)
-call s:CondDefSetting('g:p4EnableActiveStatus', 1)
-call s:CondDefSetting('g:p4ASIgnoreDefPattern',
-      \'\c\%(\<t\%(e\)\?mp\/.*\|^.*\.tmp$\|^.*\.log$\|^.*\.diff\?$\|^.*\.out$\|^.*\.buf$\|^.*\.bak$\)\C')
-call s:CondDefSetting('g:p4ASIgnoreUsrPattern', '')
-call s:CondDefSetting('g:p4OptimizeActiveStatus', 1)
-call s:CondDefSetting('g:p4EnableRuler', 1)
-call s:CondDefSetting('g:p4RulerWidth', 25)
-call s:CondDefSetting('g:p4EnableMenu', 0)
-call s:CondDefSetting('g:p4EnablePopupMenu', 0)
-call s:CondDefSetting('g:p4UseExpandedMenu', 1)
-call s:CondDefSetting('g:p4UseExpandedPopupMenu', 0)
-call s:CondDefSetting('g:p4CheckOutDefault', 3)
-call s:CondDefSetting('g:p4SortSettings', 1)
-" Probably safer than reading $TEMP.
-call s:CondDefSetting('g:p4TempDir', fnamemodify(tempname(), ':h'))
-call s:CondDefSetting('g:p4SplitCommand', 'split')
-call s:CondDefSetting('g:p4EnableFileChangedShell', 1)
-call s:CondDefSetting('g:p4UseVimDiff2', 0)
-call s:CondDefSetting('g:p4BufHidden', 'wipe')
-call s:CondDefSetting('g:p4Autoread', 1)
-call s:CondDefSetting('g:p4FileLauncher', '')
-call s:CondDefSetting('g:p4CurPresetExpr', '')
-call s:CondDefSetting('g:p4CurDirExpr', '')
-call s:CondDefSetting('g:p4UseClientViewMap', 1)
-delfunction s:CondDefSetting
-" }}}
-
-
-" Call this any time to reconfigure the environment. This re-performs the same
-"   initializations that the script does during the vim startup, without
-"   loosing what is already configured.
-command! -nargs=0 PFInitialize :call perforce#Initialize(0)
-
-""" The following are some shortcut commands. Some of them are enhanced such
-"""   as the help window or the filelog window.
-
-" Command definitions {{{
-
-command! -nargs=* -complete=custom,perforce#PFComplete PP
-      \ :call perforce#PFIF(0, 0, 'print', <f-args>)
-command! -nargs=* -complete=custom,perforce#PFComplete PPrint
-      \ :call perforce#PFIF(0, 0, 'print', <f-args>)
-command! -nargs=* -complete=custom,perforce#PFComplete PDiff
-      \ :call perforce#PFIF(0, 0, 'diff', <f-args>)
-command! -nargs=* -complete=custom,perforce#PFComplete PD
-      \ :PDiff <args>
-command! -nargs=* -complete=custom,perforce#PFComplete PEdit
-      \ :call perforce#PFIF(0, 2, 'edit', <f-args>)
-command! -nargs=* -complete=custom,perforce#PFComplete PE
-      \ :PEdit <args>
-command! -nargs=* -complete=custom,perforce#PFComplete PReopen
-      \ :call perforce#PFIF(0, 2, 'reopen', <f-args>)
-command! -nargs=* -complete=custom,perforce#PFComplete PAdd
-      \ :call perforce#PFIF(0, 2, 'add', <f-args>)
-command! -nargs=* -complete=custom,perforce#PFComplete PA
-      \ :PAdd <args>
-command! -nargs=* -complete=custom,perforce#PFComplete PDelete
-      \ :call perforce#PFIF(0, 2, 'delete', <f-args>)
-command! -nargs=* -complete=custom,perforce#PFComplete PLock
-      \ :call perforce#PFIF(0, 2, 'lock', <f-args>)
-command! -nargs=* -complete=custom,perforce#PFComplete PUnlock
-      \ :call perforce#PFIF(0, 2, 'unlock', <f-args>)
-command! -nargs=* -complete=custom,perforce#PFComplete PRevert
-      \ :call perforce#PFIF(0, 2, 'revert', <f-args>)
-command! -nargs=* -complete=custom,perforce#PFComplete PR
-      \ :PRevert <args>
-command! -nargs=* -complete=custom,perforce#PFComplete PSync
-      \ :call perforce#PFIF(0, 2, 'sync', <f-args>)
-command! -nargs=* -complete=custom,perforce#PFComplete PG
-      \ :PSync <args>
-command! -nargs=* -complete=custom,perforce#PFComplete PGet
-      \ :call perforce#PFIF(0, 2, 'get', <f-args>)
-command! -nargs=* -complete=custom,perforce#PFComplete POpened
-      \ :call perforce#PFIF(0, 0, 'opened', <f-args>)
-command! -nargs=* -complete=custom,perforce#PFComplete PO
-      \ :POpened <args>
-command! -nargs=* -complete=custom,perforce#PFComplete PHave
-      \ :call perforce#PFIF(0, 0, 'have', <f-args>)
-command! -nargs=* -complete=custom,perforce#PFComplete PWhere
-      \ :call perforce#PFIF(0, 0, 'where', <f-args>)
-command! -nargs=* -complete=custom,perforce#PFComplete PDescribe
-      \ :call perforce#PFIF(0, 0, 'describe', <f-args>)
-command! -nargs=* -complete=custom,perforce#PFComplete PFiles
-      \ :call perforce#PFIF(0, 0, 'files', <f-args>)
-command! -nargs=* -complete=custom,perforce#PFComplete PLabelsync
-      \ :call perforce#PFIF(0, 0, 'labelsync', <f-args>)
-command! -nargs=* -complete=custom,perforce#PFComplete PFilelog
-      \ :call perforce#PFIF(0, 0, 'filelog', <f-args>)
-command! -nargs=* -complete=custom,perforce#PFComplete PIntegrate
-      \ :call perforce#PFIF(0, 0, 'integrate', <f-args>)
-command! -nargs=* -complete=custom,perforce#PFComplete PDiff2
-      \ :call perforce#PFIF(0, 0, 'diff2', <f-args>)
-command! -nargs=* -complete=custom,perforce#PFComplete PD2
-      \ :PDiff2 <args>
-command! -nargs=* -complete=custom,perforce#PFComplete PFstat
-      \ :call perforce#PFIF(0, 0, 'fstat', <f-args>)
-command! -nargs=* -complete=custom,perforce#PFComplete PHelp
-      \ :call perforce#PFIF(0, 0, 'help', <f-args>)
-command! -nargs=* -complete=custom,perforce#PFComplete PH
-      \ :PHelp <args>
-command! -nargs=* PPasswd
-      \ :call perforce#PFIF(0, 2, 'passwd', <f-args>)
-
-
-""" Some list view commands.
-command! -nargs=* -complete=custom,perforce#PFComplete PChanges
-      \ :call perforce#PFIF(0, 0, 'changes', <f-args>)
-command! -nargs=* -complete=custom,perforce#PFComplete PBranches
-      \ :call perforce#PFIF(0, 0, 'branches', <f-args>)
-command! -nargs=* -complete=custom,perforce#PFComplete PLabels
-      \ :call perforce#PFIF(0, 0, 'labels', <f-args>)
-command! -nargs=* -complete=custom,perforce#PFComplete PClients
-      \ :call perforce#PFIF(0, 0, 'clients', <f-args>)
-command! -nargs=* -complete=custom,perforce#PFComplete PUsers
-      \ :call perforce#PFIF(0, 0, 'users', <f-args>)
-command! -nargs=* -complete=custom,perforce#PFComplete PJobs
-      \ :call perforce#PFIF(0, 0, 'jobs', <f-args>)
-command! -nargs=* -complete=custom,perforce#PFComplete PDepots
-      \ :call perforce#PFIF(0, 0, 'depots', <f-args>)
-command! -nargs=* -complete=custom,perforce#PFComplete PGroups
-      \ :call perforce#PFIF(0, 0, 'groups', <f-args>)
-
-
-""" The following support some p4 operations that normally involve some
-"""   interaction with the user (they are more than just shortcuts).
-
-command! -nargs=* -complete=custom,perforce#PFComplete PChange
-      \ :call perforce#PFIF(0, 0, 'change', <f-args>)
-command! -nargs=* -complete=custom,perforce#PFComplete PBranch
-      \ :call perforce#PFIF(0, 0, 'branch', <f-args>)
-command! -nargs=* -complete=custom,perforce#PFComplete PLabel
-      \ :call perforce#PFIF(0, 0, 'label', <f-args>)
-command! -nargs=* -complete=custom,perforce#PFComplete PClient
-      \ :call perforce#PFIF(0, 0, 'client', <f-args>)
-command! -nargs=* -complete=custom,perforce#PFComplete PUser
-      \ :call perforce#PFIF(0, 0, 'user', <f-args>)
-command! -nargs=* -complete=custom,perforce#PFComplete PJob
-      \ :call perforce#PFIF(0, 0, 'job', <f-args>)
-command! -nargs=* -complete=custom,perforce#PFComplete PJobspec
-      \ :call perforce#PFIF(0, 0, 'jobspec', <f-args>)
-command! -nargs=* -complete=custom,perforce#PFComplete PDepot
-      \ :call perforce#PFIF(0, 0, 'depot', <f-args>)
-command! -nargs=* -complete=custom,perforce#PFComplete PGroup
-      \ :call perforce#PFIF(0, 0, 'group', <f-args>)
-command! -nargs=* -complete=custom,perforce#PFComplete PSubmit
-      \ :call perforce#PFIF(0, 0, 'submit', <f-args>)
-command! -nargs=* -complete=custom,perforce#PFComplete PResolve
-      \ :call perforce#PFIF(0, 0, 'resolve', <f-args>)
-
-" Some built-in commands.
-command! -nargs=* -complete=custom,perforce#PFComplete PVDiff
-      \ :call perforce#PFIF(0, 0, 'vdiff', <f-args>)
-command! -nargs=* -complete=custom,perforce#PFComplete PVDiff2
-      \ :call perforce#PFIF(0, 0, 'vdiff2', <f-args>)
-command! -nargs=* -complete=custom,perforce#PFComplete PExec
-      \ :call perforce#PFIF(0, 5, 'exec', <f-args>)
-
-""" Other utility commands.
-
-command! -nargs=* -complete=file E :call perforce#PFOpenAltFile(0, <f-args>)
-command! -nargs=* -complete=file ES :call perforce#PFOpenAltFile(2, <f-args>)
-command! -nargs=* -complete=custom,perforce#PFSwitchComplete PFSwitch
-      \ :call perforce#PFSwitch(1, <f-args>)
-command! -nargs=* PFSwitchPortClientUser :call perforce#SwitchPortClientUser()
-command! -nargs=0 PFRefreshActivePane :call perforce#PFRefreshActivePane()
-command! -nargs=0 PFRefreshFileStatus :call perforce#GetFileStatus(0, 1)
-command! -nargs=0 PFToggleCkOut :call perforce#ToggleCheckOutPrompt(1)
-command! -nargs=* -complete=custom,perforce#PFSettingsComplete PFS
-      \ :PFSettings <args>
-command! -nargs=* -complete=custom,perforce#PFSettingsComplete PFSettings
-      \ :call perforce#PFSettings(<f-args>)
-command! -nargs=0 PFDiffOff :call perforce#PFDiffOff(
-      \ exists('w:p4VDiffWindow') ? w:p4VDiffWindow : -1)
-command! -nargs=? PFWipeoutBufs :call perforce#WipeoutP4Buffers(<f-args>)
-"command! -nargs=* -complete=file -range=% PF
-command! -nargs=* -complete=custom,perforce#PFComplete -range=% PF
-      \ :call perforce#PFrangeIF(<line1>, <line2>, 0, 0, <f-args>)
-command! -nargs=* -complete=file PFRaw :call perforce#PFRaw(<f-args>)
-command! -nargs=* -complete=custom,perforce#PFComplete -range=% PW
-      \ :call perforce#PW(<line1>, <line2>, 0, <f-args>)
-command! -nargs=0 PFLastMessage :call perforce#LastMessage()
-command! -nargs=0 PFBugReport :runtime perforce/perforcebugrep.vim
-command! -nargs=0 PFUpdateViews :call perforce#UpdateViewMappings()
-
-" New normal mode mappings.
-if (! exists('no_plugin_maps') || ! no_plugin_maps) &&
-      \ (! exists('no_perforce_maps') || ! no_execmap_maps)
-  nnoremap <silent> <Leader>prap :PFRefreshActivePane<cr>
-  nnoremap <silent> <Leader>prfs :PFRefreshFileStatus<cr>
-
-  " Some generic mappings.
-  if maparg('<C-X><C-P>', 'c') == ""
-    cnoremap <C-X><C-P> <C-R>=perforce#PFOpenAltFile(1)<CR>
-  endif
-endif
-
-" Command definitions }}}
-
-if exists('g:p4EnableActiveStatus') && g:p4EnableActiveStatus
-  aug P4Init
-    au!
-    au BufRead * exec 'au! P4Init' | exec 'PFInitialize' | PFRefreshFileStatus
-  aug END
-endif
-
-" Restore cpo.
-let &cpo = s:save_cpo
-unlet s:save_cpo
-
-" vim6:fdm=marker et sw=2
+" Vimball Archiver by Charles E. Campbell, Jr., Ph.D.
+UseVimball
+finish
+doc/supertab.txt	[[[1
+308
+*supertab.txt*
+
+Authors:
+  Original: Gergely Kontra <kgergely@mcl.hu>
+  Current:  Eric Van Dewoestine <ervandew@gmail.com> (as of version 0.4)
+
+Contributors:
+  Christophe-Marie Duquesne <chm.duquesne@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:
+plugin/supertab.vim	[[[1
+510
+" Author:
+"   Original: Gergely Kontra <kgergely@mcl.hu>
+"   Current:  Eric Van Dewoestine <ervandew@gmail.com> (as of version 0.4)
+"   Please direct all correspondence to Eric.
+" Version: 1.0
+" GetLatestVimScripts: 1643 1 :AutoInstall: supertab.vim
+"
+" Description: {{{
+"   Use your tab key to do all your completion in insert mode!
+"   You can cycle forward and backward with the <Tab> and <S-Tab> keys
+"   Note: you must press <Tab> once to be able to cycle back
+"
+"   http://www.vim.org/scripts/script.php?script_id=1643
+" }}}
+"
+" License: {{{
+"   Software License Agreement (BSD License)
+"
+"   Copyright (c) 2002 - 2009
+"   All rights reserved.
+"
+"   Redistribution and use of this software in source and binary forms, with
+"   or without modification, are permitted provided that the following
+"   conditions are met:
+"
+"   * Redistributions of source code must retain the above
+"     copyright notice, this list of conditions and the
+"     following disclaimer.
+"
+"   * Redistributions in binary form must reproduce the above
+"     copyright notice, this list of conditions and the
+"     following disclaimer in the documentation and/or other
+"     materials provided with the distribution.
+"
+"   * Neither the name of Gergely Kontra or Eric Van Dewoestine nor the names
+"   of its contributors may be used to endorse or promote products derived
+"   from this software without specific prior written permission of Gergely
+"   Kontra or Eric Van Dewoestine.
+"
+"   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+"   IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+"   THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+"   PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+"   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+"   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+"   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+"   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+"   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+"   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+"   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+" }}}
+"
+" Testing Info: {{{
+"   Running vim + supertab with the absolute bar minimum settings:
+"     $ vim -u NONE -U NONE -c "set nocp | runtime plugin/supertab.vim"
+" }}}
+
+if v:version < 700
+  finish
+endif
+
+if exists('complType') " Integration with other completion functions.
+  finish
+endif
+
+let s:save_cpo=&cpo
+set cpo&vim
+
+" Global Variables {{{
+
+  if !exists("g:SuperTabDefaultCompletionType")
+    let g:SuperTabDefaultCompletionType = "<c-p>"
+  endif
+
+  if !exists("g:SuperTabContextDefaultCompletionType")
+    let g:SuperTabContextDefaultCompletionType = "<c-p>"
+  endif
+
+  if !exists("g:SuperTabCompletionContexts")
+    let g:SuperTabCompletionContexts = ['s:ContextText']
+  endif
+
+  if !exists("g:SuperTabRetainCompletionDuration")
+    let g:SuperTabRetainCompletionDuration = 'insert'
+  endif
+
+  if !exists("g:SuperTabMidWordCompletion")
+    let g:SuperTabMidWordCompletion = 1
+  endif
+
+  if !exists("g:SuperTabMappingForward")
+    let g:SuperTabMappingForward = '<tab>'
+  endif
+  if !exists("g:SuperTabMappingBackward")
+    let g:SuperTabMappingBackward = '<s-tab>'
+  endif
+
+  if !exists("g:SuperTabMappingTabLiteral")
+    let g:SuperTabMappingTabLiteral = '<c-tab>'
+  endif
+
+  if !exists("g:SuperTabLongestHighlight")
+    let g:SuperTabLongestHighlight = 0
+  endif
+
+" }}}
+
+" Script Variables {{{
+
+  " construct the help text.
+  let s:tabHelp =
+    \ "Hit <CR> or CTRL-] on the completion type you wish to switch to.\n" .
+    \ "Use :help ins-completion for more information.\n" .
+    \ "\n" .
+    \ "|<c-n>|      - Keywords in 'complete' searching down.\n" .
+    \ "|<c-p>|      - Keywords in 'complete' searching up (SuperTab default).\n" .
+    \ "|<c-x><c-l>| - Whole lines.\n" .
+    \ "|<c-x><c-n>| - Keywords in current file.\n" .
+    \ "|<c-x><c-k>| - Keywords in 'dictionary'.\n" .
+    \ "|<c-x><c-t>| - Keywords in 'thesaurus', thesaurus-style.\n" .
+    \ "|<c-x><c-i>| - Keywords in the current and included files.\n" .
+    \ "|<c-x><c-]>| - Tags.\n" .
+    \ "|<c-x><c-f>| - File names.\n" .
+    \ "|<c-x><c-d>| - Definitions or macros.\n" .
+    \ "|<c-x><c-v>| - Vim command-line.\n" .
+    \ "|<c-x><c-u>| - User defined completion.\n" .
+    \ "|<c-x><c-o>| - Omni completion.\n" .
+    \ "|<c-x>s|     - Spelling suggestions."
+
+  " set the available completion types and modes.
+  let s:types =
+    \ "\<c-e>\<c-y>\<c-l>\<c-n>\<c-k>\<c-t>\<c-i>\<c-]>" .
+    \ "\<c-f>\<c-d>\<c-v>\<c-n>\<c-p>\<c-u>\<c-o>\<c-n>\<c-p>s"
+  let s:modes = '/^E/^Y/^L/^N/^K/^T/^I/^]/^F/^D/^V/^P/^U/^O/s'
+  let s:types = s:types . "np"
+  let s:modes = s:modes . '/n/p'
+
+" }}}
+
+" 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
+
+  let b:SuperTabDefaultCompletionType = a:type
+
+  " set the current completion type to the default
+  call SuperTabSetCompletionType(b:SuperTabDefaultCompletionType)
+endfunction " }}}
+
+" SuperTabSetCompletionType(type) {{{
+" 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()
+  augroup supertab_init
+    autocmd!
+    autocmd BufEnter * call <SID>InitBuffer()
+  augroup END
+
+  " ensure InitBuffer gets called for the first buffer, after the ftplugins
+  " have been called.
+  augroup supertab_init_first
+    autocmd!
+    autocmd FileType <buffer> call <SID>InitBuffer()
+  augroup END
+
+  " Setup mechanism to restore orignial completion type upon leaving insert
+  " mode if configured to do so
+  if g:SuperTabRetainCompletionDuration == 'insert'
+    augroup supertab_retain
+      autocmd!
+      autocmd InsertLeave * call s:SetDefaultCompletionType()
+    augroup END
+  endif
+endfunction " }}}
+
+" s:InitBuffer {{{
+" Per buffer initilization.
+function! s:InitBuffer()
+  if exists("b:complType")
+    return
+  endif
+
+  " init hack for <c-x><c-v> workaround.
+  let b:complCommandLine = 0
+
+  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
+
+    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
+
+  echohl "Unknown mode"
+  return complType
+endfunction " }}}
+
+" s:SetCompletionType() {{{
+" Sets the completion type based on what the user has chosen from the help
+" buffer.
+function! s:SetCompletionType()
+  let chosen = substitute(getline('.'), '.*|\(.*\)|.*', '\1', '')
+  if chosen != getline('.')
+    let winnr = b:winnr
+    close
+    exec winnr . 'winc w'
+    call SuperTabSetCompletionType(chosen)
+  endif
+endfunction " }}}
+
+" s:SetDefaultCompletionType() {{{
+function! s:SetDefaultCompletionType()
+  if exists('b:SuperTabDefaultCompletionType') &&
+  \ (!exists('b:complCommandLine') || !b:complCommandLine)
+    call SuperTabSetCompletionType(b:SuperTabDefaultCompletionType)
+  endif
+endfunction " }}}
+
+" s:SuperTab(command) {{{
+" Used to perform proper cycle navigation as the user requests the next or
+" previous entry in a completion list, and determines whether or not to simply
+" retain the normal usage of <tab> based on the cursor position.
+function! s:SuperTab(command)
+  if s:WillComplete()
+    " rare case where no autocmds have fired for this buffer to initialize the
+    " supertab vars.
+    call s:InitBuffer()
+
+    let key = ''
+    " highlight first result if longest enabled
+    if g:SuperTabLongestHighlight && !pumvisible() && &completeopt =~ 'longest'
+      let key = (b:complType == "\<c-p>") ? "\<c-p>" : "\<c-n>"
+    endif
+
+    " exception: if in <c-p> mode, then <c-n> should move up the list, and
+    " <c-p> down the list.
+    if a:command == 'p' &&
+      \ (b:complType == "\<c-p>" ||
+      \   (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.
+    if b:complType == 'context'
+      let complType = s:ContextCompletion()
+      if complType == ''
+        exec "let complType = \"" .
+          \ escape(g:SuperTabContextDefaultCompletionType, '<') . "\""
+      endif
+      return complType . key
+    endif
+
+    " Hack to workaround bug when invoking command line completion via <c-r>=
+    if b:complType == "\<c-x>\<c-v>"
+      return s:CommandLineCompletion()
+    endif
+    return b:complType . key
+  endif
+
+  return "\<tab>"
+endfunction " }}}
+
+" s:SuperTabHelp() {{{
+" Opens a help window where the user can choose a completion type to enter.
+function! s:SuperTabHelp()
+  let winnr = winnr()
+  if bufwinnr("SuperTabHelp") == -1
+    botright split SuperTabHelp
+
+    setlocal noswapfile
+    setlocal buftype=nowrite
+    setlocal bufhidden=delete
+
+    let saved = @"
+    let @" = s:tabHelp
+    silent put
+    call cursor(1, 1)
+    silent 1,delete
+    call cursor(4, 1)
+    let @" = saved
+    exec "resize " . line('$')
+
+    syntax match Special "|.\{-}|"
+
+    setlocal readonly
+    setlocal nomodifiable
+
+    nmap <silent> <buffer> <cr> :call <SID>SetCompletionType()<cr>
+    nmap <silent> <buffer> <c-]> :call <SID>SetCompletionType()<cr>
+  else
+    exec bufwinnr("SuperTabHelp") . "winc w"
+  endif
+  let b:winnr = winnr
+endfunction " }}}
+
+" s:WillComplete() {{{
+" Determines if completion should be kicked off at the current location.
+function! s:WillComplete()
+  let line = getline('.')
+  let cnum = col('.')
+
+  " Start of line.
+  let prev_char = strpart(line, cnum - 2, 1)
+  if prev_char =~ '^\s*$'
+    return 0
+  endif
+
+  " Within a word, but user does not have mid word completion enabled.
+  let next_char = strpart(line, cnum - 1, 1)
+  if !g:SuperTabMidWordCompletion && next_char =~ '\k'
+    return 0
+  endif
+
+  " In keyword completion mode and no preceding word characters.
+  "if (b:complType == "\<c-n>" || b:complType == "\<c-p>") && prev_char !~ '\k'
+  "  return 0
+  "endif
+
+  return 1
+endfunction " }}}
+
+" s:CommandLineCompletion() {{{
+" Hack needed to account for apparent bug in vim command line mode completion
+" when invoked via <c-r>=
+function! s:CommandLineCompletion()
+  " This hack will trigger InsertLeave which will then invoke
+  " s:SetDefaultCompletionType.  To prevent default completion from being
+  " restored prematurely, set an internal flag for s:SetDefaultCompletionType
+  " to check for.
+  let b:complCommandLine = 1
+  return "\<c-\>\<c-o>:call feedkeys('\<c-x>\<c-v>\<c-v>', 'n') | " .
+    \ "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>=<SID>ManualCompletionEnter()<cr>
+
+  " From the doc |insert.txt| improved
+  exec 'imap ' . g:SuperTabMappingForward . ' <c-n>'
+  exec 'imap ' . g:SuperTabMappingBackward . ' <c-p>'
+
+  " After hitting <Tab>, hitting it once more will go to next match
+  " (because in XIM mode <c-n> and <c-p> mappings are ignored)
+  " and wont start a brand new completion
+  " The side effect, that in the beginning of line <c-n> and <c-p> inserts a
+  " <Tab>, but I hope it may not be a problem...
+  inoremap <c-n> <c-r>=<SID>SuperTab('n')<cr>
+  inoremap <c-p> <c-r>=<SID>SuperTab('p')<cr>
+" }}}
+
+" Command Mappings {{{
+  if !exists(":SuperTabHelp")
+    command SuperTabHelp :call <SID>SuperTabHelp()
+  endif
+" }}}
+
+call s:Init()
+
+let &cpo = s:save_cpo
+
+" vim:ft=vim:fdm=marker