Neovim enhancing completion with TabNine
While everyone is hyped about GitHub’s Copilot, I’ve discovered TabNine, an AI completion that I enjoy a lot.
When Copilot is aiming to write the whole function for you, TabNine just tries to intelligently complete the current line.
Furthermore, the current implementation of Copilot for vim looks pretty hacky and doesn’t integrate with completion engines, while TabNine provides a completion source tzachar/cmp-tabnine for hrsh7th/nvim-cmp
Completion is provided by the local binary(which is installed automatically), so it feels really fast.
Installation is pretty straightforward and described in README.
In short, following steps are required:
- Install hrsh7th/nvim-cmp nvim completion engine
- Install tzachar/cmp-tabnine nvim-cmp completion source. Under the hood installation script will download and install binary
- Configure
nvim-cmp
to use TabNine source, i.e.:cmp.setup { sources = { { name = "buffer" }, { name = "nvim_lsp" }, { name = "cmp_tabnine" }, ... },
- Adjust completion menu to your liking
- Setup TabNine
The cool thing here is that TabNine works with any filetype, whether it’s GO, Terraform or even with markdown.
It’s free for individuals, so I highly recommend trying it. If you’ll like it, you can consider pro options
Enabling PRO version is possible, though not obvious. To do this:
- Open a new buffer
- Enter
INSERT
mode - Type
TabNine::config
A new browser window should pop up:
Check This Issue for more info
If you’re interested, feel free to check out my config files:
Update 2020-06-09
In PR #35 a new command
:CmpTabnineHub
was introduced.
This command makes in really easy to access the TabNine Hub
Comments