stefhol / tabnine-nvim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tabnine-nvim

Tabnine client for neovim

Tabnine neovim client

Install

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 :PluginInstall

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 depended build script
local function get_tabnine_build_string()
  if (vim.fn.has('win32') == 1) then
    -- use special windows path
    return "pwsh.exe -file .\\dl_binaries.ps1"
  else
    -- unix path
    return "./dl_binaries.sh"
  end
end
require("lazy").setup({
  { 'codota/tabnine-nvim', build = get_tabnine_build_string()},
})

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

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'}}
})

About


Languages

Language:Lua 88.9%Language:PowerShell 6.6%Language:Shell 4.5%