Giter Club home page Giter Club logo

tabnine-nvim's Introduction

tabnine-nvim

Tabnine client for neovim

Tabnine neovim client

Install

Note this plugin requires having neovim version >= v0.7

Unix (Linux, MacOS)

Using vimplug

  1. Add the following in your init.vim
call plug#begin()
Plug 'codota/tabnine-nvim', { 'do': './dl_binaries.sh' }
call plug#end()
  1. Restart neovim and run :PlugInstall

Using packer

  1. Add the following in your init.lua:
require("packer").startup(function(use)
  use { 'codota/tabnine-nvim', run = "./dl_binaries.sh" }
end)
  1. Restart Neovim and run :PackerInstall

Using lazy.nvim

  1. Add the following in your init.lua:
require("lazy").setup({
  { 'codota/tabnine-nvim', build = "./dl_binaries.sh" },
})
  1. Restart Neovim and run :Lazy

Windows

The build script needs a set execution policy. Here is an example on how to set it

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

For more information visit the official documentation

Windows installations need to be adjusted to utilize PowerShell. This can be accomplished by changing the do/run/build parameter in your plugin manager's configuration from ./dl_binaries.sh to pwsh.exe -file .\\dl_binaries.ps1

-- Example using lazy.nvim
-- pwsh.exe for PowerShell Core
-- powershell.exe for Windows PowerShell

require("lazy").setup({
  { 'codota/tabnine-nvim', build = "pwsh.exe -file .\\dl_binaries.ps1" },
})

If you need to use Tabnine on Windows and Unix you can change the config as follows

-- Get platform dependant build script
local function tabnine_build_path()
  if vim.loop.os_uname().sysname == "Windows_NT" then
    return "pwsh.exe -file .\\dl_binaries.ps1"
  else
    return "./dl_binaries.sh"
  end
end
require("lazy").setup({
  { 'codota/tabnine-nvim', build = tabnine_build_path()},
})

Activate (mandatory)

add this later in your init.lua:

require('tabnine').setup({
  disable_auto_comment=true,
  accept_keymap="<Tab>",
  dismiss_keymap = "<C-]>",
  debounce_ms = 800,
  suggestion_color = {gui = "#808080", cterm = 244},
  exclude_filetypes = {"TelescopePrompt"}
})

init.vim users - the activation script is lua code. make sure to have it inside lua block. e.g:

lua <<EOF
" activate tabnine here
EOF

Activate Tabnine Pro

:TabnineHub - to open Tabnine Hub and log in to your account

Sometimes Tabnine may fail to open the browser on Tabnine Hub, in this case use :TabnineHubUrl to get Tabnine Hub url

Commands

  • :TabnineStatus - to print Tabnine status
  • :TabnineDisable - to disable Tabnine
  • :TabnineEnable - to enable Tabnine
  • :TabnineToggle - to toggle enable/disable

<Tab> and nvim-cmp

nvim-cmp maps <Tab> to navigating through pop menu items (see here) This conflicts with Tabnine <Tab> for inline completion. To get this sorted you can either:

  • Bind Tabnine inline completion to a different key using accept_keymap
  • Bind cmp.select_next_item() & cmp.select_prev_item() to different keys, e.g: <C-k> & <C-j>

lualine integration

This plugin exposes a lualine tabnine component. e.g:

require('lualine').setup({
    tabline = {
        lualine_a = {},
        lualine_b = {'branch'},
        lualine_c = {'filename'},
        lualine_x = {},
        lualine_y = {},
        lualine_z = {}
    },
    sections = {lualine_c = {'lsp_progress'}, lualine_x = {'tabnine'}}
})

Other statusline integrations

To render tabnine status widget use:

require('tabnine.status').status()

tabnine-nvim's People

Contributors

aarondill avatar amirbilu avatar argtus avatar instance-id avatar stefhol 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.