Atom install kite tool for vim

This commit is contained in:
Jeff Lance 2019-09-25 20:39:22 +02:00
parent 71d7aabf98
commit 2d35d0bb8a
12 changed files with 361 additions and 0 deletions

View File

@ -0,0 +1,36 @@
dist: trusty
env:
global:
- DEPS=$HOME/deps
- PATH=$DEPS/bin:$PATH
before_install:
- sudo apt-get install python-pip
- pip install --user awscli
- export PATH="$PATH:$HOME/.local/bin"
- curl --silent -L "https://s3-us-west-1.amazonaws.com/kite-data/tensorflow/libtensorflow-cpu-linux-x86_64-1.9.0.tar.gz" | tar -C $HOME -xz
- curl --silent --compressed --output "$HOME/kited-test" "https://s3-us-west-1.amazonaws.com/kited-test/linux/kited-test"
- chmod u+x "$HOME/kited-test"
install: |
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
C_OPTS="--prefix=$DEPS --with-features=huge --disable-gui "
git clone --depth 1 https://github.com/vim/vim
cd vim
export PATH=/usr/bin:$PATH
./configure $C_OPTS
make
make install
cd -
export PATH=$DEPS/bin:$PATH
export VIM="$(which vim)"
script:
- vim --version
- cd test && bash test
- export LD_LIBRARY_PATH="$HOME/lib:$LD_LIBRARY_PATH"
- echo "Running tests with kited-local --------------" && $HOME/kited-test > ~/kite.log 2>&1 & sleep 20 && bash editor_tests && killall kited-test

View File

@ -0,0 +1,30 @@
# Installation
## Manual installation
### Vim
Assuming your Vim configuration is in `~/.vim/`:
```sh
$ mkdir -p ~/.vim/pack/kite/start/kite
$ git clone https://github.com/kiteco/vim-plugin.git ~/.vim/pack/kite/start/kite/
```
Restart Vim.
### Neovim
Assuming your Neovim configuration is in `~/.config/nvim`:
```sh
$ mkdir -p ~/.config/nvim/pack/kite/start/kite
$ git clone https://github.com/kiteco/vim-plugin.git ~/.config/nvim/pack/kite/start/kite/
```
Restart Neovim.
# Development
When working on the plugin, ensure the file `~/.kite/vim-development` (or `$LOCALAPPDATA$\Kite\vim-development` on Windows) is present. This tells the plugin to use development mode, i.e. to use the non-production key when POSTing metrics to Segment.

View File

@ -0,0 +1,4 @@
Copyright (c) 2017 Manhattan Engineering, Inc - All Rights Reserved
Reproduction of this material is strictly forbidden unless prior written
permission is obtained from Manhattan Engineering, Inc.

View File

