mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 00:25:42 +02:00
plugins/cmp-tabby: move to by-name
This commit is contained in:
parent
6e52e32d40
commit
5abe382c54
4 changed files with 51 additions and 75 deletions
50
plugins/by-name/cmp-tabby/default.nix
Normal file
50
plugins/by-name/cmp-tabby/default.nix
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
{ lib, ... }:
|
||||||
|
let
|
||||||
|
inherit (lib) types;
|
||||||
|
inherit (lib.nixvim) defaultNullOpts;
|
||||||
|
in
|
||||||
|
lib.nixvim.neovim-plugin.mkNeovimPlugin {
|
||||||
|
name = "cmp-tabby";
|
||||||
|
|
||||||
|
maintainers = [ lib.maintainers.GaetanLepage ];
|
||||||
|
|
||||||
|
imports = [
|
||||||
|
{ cmpSourcePlugins.cmp_tabby = "cmp-tabby"; }
|
||||||
|
];
|
||||||
|
|
||||||
|
deprecateExtraOptions = true;
|
||||||
|
optionsRenamedToSettings = [
|
||||||
|
"host"
|
||||||
|
"maxLines"
|
||||||
|
"runOnEveryKeyStroke"
|
||||||
|
"stop"
|
||||||
|
];
|
||||||
|
|
||||||
|
moduleName = "cmp_tabby.config";
|
||||||
|
setup = ":setup";
|
||||||
|
|
||||||
|
settingsOptions = {
|
||||||
|
host = defaultNullOpts.mkStr "http://localhost:5000" ''
|
||||||
|
The address of the tabby host server.
|
||||||
|
'';
|
||||||
|
|
||||||
|
max_lines = defaultNullOpts.mkUnsignedInt 100 ''
|
||||||
|
The max number of lines to complete.
|
||||||
|
'';
|
||||||
|
|
||||||
|
run_on_every_keystroke = defaultNullOpts.mkBool true ''
|
||||||
|
Whether to run the completion on every keystroke.
|
||||||
|
'';
|
||||||
|
|
||||||
|
stop = defaultNullOpts.mkListOf types.str [ "\n" ] ''
|
||||||
|
Stop character.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
settingsExample = {
|
||||||
|
host = "http://localhost:5000";
|
||||||
|
max_lines = 100;
|
||||||
|
run_on_every_keystroke = true;
|
||||||
|
stop = [ "\n" ];
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,70 +0,0 @@
|
||||||
{
|
|
||||||
lib,
|
|
||||||
config,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
let
|
|
||||||
inherit (lib) mkRenamedOptionModule types;
|
|
||||||
inherit (lib.nixvim) defaultNullOpts;
|
|
||||||
|
|
||||||
cfg = config.plugins.cmp-tabby;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
meta.maintainers = [ lib.maintainers.GaetanLepage ];
|
|
||||||
|
|
||||||
# TODO: introduced 24-06-18, remove after 24.11
|
|
||||||
imports =
|
|
||||||
let
|
|
||||||
basePluginPath = [
|
|
||||||
"plugins"
|
|
||||||
"cmp-tabby"
|
|
||||||
];
|
|
||||||
settingsPath = basePluginPath ++ [ "settings" ];
|
|
||||||
in
|
|
||||||
[
|
|
||||||
(mkRenamedOptionModule (basePluginPath ++ [ "extraOptions" ]) settingsPath)
|
|
||||||
(mkRenamedOptionModule (basePluginPath ++ [ "host" ]) (settingsPath ++ [ "host" ]))
|
|
||||||
(mkRenamedOptionModule (basePluginPath ++ [ "maxLines" ]) (settingsPath ++ [ "max_lines" ]))
|
|
||||||
(mkRenamedOptionModule (basePluginPath ++ [ "runOnEveryKeyStroke" ]) (
|
|
||||||
settingsPath ++ [ "run_on_every_keystroke" ]
|
|
||||||
))
|
|
||||||
(mkRenamedOptionModule (basePluginPath ++ [ "stop" ]) (settingsPath ++ [ "stop" ]))
|
|
||||||
];
|
|
||||||
|
|
||||||
options.plugins.cmp-tabby = {
|
|
||||||
settings = lib.nixvim.mkSettingsOption {
|
|
||||||
description = "Options provided to the `require('cmp_ai.config'):setup` function.";
|
|
||||||
|
|
||||||
options = {
|
|
||||||
host = defaultNullOpts.mkStr "http://localhost:5000" ''
|
|
||||||
The address of the tabby host server.
|
|
||||||
'';
|
|
||||||
|
|
||||||
max_lines = defaultNullOpts.mkUnsignedInt 100 ''
|
|
||||||
The max number of lines to complete.
|
|
||||||
'';
|
|
||||||
|
|
||||||
run_on_every_keystroke = defaultNullOpts.mkBool true ''
|
|
||||||
Whether to run the completion on every keystroke.
|
|
||||||
'';
|
|
||||||
|
|
||||||
stop = defaultNullOpts.mkListOf types.str [ "\n" ] ''
|
|
||||||
Stop character.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
example = {
|
|
||||||
host = "http://localhost:5000";
|
|
||||||
max_lines = 100;
|
|
||||||
run_on_every_keystroke = true;
|
|
||||||
stop = [ "\n" ];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
|
||||||
extraConfigLua = ''
|
|
||||||
require('cmp_tabby.config'):setup(${lib.nixvim.toLuaObject cfg.settings})
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -5,6 +5,7 @@
|
||||||
...
|
...
|
||||||
}@args:
|
}@args:
|
||||||
let
|
let
|
||||||
|
|
||||||
# A list of most cmp source plugins, passed to mkCmpSourcePlugin.
|
# A list of most cmp source plugins, passed to mkCmpSourcePlugin.
|
||||||
# More complex cmp sources can instead be defined as their own plugin
|
# More complex cmp sources can instead be defined as their own plugin
|
||||||
# and register their source-name association using the `cmpSourcePlugins` option.
|
# and register their source-name association using the `cmpSourcePlugins` option.
|
||||||
|
@ -145,10 +146,6 @@ let
|
||||||
pluginName = "cmp-spell";
|
pluginName = "cmp-spell";
|
||||||
sourceName = "spell";
|
sourceName = "spell";
|
||||||
}
|
}
|
||||||
{
|
|
||||||
pluginName = "cmp-tabby";
|
|
||||||
sourceName = "cmp_tabby";
|
|
||||||
}
|
|
||||||
{
|
{
|
||||||
pluginName = "cmp-tabnine";
|
pluginName = "cmp-tabnine";
|
||||||
sourceName = "cmp_tabnine";
|
sourceName = "cmp_tabnine";
|
||||||
|
@ -205,7 +202,6 @@ in
|
||||||
./cmp-ai.nix
|
./cmp-ai.nix
|
||||||
./cmp-fish.nix
|
./cmp-fish.nix
|
||||||
./cmp-git.nix
|
./cmp-git.nix
|
||||||
./cmp-tabby.nix
|
|
||||||
./cmp-tabnine.nix
|
./cmp-tabnine.nix
|
||||||
./crates-nvim.nix
|
./crates-nvim.nix
|
||||||
] ++ pluginModules;
|
] ++ pluginModules;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue