mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-12-21 17:59:48 +01:00
feat: add untested tabnine keybindings
This commit is contained in:
parent
eb8c841b4a
commit
9a84c9e087
2 changed files with 39 additions and 20 deletions
|
@ -10,13 +10,43 @@ in {
|
|||
config = mkIf cfg.enable {
|
||||
vim.startPlugins = ["tabnine-nvim"];
|
||||
|
||||
vim.maps.insert = mkMerge [
|
||||
(mkExprBinding cfg.mappings.accept ''
|
||||
function()
|
||||
local state = require("tabnine.state")
|
||||
local completion = require("tabnine.completion")
|
||||
|
||||
if not state.completions_cache then
|
||||
return "${builtins.toJSON cfg.mappings.accept}"
|
||||
end
|
||||
|
||||
vim.schedule(completion.accept)
|
||||
end
|
||||
'' "orzel")
|
||||
(mkExprBinding cfg.mappings.dismiss ''
|
||||
function()
|
||||
local state = require("tabnine.state")
|
||||
local completion = require("tabnine.completion")
|
||||
|
||||
if not state.completions_cache then
|
||||
return "${builtins.toJSON cfg.mappings.dismiss}"
|
||||
end
|
||||
|
||||
vim.schedule(function()
|
||||
completion.clear()
|
||||
state.completions_cache = nil
|
||||
end)
|
||||
end
|
||||
'' "orzel")
|
||||
];
|
||||
|
||||
vim.luaConfigRC.tabnine-nvim = nvim.dag.entryAnywhere ''
|
||||
require('tabnine').setup({
|
||||
disable_auto_comment = ${boolToString cfg.disable_auto_comment},
|
||||
accept_keymap = ${cfg.accept_keymap},
|
||||
dismiss_keymap = ${cfg.dismiss_keymap},
|
||||
accept_keymap = null,
|
||||
dismiss_keymap = null,
|
||||
debounce_ms = ${cfg.debounce_ms},
|
||||
execlude_filetypes = ${cfg.execlude_filetypes},
|
||||
exclude_filetypes = ${cfg.exclude_filetypes},
|
||||
})
|
||||
'';
|
||||
};
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{lib, ...}:
|
||||
with lib;
|
||||
with builtins; {
|
||||
options.vim.assistant.tabnine = {
|
||||
|
@ -14,16 +10,9 @@ with builtins; {
|
|||
description = "Disable auto comment";
|
||||
};
|
||||
|
||||
accept_keymap = mkOption {
|
||||
type = types.str;
|
||||
default = "<Tab>";
|
||||
description = "Accept keymap";
|
||||
};
|
||||
|
||||
dismiss_keymap = mkOption {
|
||||
type = types.str;
|
||||
default = "<C-]>";
|
||||
description = "Dismiss keymap";
|
||||
mappings = {
|
||||
accept = mkMappingOption "Accept [Tabnine]" "<Tab>";
|
||||
dismiss = mkMappingOption "Dismiss [Tabnine]" "<C-]>";
|
||||
};
|
||||
|
||||
debounce_ms = mkOption {
|
||||
|
@ -32,10 +21,10 @@ with builtins; {
|
|||
description = "Debounce ms";
|
||||
};
|
||||
|
||||
execlude_filetypes = mkOption {
|
||||
exclude_filetypes = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = ["TelescopePrompt" "NvimTree" "alpha"];
|
||||
description = "Execlude filetypes";
|
||||
description = "Exclude filetypes";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue