TabbyML / vim-tabby

Apache License 2.0
38 stars 2 forks source link

Tabby Plugin for Vim and NeoVim

Tabby is a self-hosted AI coding assistant that can suggest multi-line code or full functions in real-time. For more information, please check out our website and github.
If you encounter any problem or have any suggestion, please open an issue or join our Slack community for support.

Table of Contents

Requirements

Tabby plugin requires the following dependencies:

Installation

You can install Tabby plugin using your favorite plugin manager. Here are some examples using popular plugin managers, you can choose one to follow.

🔌 Vim-plug

" Example ~/.vimrc configuration
filetype plugin on

" Section for plugins managed by vim-plug
plug#begin()

" Tabby plugin
Plug 'TabbyML/vim-tabby'
" Add config here. Example config:
let g:tabby_keybinding_accept = '<Tab>'

plug#end()

📦 Packer.nvim

--- Example Packer plugin specification

--- Add config here. Example config:
vim.g.tabby_keybinding_accept = '<Tab>'

return require('packer').startup(function(use)
  --- Tabby plugin
  use { 'TabbyML/vim-tabby' }
end)

💤 Lazy.nvim

--- Example Lazy plugin specification

--- Add config here. Example config:
vim.g.tabby_keybinding_accept = '<Tab>'

return {
  { 'TabbyML/vim-tabby' }
}

Usage

After installation, please exit and restart Vim or NeoVim. Then you can check the Tabby plugin status by running :Tabby in your vim command line. If you see any message reported by Tabby, it means the plugin is installed successfully. If you see Not an editor command: Tabby or any other error message, please check the installation steps.

In insert mode, Tabby plugin will show inline completion automatically when you stop typing. You can simply press <Tab> to accept the completion. If you want to dismiss the completion manually, you can press <C-\> to dismiss, and press <C-\> again to show the completion again.

Configuration

Tabby Server

You need to start the Tabby server before using the plugin. For Tabby server installation, please refer to this documentation.

If your Tabby server endpoint is different from the default http://localhost:8080, please set the endpoint in ~/.tabby-client/agent/config.toml.

If your Tabby server requires an authentication token, remember to set it here.

# Server
# You can set the server endpoint here.
[server]
endpoint = "http://localhost:8080" # http or https URL
token = "your-auth-token"

Node.js Binary Path

Normally, this config is not required as the Tabby plugin will try to find the Node.js binary in your PATH environment variable.
But if you have installed Node.js in a non-standard location, or you are using a Node.js version manager such as nvm, you can set the Node.js binary path in your vim config file (~/.vimrc for Vim and ~/.config/nvim/init.vim or ~/.config/nvim/init.lua for NeoVim).

let g:tabby_node_binary = '/path/to/node'
--- lua
vim.g.tabby_node_binary = '/path/to/node'

Completion Trigger Mode

Completion trigger mode is set to auto by default, Tabby plugin will show inline completion automatically when you stop typing.
If you prefer to trigger code completion manually, add this config in your vim config file. Tabby plugin will not show inline completion automatically, you can trigger the completion manually by pressing <C-\>.

let g:tabby_trigger_mode = 'manual'
--- lua
vim.g.tabby_trigger_mode = 'manual'

KeyBindings

The default key bindings for accept completion(<Tab>), manual trigger/dismiss(<C-\>) can be customized with the following global settings.

let g:tabby_keybinding_accept = '<Tab>'
let g:tabby_keybinding_trigger_or_dismiss = '<C-\>'
--- lua
vim.g.tabby_keybinding_accept = '<Tab>'
vim.g.tabby_keybinding_trigger_or_dismiss = '<C-\\>'

Known Conflicts

Contributing

Repository TabbyML/vim-tabby is for releasing Tabby plugin for Vim and NeoVim. If you want to contribute to Tabby plugin, please check our main repository TabbyML/tabby.

License

Apache-2.0