Code Monkey home page Code Monkey logo

supertab's Introduction

Overview

Supertab is a vim plugin which allows you to use <Tab> for all your insert completion needs (:help ins-completion).

Features

  • Configurable to suit you needs:
    • Default completion type to use.
    • Prevent <Tab> from completing after/before defined patterns.
    • Close vim's completion preview window when code completion is finished.
    • When using other completion types, you can configure how long to 'remember' the current completion type before returning to the default.
    • Don't like using <Tab>? You can also configure a different pair of keys to scroll forwards and backwards through completion results.
  • Optional improved 'longest' completion support (after typing some characters, hitting <Tab> will highlight the next longest match).
  • Built in 'context' completion option which chooses the appropriate completion type based on the text preceding the cursor.
    • You can also plug in your own functions to determine which completion type to use.
  • Support for simple completion chaining (falling back to a different completion type, keyword completion for example, if omni or user completion returns no results).

Frequently Asked Questions

  • Why isn't supertab honoring my configured settings (attempts to complete at the start of a line, always performs keyword completion instead of my configured default, etc.)?

    Chances are that you have a very old version of snipmate installed, or something similar, which will issue a <c-n> when no snippet is found. Supertab use to map to <c-n>, so this behavior would act as a fallback to supertab, but current versions of supertab no longer do so, resulting in snipmate bypassing supertab entirely.

    You can check if this is the case by running the following in vim to see what is mapped to <tab>:

    :verbose imap <tab>
    

    To resolve the issue you can either:

    1. Install my fork or
    2. Upgrade to a more recent snipmate fork, like garbase/vim-snipmate

    See #74 for additional details.

  • Why does <tab> navigate the completion menu from bottom to top?

    First, if after reading the explaination below (or if you don't want to bother reading it), you still want the default to scroll down the list then you can use:

    let g:SuperTabDefaultCompletionType = "<c-n>"
    

    or if your default completion type is currently context then you can use this instead:

    let g:SuperTabContextDefaultCompletionType = "<c-n>"
    

    Now on the the reasoning behind this. When using <c-p> or <c-n> to start insert completion, both populate the completion popup with the same list of words in the same order, the only difference is that <c-p> highlights the nearest matching word located above the current cursor position, which is the result at the bottom of the completion popup. Without supertab installed, continuing to hit <c-p> will walk up the list to next nearest word above the cursor.

    I think Bram chose to display the results like this so that

    1. the completion logic is the same for <c-n> and <c-p>, only the first entry to highlight differs
    2. so that the behavior of <c-p> mode is consistent, always moving up the list and
    3. when starting <c-p> mode you don't have to switch over to using <c-n> to get the next nearest entry, just continue to hit <c-p>.

    So, with supertab I wanted to preserve the same behavior. If <c-p> is your default completion method (supertab defaults to this being the case), then <tab> will start it and additional uses of <tab> will move up the list instead of down so that you don't have to suddenly switch to using <s-tab> to get the next nearest result.

    Why is <c-p> the supertab default? The original supertab author found (and I agree with his finding) that while coding, the keyword match you want is typically the closer of the matches above the cursor, which <c-p> naturally provides.

supertab's People

Contributors

ervandew avatar talek avatar naudhr avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.