{"id":13675335,"url":"https://github.com/tzachar/cmp-tabnine","last_synced_at":"2026-02-04T14:22:48.909Z","repository":{"id":37771324,"uuid":"394898399","full_name":"tzachar/cmp-tabnine","owner":"tzachar","description":"TabNine plugin for hrsh7th/nvim-cmp","archived":false,"fork":false,"pushed_at":"2024-09-12T07:01:42.000Z","size":84,"stargazers_count":288,"open_issues_count":1,"forks_count":28,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-11-11T16:41:37.247Z","etag":null,"topics":["nvim-cmp"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tzachar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-08-11T07:17:26.000Z","updated_at":"2024-10-30T20:35:37.000Z","dependencies_parsed_at":"2023-01-31T02:45:28.282Z","dependency_job_id":"9a5d29bd-e660-451d-b1d0-6b689c32fd33","html_url":"https://github.com/tzachar/cmp-tabnine","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tzachar%2Fcmp-tabnine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tzachar%2Fcmp-tabnine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tzachar%2Fcmp-tabnine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tzachar%2Fcmp-tabnine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tzachar","download_url":"https://codeload.github.com/tzachar/cmp-tabnine/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251404410,"owners_count":21584089,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["nvim-cmp"],"created_at":"2024-08-02T12:00:38.080Z","updated_at":"2026-02-04T14:22:48.870Z","avatar_url":"https://github.com/tzachar.png","language":"Lua","readme":"# cmp-tabnine\nTabnine source for [hrsh7th/nvim-cmp](https://github.com/hrsh7th/nvim-cmp)\n\n# Install\n\n## Dependencies\n\nOn Linux and Mac, you will need `curl` and `unzip` in your `$PATH`.\n\nOn windows, you just need powershell. If you get a `PSSecurityException` while\ntrying to install, try the following command in powershell:\n\n```\nSet-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser\n```\n\nFor more information, see [about_Execution_Policies](https:/go.microsoft.com/fwlink/?LinkID=135170).\n\n## Using a plugin manager\n\nUsing plug:\n   ```viml\n   Plug 'tzachar/cmp-tabnine', { 'do': './install.sh' }\n   ```\n\nUsing plug on windows:\n   ```viml\n   Plug 'tzachar/cmp-tabnine', { 'do': 'powershell ./install.ps1' }\n   ```\n\nUsing [Lazy](https://github.com/folke/lazy.nvim/):\n   ```lua\nreturn require(\"lazy\").setup({\n    {\n        'tzachar/cmp-tabnine',\n        build = './install.sh',\n        dependencies = 'hrsh7th/nvim-cmp',\n    }})\n   ```\n\nUsing [Packer](https://github.com/wbthomason/packer.nvim/):\n   ```lua\nreturn require(\"packer\").startup(\n\tfunction(use)\n\t\tuse \"hrsh7th/nvim-cmp\" --completion\n\t\tuse {'tzachar/cmp-tabnine', run='./install.sh', requires = 'hrsh7th/nvim-cmp'}\n\tend\n)\n   ```\nUsing [Packer](https://github.com/wbthomason/packer.nvim/) on windows:\n   ```lua\nreturn require(\"packer\").startup(\n\tfunction(use)\n\t\tuse \"hrsh7th/nvim-cmp\" --completion\n\t\tuse {'tzachar/cmp-tabnine', after = \"nvim-cmp\", run='powershell ./install.ps1', requires = 'hrsh7th/nvim-cmp'}\n\tend\n)\n   ```\n\n\nAnd later, enable the plugin:\n\n   ```lua\nrequire'cmp'.setup {\n\tsources = {\n\t\t{ name = 'cmp_tabnine' },\n\t},\n}\n   ```\n## Using NvChad\nsee [this issue](https://github.com/tzachar/cmp-tabnine/issues/47)\n\n# Setup\n\n```lua\nlocal tabnine = require('cmp_tabnine.config')\n\ntabnine:setup({\n\tmax_lines = 1000,\n\tmax_num_results = 20,\n\tsort = true,\n\trun_on_every_keystroke = true,\n\tsnippet_placeholder = '..',\n\tignored_file_types = {\n\t\t-- default is not to ignore\n\t\t-- uncomment to ignore in lua:\n\t\t-- lua = true\n\t},\n\tshow_prediction_strength = false,\n\tmin_percent = 0\n})\n```\n\nPlease note the use of `:` instead of a `.`\n\n## Configure Tabnine or Log in to Your Account\n\nOn [Tabnine Hub](#More-Commands)\n\n## `max_lines`\n\nHow many lines of buffer context to pass to TabNine\n\n## `max_num_results`\n\nHow many results to return\n\n## `sort`\n\nSort results by returned priority\n\n\n## `run_on_every_keystroke`\n\nGenerate new completion items on every keystroke. For more info, check out [#18](https://github.com/tzachar/cmp-tabnine//issues/18)\n\n## `snippet_placeholder`\n\nIndicates where the cursor will be placed in case a completion item is a\nsnippet. Any string is accepted.\n\nFor this to work properly, you need to setup snippet support for `nvim-cmp`.\n\n## `ignored_file_types` `(table: \u003cstring:bool\u003e)`\nWhich file types to ignore. For example:\n```lua\nignored_file_types = {\n\thtml = true;\n}\n```\nwill make `cmp-tabnine` not offer completions when `vim.bo.filetype` is `html`.\n\n## `min_percent`\n\nEliminate items with a percentage less than `min_percent`.\n\n# Pretty Printing Menu Items\n\nYou can use the following to pretty print the completion menu (requires\n[lspkind](https://github.com/onsails/lspkind-nvim) and patched fonts\n(https://www.nerdfonts.com)):\n\n```lua\nlocal lspkind = require('lspkind')\n\nlocal source_mapping = {\n\tbuffer = \"[Buffer]\",\n\tnvim_lsp = \"[LSP]\",\n\tnvim_lua = \"[Lua]\",\n\tcmp_tabnine = \"[TN]\",\n\tpath = \"[Path]\",\n}\n\nrequire'cmp'.setup {\n\tsources = {\n\t\t{ name = 'cmp_tabnine' },\n\t},\n\tformatting = {\n\t\tformat = function(entry, vim_item)\n\t\t\t-- if you have lspkind installed, you can use it like\n\t\t\t-- in the following line:\n\t \t\tvim_item.kind = lspkind.symbolic(vim_item.kind, {mode = \"symbol\"})\n\t \t\tvim_item.menu = source_mapping[entry.source.name]\n\t \t\tif entry.source.name == \"cmp_tabnine\" then\n                local detail = (entry.completion_item.labelDetails or {}).detail\n\t \t\t\tvim_item.kind = \"\"\n\t \t\t\tif detail and detail:find('.*%%.*') then\n\t \t\t\t\tvim_item.kind = vim_item.kind .. ' ' .. detail\n\t \t\t\tend\n\n\t \t\t\tif (entry.completion_item.data or {}).multiline then\n\t \t\t\t\tvim_item.kind = vim_item.kind .. ' ' .. '[ML]'\n\t \t\t\tend\n\t \t\tend\n\t \t\tlocal maxwidth = 80\n\t \t\tvim_item.abbr = string.sub(vim_item.abbr, 1, maxwidth)\n\t \t\treturn vim_item\n\t  end,\n\t},\n}\n```\n\n# Customize cmp highlight group\n\nThe highlight group is `CmpItemKindTabNine`, you can change it by:\n\n```lua\nvim.api.nvim_set_hl(0, \"CmpItemKindTabNine\", {fg =\"#6CC644\"})\n```\n\n# Sorting\n\n`cmp-tabnine` adds a priority entry to each completion item,\nwhich can be used to override `cmp`'s default sorting order:\n\n\n```lua\nlocal compare = require('cmp.config.compare')\ncmp.setup({\n  sorting = {\n    priority_weight = 2,\n    comparators = {\n      require('cmp_tabnine.compare'),\n      compare.offset,\n      compare.exact,\n      compare.score,\n      compare.recently_used,\n      compare.kind,\n      compare.sort_text,\n      compare.length,\n      compare.order,\n    },\n  },\n})\n```\n\n# Prefetch\n\nTabNine supports prefetching files, preprocessing them before users ask for\ncompletions. Prefetching is supported through a command:\n\n`:CmpTabninePrefetch file_path`\n\nand also directly using lua:\n\n```lua\nrequire('cmp_tabnine'):prefetch(file_path)\n```\n\nThe lua api can be used to prefetch a project, or a file on open:\n\n```lua\nlocal prefetch = vim.api.nvim_create_augroup(\"prefetch\", {clear = true})\n\nvim.api.nvim_create_autocmd('BufRead', {\n  group = prefetch,\n  pattern = '*.py',\n  callback = function()\n    require('cmp_tabnine'):prefetch(vim.fn.expand('%:p'))\n  end\n})\n```\n\n# Multi-Line suggestions\n\nTabNine supports multi-line suggestions in Pro mode. If a suggestions is multi-line, we add\nthe `entry.completion_item.data.detail.multiline` flag to the completion entry\nand the entire suggestion to the `documentation` property of the entry, such\nthat `cmp` will display the suggested lines in the documentation panel.\n\nTo enable multi-line completions, you should (a) have a Pro account and (b)\nselect either the hybrid or cloud completion models in the TabNine Hub.\n\nMoreover, TabNine tends to suggest multi-line completions only on a new line\n(usually after a comment describing what you are expecting to get). The easiest\nway to trigger the completion is by manually invoking cmp on a new line.\n\nSupport for multi-line completions in cmp works only from version 4.4.213 of\nTabNine (see [this issue](https://github.com/codota/tabnine-nvim/issues/6#issuecomment-1364655503)).\n\n# More Commands\n\n- `:CmpTabnineHub`: Open Tabnine Hub\n- `:CmpTabnineHubUrl`: Show the link to Tabnine Hub\n","funding_links":[],"categories":["Lua","Tab completion"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftzachar%2Fcmp-tabnine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftzachar%2Fcmp-tabnine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftzachar%2Fcmp-tabnine/lists"}