Using the Vim plugin

In this article, you'll learn how to access all the features the Vim plugin has to offer.

Prerequisites

The only prerequisites are that you have Kite Engine running and the Vim plugin installed. If you don't have the Vim plugin installed, you can learn how to do so here.

Note: If you installed the Vim plugin while Vim was running, you'll need to restart Vim for the plugin to activate.

Checking the status of Kite

To check if Kite is installed properly, add %{kite#statusline()} to your status line. If you don't have a status line, you can try the following:

set statusline=%<%f\ %h%m%r%{kite#statusline()}%=%-14.(%l,%c%V%)\ %P
set laststatus=2  " always display the status line

If Kite is installed properly, you should see a Kite status message.

There are a handful of possible states Kite can be in, as described in the following table:

Message Description
Kite: Not Installed Kite Engine is not installed.
Kite: Not running Kite Engine is not running.
Kite: Not logged in Kite Engine is running, but you need to log in.
Kite: Syncing Kite Engine is syncing your files to the cloud.
Kite: Indexing The Kite backend is analyzing your uploaded code.
Kite: Ready Kite is ready to go - start coding!
Note: If you're running Kite for the first time, it may take several minutes for Kite to finish syncing and indexing your codebase.

Writing code and accessing features

Completions

To start, open a Python file in a whitelisted directory. Make sure that this file has been saved with a .py extension. Now type the following code:

import j # Cursor stops behind the "j"

A list of suggested completions should automatically appear.

Kite can provide autocompletions for Python keywords, name expressions or attribute expressions. The example above illustrates a name expression completion. An example of an attribute completion would be:

import json
json.d # Cursor stops behind the "d"

In the case of name and attribute completions, Kite will also provide the type of value represented by the completion (e.g. module or function) as well as documentation if available.

Function signatures (beta)

Continuing with the example code above, complete the function call to by typing the opening and closing parentheses.

import json
json.dumps() # Cursor is in between "(" and ")"

Type <C-x> <C-u> while in insert mode and Kite should show you information about how to call json.dumps.

The signature shows the arguments that the function accepts. Keyword arguments will also have their default types shown. As you type, Kite will show you which argument you are currently focused on.

Expanding information

Kite also provides a UI to view more information about a Python identifier. To access this UI, position your cursor over an identifier and type K.

The information shown contains:

  • Information about the value
    • In this case, the panel shows information about the function signature for json.dumps
    • However, the information here varies depending on what the value is e.g. module, type, instance, etc.
  • Summary
    • This is the documentation for the value
  • Usages from your code (Kite Pro subscribers only)
    • This shows you where else in your codebase you have used this value
  • Examples
    • Curated code examples that show you how to use the value
  • Links
    • Links to popular questions about this value on StackOverflow

Sidebar

The Vim plugin also integrates with the coding dashboard. You can learn how to use the dashboard here.

With autosearch enabled, the dashboard will automatically update depending on the position of your cursor in Vim.