@ -0,0 +1,158 @@
# Vim/Neovim plugin for Kite
### Features
- [Integrates with Kite Copilot (macOS)](#kite-copilot)
- [Completions](#completions)
- [Documentation](#documentation)
- [Statusline](#statusline)
### Installation
Requires Vim 8 or NeoVim.
Download Kite from https://kite.com. During Kite's installation process, select Vim and/or Neovim in the list of editors and Kite will install this plugin for you.
Kite will also keep the plugin up to date automatically.
[Learn more about Kite for Vim.](https://www.kite.com/integrations/vim)
### Kite Copilot
As you edit your code in Vim/Neovim, the Kite Copilot will show completions, examples, and docs for the code under the cursor.
### Completions
Kite's ranked completions are integrated with Vim's insert-mode completion, specifically the user-defined completion. Kite shows normal completions or signature-completions as appropriate for the cursor position.
By default Kite's completions will show up automatically as you type. You can opt out via:
```viml
let g:kite_auto_complete=0
```
You can manually invoke the completions in insert mode with `<C-X><C-U>`. See `:h i_CTRL-X_CTRL-U` for details.
Kite's completions include snippets by default. To opt out of the snippets, add this to your vimrc:
```viml
let g:kite_snippets=0
```
Normally you insert the currently selected completion option with `<C-y>`. If you'd like to use `<Tab>` instead / as well, add this to your vimrc:
```viml
let g:kite_tab_complete=1
```
Every time you enter a Python buffer the plugin updates `completeopt` as follows:
```viml
set completeopt+=menuone " show the popup menu even when there is only 1 match
set completeopt+=noinsert " don't insert any text until user chooses a match
set completeopt-=longest " don't insert the longest common text
```
To see documentation in the preview window for each completion option, copy all the lines above into your vimrc and change the preview line to:
```viml
set completeopt+=preview
```
To have the preview window automatically closed once a completion has been inserted:
```viml
autocmd CompleteDone * if !pumvisible() | pclose | endif
```
We also recommend:
```viml
set belloff+=ctrlg " if vim beeps during completion
```
#### Placeholders
Some completions have placeholders which can be filled in. These will be highlighted with the Underline highlight group.
You can navigate between placeholders with `<CTRL-J>` (forward) and `<CTRL-K>` (backward), even after you have typed over the original placeholder text.
To change these keys:
```viml
let g:kite_previous_placeholder = '<C-H>'
let g:kite_next_placeholder = '<C-L>`
```
### Signatures
Kite can show how other people used the signature you are using. By default this is off to save space.
To turn it on: `:KiteShowPopularPatterns`.
To turn it off: `:KiteHidePopularPatterns`.
### Documentation
Press `K` when the cursor is on a keyword to view its documentation in Kite Copilot.
If you have mapped `K` already, the plugin won't overwrite your mapping.
You can set an alternative mapping, e.g. to `gK`, like this:
```viml
nmap <silent> <buffer> gK <Plug>(kite-docs)
```
By default you need to type `K` (or whatever you have mapped to `<Plug>(kite-docs)`) each time you want to see documentation for the keyword under the cursor. To have the documentation continually update itself as you move from keyword to keyword:
```viml
let g:kite_documentation_continual=1
```
### Commands
- `KiteDocsAtCursor` - show documentation for the keyword under the cursor.
- `KiteOpenCopilot` - open the Kite Copilot and focus on it.
- `KiteGeneralSettings` - open Kite's settings in the Copilot.
- `KitePermissions` - open Kite's permission settings in the Copilot.
- `KiteHelp` - show overview documentation.
- `KiteEnableAutoStart` - start Kite automatically when Vim starts.
- `KiteDisableAutoStart` - do not start Kite automatically when Vim starts.
### Statusline
Add `%{kite#statusline()}` to your statusline to get an indicator of what Kite is doing. If you don't have a status line, this one matches the default when `&ruler` is set:
```viml
set statusline=%<%f\ %h%m%r%{kite#statusline()}%=%-14.(%l,%c%V%)\ %P
set laststatus=2 " always display the status line
```
### Debugging
Use `let g:kite_log=1` to switch on logging. Logs are written to `kite-vim.log` in Vim's current working directory.
---
#### About Kite
Kite is built by a team in San Francisco devoted to making programming easier and more enjoyable for all. Follow Kite on
[Twitter](https://twitter.com/kitehq) and get the latest news and programming tips on the
[Kite Blog](https://kite.com/blog).
Kite has been featured in [Wired](https://www.wired.com/2016/04/kites-coding-asssitant-spots-errors-finds-better-open-source/),
[VentureBeat](https://venturebeat.com/2019/01/28/kite-raises-17-million-for-its-ai-powered-developer-environment/),
[The Next Web](https://thenextweb.com/dd/2016/04/14/kite-plugin/), and
[TechCrunch](https://techcrunch.com/2019/01/28/kite-raises-17m-for-its-ai-driven-code-completion-tool/).

View File

@ -0,0 +1 @@
1.0.41

View File

@ -0,0 +1,31 @@
*kite.txt* Kite for VIM
Kite for VIM
============
VIM is now integrated with Kite! To get a taste of what Kite can do, open a
saved Python file and start coding away.
1. Autocompletions
As you code, Kite will provide autocompletion suggestions ranked by popularity
using all the open source code on GitHub.
2. Documentation
Press |K| when your cursor is over a identifier to open a split window with
documentation about the identifier. In addition to documentation, Kite also
provides information about where you've used the identifier in your codebase,
as well as curated code examples showing you how to use the identifier.
3. Copilot integration
While you code in VIM, the Copilot will automatically show you information
about the code that you're currently working with. To open the Copilot, click
on the Kite menubar icon and select "Open Copilot".
To learn more about Kite and how to use the VIM plugin, visit our [help
page](http://help.kite.com).
vim:tw=78:et:ft=help:norl

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,74 @@
if exists('g:loaded_kite') || &cp || v:version < 700
finish
endif
let g:loaded_kite = 1
filetype on
if !exists('g:kite_auto_complete')
let g:kite_auto_complete = 1
endif
if !exists('g:kite_snippets')
let g:kite_snippets = 1
endif
if !exists('g:kite_previous_placeholder')
let g:kite_previous_placeholder = '<C-K>'
endif
if !exists('g:kite_next_placeholder')
let g:kite_next_placeholder = '<C-J>'
endif
if !exists('g:kite_documentation_continual')
let g:kite_documentation_continual = 0
endif
if !exists('g:kite_log')
let g:kite_log = 0
endif
if !exists('g:kite_short_timeout')
let g:kite_short_timeout = 120 " ms
endif
if !exists('g:kite_long_timeout')
let g:kite_long_timeout = 400 " ms
endif
if !(has('nvim') || has('job'))
call kite#utils#warn('disabled - requires nvim or vim with the +job feature')
finish
endif
if !(has('nvim') || has('timers'))
call kite#utils#warn('disabled - requires nvim or vim with the +timers feature')
finish
endif
" Nvim-QT
if exists('g:GuiLoaded')
GuiPopupmenu 0
endif
augroup Kite
autocmd!
autocmd BufEnter * call kite#bufenter()
augroup END
nnoremap <silent> <Plug>(kite-docs) :call kite#docs#docs()<CR>
command! KiteDocsAtCursor call kite#docs#docs()
command! KiteOpenCopilot call kite#client#copilot()
command! KiteGeneralSettings call kite#client#settings()
command! KitePermissions call kite#client#permissions()
command! KiteHelp call kite#utils#generate_help() | help kite
command! KiteDisableAutoStart call kite#disable_auto_start()
command! KiteEnableAutoStart call kite#enable_auto_start()
command! KiteShowPopularPatterns call kite#signature#show_popular_patterns()
command! KiteHidePopularPatterns call kite#signature#hide_popular_patterns()

View File

@ -0,0 +1,27 @@
if exists('b:current_syntax')
finish
endif
" Section headings
syntax match kiteHeading /\v^[A-Z* ]+$/
highlight link kiteHeading String
" Usages / Definitions
syntax include @python syntax/python.vim
syntax region kiteSnippet start=/\v^\[.+:\d+\]/ end=/$/ keepend contains=kiteRef,kiteCode
syntax match kiteRef /\v^\[.+:\d+\]/ contained
syntax region kiteCode start=/ / end=/$/ contains=@python contained
highlight link kiteRef Comment
" Links
syntax region MyLink start=/^-> /hs=e end=/\v(\s\(\a+[.]\a{2,3}\))?$/he=s-1 contains=Domain
syntax match Domain /\v\(\a+[.]\a{2,3}\)/
highlight link MyLink Underlined
highlight link Domain Comment
let b:current_syntax = 'kite'