Skip to content

Commit

Permalink
doc: update doc/tabnine.txt
Browse files Browse the repository at this point in the history
Add the advanced usecase to the vimdoc

This help feels neglected...
  • Loading branch information
aarondill committed Mar 25, 2024
1 parent 7f61423 commit f5b546d
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion doc/tabnine.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Introduction |tabnine-nvim-introduction|
Usage |tabnine-nvim-usage|
Commands |tabnine-nvim-commands|
Configuration |tabnine-nvim-configuration|
Advanced keymaps |tabnine-nvim-advanced-keymaps|

==============================================================================
INTRODUCTION *tabnine-nvim-introduction*
Expand All @@ -32,7 +33,7 @@ This will initialize and setup the plugin to start using completion.
Further configuration can be passed to the setup function (|CONFIGURATION|)

==============================================================================
COMMANDS
COMMANDS *tabnine-nvim-commands*

Print Tabnine status
:TabnineStatus
Expand Down Expand Up @@ -82,9 +83,11 @@ See https://vim.fandom.com/wiki/Disable_automatic_comment_insertion

*accept_keymap* - String - Default: "<Tab>"
The key to press to accept the current completion.
Note: Set to `false` to disable the accept keymap

*dismiss_keymap* - String - Default: "<C-]>"
The key to press to hide the current completion.
Note: Set to `false` to disable the dismiss keymap

*debounce_ms* - Integer - Default: 800 - Minumum: 0
The number of milliseconds to wait between keystrokes before giving
Expand All @@ -105,5 +108,25 @@ Use :|setfiletype| <C-d> to see available file types.
An absolute path to Tabnine log file.


==============================================================================
ADVANCED KEYMAPS *tabnine-nvim-advanced-keymaps*

You can set `accept_keymap` and `dismiss_keymap` to `false` to disable them
then you can create mappings using `require('tabnine.keymaps')`
>lua
--- Example integration with Tabnine and LuaSnip
--- falling back to inserting tab if neither has a completion
vim.keymap.set("i", "<tab>", function()
if require("tabnine.keymaps").has_suggestion() then
return require("tabnine.keymaps").accept_suggestion()
elseif require("luasnip").jumpable(1) then
return require("luasnip").jump(1)
else
return "<tab>"
end
end, { expr = true })
<


==============================================================================
vim:tw=78:ts=4:ft=help:norl:noet:fen:noet:

0 comments on commit f5b546d

Please sign in to comment.