mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +02:00
plugins/cmp-tabnine: move to by-name
This commit is contained in:
parent
79a637d196
commit
7aed1c4b57
4 changed files with 116 additions and 22 deletions
67
plugins/by-name/cmp-tabnine/default.nix
Normal file
67
plugins/by-name/cmp-tabnine/default.nix
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
{ lib, ... }:
|
||||||
|
let
|
||||||
|
inherit (lib) types;
|
||||||
|
inherit (lib.nixvim) defaultNullOpts;
|
||||||
|
in
|
||||||
|
lib.nixvim.neovim-plugin.mkNeovimPlugin {
|
||||||
|
name = "cmp-tabnine";
|
||||||
|
|
||||||
|
maintainers = [ lib.maintainers.GaetanLepage ];
|
||||||
|
|
||||||
|
imports = [
|
||||||
|
{ cmpSourcePlugins.cmp_tabnine = "cmp-tabnine"; }
|
||||||
|
];
|
||||||
|
|
||||||
|
deprecateExtraOptions = true;
|
||||||
|
|
||||||
|
moduleName = "cmp_tabnine.config";
|
||||||
|
setup = ":setup";
|
||||||
|
|
||||||
|
settingsOptions = {
|
||||||
|
max_lines = defaultNullOpts.mkUnsignedInt 1000 ''
|
||||||
|
How many lines of buffer context to pass to TabNine.
|
||||||
|
'';
|
||||||
|
|
||||||
|
max_num_results = defaultNullOpts.mkUnsignedInt 20 ''
|
||||||
|
How many results to return.
|
||||||
|
'';
|
||||||
|
|
||||||
|
sort = defaultNullOpts.mkBool true ''
|
||||||
|
Sort results by returned priority.
|
||||||
|
'';
|
||||||
|
|
||||||
|
run_on_every_keystroke = defaultNullOpts.mkBool true ''
|
||||||
|
Generate new completion items on every keystroke.
|
||||||
|
|
||||||
|
For more info, check out [#18](https://github.com/tzachar/cmp-tabnine/issues/18).
|
||||||
|
'';
|
||||||
|
|
||||||
|
snippet_placeholder = defaultNullOpts.mkStr ".." ''
|
||||||
|
Indicates where the cursor will be placed in case a completion item is asnippet.
|
||||||
|
Any string is accepted.
|
||||||
|
|
||||||
|
For this to work properly, you need to setup snippet support for `nvim-cmp`.
|
||||||
|
'';
|
||||||
|
|
||||||
|
ignored_file_types = defaultNullOpts.mkAttrsOf' {
|
||||||
|
type = types.bool;
|
||||||
|
pluginDefault = { };
|
||||||
|
example = {
|
||||||
|
lua = true;
|
||||||
|
};
|
||||||
|
description = ''
|
||||||
|
Which file types to ignore.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
min_percent = defaultNullOpts.mkNullable (types.numbers.between 0 100) 0 ''
|
||||||
|
Eliminate items with a percentage less than `min_percent`.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
settingsExample = {
|
||||||
|
max_lines = 600;
|
||||||
|
max_num_results = 10;
|
||||||
|
sort = false;
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,17 +0,0 @@
|
||||||
{
|
|
||||||
lib,
|
|
||||||
config,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
let
|
|
||||||
cfg = config.plugins.cmp-tabnine;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
options.plugins.cmp-tabnine = lib.nixvim.neovim-plugin.extraOptionsOptions;
|
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
|
||||||
extraConfigLua = ''
|
|
||||||
require('cmp_tabnine.config'):setup(${lib.nixvim.toLuaObject cfg.extraOptions})
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -141,10 +141,6 @@ let
|
||||||
pluginName = "cmp-spell";
|
pluginName = "cmp-spell";
|
||||||
sourceName = "spell";
|
sourceName = "spell";
|
||||||
}
|
}
|
||||||
{
|
|
||||||
pluginName = "cmp-tabnine";
|
|
||||||
sourceName = "cmp_tabnine";
|
|
||||||
}
|
|
||||||
{
|
{
|
||||||
pluginName = "cmp-tmux";
|
pluginName = "cmp-tmux";
|
||||||
sourceName = "tmux";
|
sourceName = "tmux";
|
||||||
|
@ -194,7 +190,6 @@ in
|
||||||
# For extra cmp plugins
|
# For extra cmp plugins
|
||||||
imports = [
|
imports = [
|
||||||
./copilot-cmp.nix
|
./copilot-cmp.nix
|
||||||
./cmp-tabnine.nix
|
|
||||||
./crates-nvim.nix
|
./crates-nvim.nix
|
||||||
] ++ pluginModules;
|
] ++ pluginModules;
|
||||||
}
|
}
|
||||||
|
|
49
tests/test-sources/plugins/by-name/cmp-tabnine/default.nix
Normal file
49
tests/test-sources/plugins/by-name/cmp-tabnine/default.nix
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
{ lib, pkgs, ... }:
|
||||||
|
let
|
||||||
|
platform = pkgs.stdenv.hostPlatform;
|
||||||
|
|
||||||
|
# tabnine is not available on aarch64-linux.
|
||||||
|
doRun = !(platform.isLinux && platform.isAarch64);
|
||||||
|
in
|
||||||
|
lib.optionalAttrs doRun {
|
||||||
|
empty = {
|
||||||
|
plugins = {
|
||||||
|
cmp.enable = true;
|
||||||
|
cmp-tabnine.enable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
defaults = {
|
||||||
|
plugins = {
|
||||||
|
cmp.enable = true;
|
||||||
|
cmp-tabnine = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
max_lines = 1000;
|
||||||
|
max_num_results = 20;
|
||||||
|
sort = true;
|
||||||
|
run_on_every_keystroke = true;
|
||||||
|
snippet_placeholder = "..";
|
||||||
|
ignored_file_types = { };
|
||||||
|
min_percent = 0;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
example = {
|
||||||
|
plugins = {
|
||||||
|
cmp.enable = true;
|
||||||
|
cmp-tabnine = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
max_lines = 600;
|
||||||
|
max_num_results = 10;
|
||||||
|
sort = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue