mirror of
https://github.com/nix-community/nixvim.git
synced 2025-07-02 21:34:33 +02:00
treewide: Reformat with nixfmt
This commit is contained in:
parent
c6281260dc
commit
62f32bfc71
459 changed files with 28139 additions and 26377 deletions
|
@ -6,81 +6,61 @@
|
|||
...
|
||||
}:
|
||||
with helpers.vim-plugin;
|
||||
with lib; rec {
|
||||
mkCmpSourcePlugin = {
|
||||
name,
|
||||
extraPlugins ? [],
|
||||
useDefaultPackage ? true,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
rec {
|
||||
mkCmpSourcePlugin =
|
||||
{
|
||||
name,
|
||||
extraPlugins ? [ ],
|
||||
useDefaultPackage ? true,
|
||||
...
|
||||
}:
|
||||
mkVimPlugin config {
|
||||
inherit name;
|
||||
extraPlugins = extraPlugins ++ (lists.optional useDefaultPackage pkgs.vimPlugins.${name});
|
||||
|
||||
maintainers = [maintainers.GaetanLepage];
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
};
|
||||
|
||||
extractSourcesFromOptionValue = sources:
|
||||
if isList sources
|
||||
then sources
|
||||
else [];
|
||||
extractSourcesFromOptionValue = sources: if isList sources then sources else [ ];
|
||||
|
||||
autoInstallSourcePluginsModule = cfg: let
|
||||
# cfg.setup.sources
|
||||
setupSources = extractSourcesFromOptionValue cfg.settings.sources;
|
||||
# cfg.filetype.<name>.sources
|
||||
filetypeSources =
|
||||
mapAttrsToList
|
||||
(_: filetypeConfig:
|
||||
extractSourcesFromOptionValue filetypeConfig.sources)
|
||||
cfg.filetype;
|
||||
# cfg.cmdline.<name>.sources
|
||||
cmdlineSources =
|
||||
mapAttrsToList
|
||||
(_: cmdlineConfig:
|
||||
extractSourcesFromOptionValue cmdlineConfig.sources)
|
||||
cfg.cmdline;
|
||||
autoInstallSourcePluginsModule =
|
||||
cfg:
|
||||
let
|
||||
# cfg.setup.sources
|
||||
setupSources = extractSourcesFromOptionValue cfg.settings.sources;
|
||||
# cfg.filetype.<name>.sources
|
||||
filetypeSources = mapAttrsToList (
|
||||
_: filetypeConfig: extractSourcesFromOptionValue filetypeConfig.sources
|
||||
) cfg.filetype;
|
||||
# cfg.cmdline.<name>.sources
|
||||
cmdlineSources = mapAttrsToList (
|
||||
_: cmdlineConfig: extractSourcesFromOptionValue cmdlineConfig.sources
|
||||
) cfg.cmdline;
|
||||
|
||||
# [{name = "foo";} {name = "bar"; x = 42;} ...]
|
||||
allSources = flatten (setupSources ++ filetypeSources ++ cmdlineSources);
|
||||
# [{name = "foo";} {name = "bar"; x = 42;} ...]
|
||||
allSources = flatten (setupSources ++ filetypeSources ++ cmdlineSources);
|
||||
|
||||
# Take only the names from the sources provided by the user
|
||||
# ["foo" "bar"]
|
||||
foundSources =
|
||||
lists.unique
|
||||
(
|
||||
map
|
||||
(source: source.name)
|
||||
allSources
|
||||
);
|
||||
# Take only the names from the sources provided by the user
|
||||
# ["foo" "bar"]
|
||||
foundSources = lists.unique (map (source: source.name) allSources);
|
||||
|
||||
# If the user has enabled the `foo` and `bar` sources, this attrs will look like:
|
||||
# {
|
||||
# cmp-foo.enable = true;
|
||||
# cmp-bar.enable = true;
|
||||
# }
|
||||
attrsEnabled =
|
||||
mapAttrs'
|
||||
(
|
||||
sourceName: pluginName: {
|
||||
name = pluginName;
|
||||
value.enable =
|
||||
mkIf
|
||||
(elem sourceName foundSources)
|
||||
true;
|
||||
}
|
||||
)
|
||||
(import ./sources.nix);
|
||||
# If the user has enabled the `foo` and `bar` sources, this attrs will look like:
|
||||
# {
|
||||
# cmp-foo.enable = true;
|
||||
# cmp-bar.enable = true;
|
||||
# }
|
||||
attrsEnabled = mapAttrs' (sourceName: pluginName: {
|
||||
name = pluginName;
|
||||
value.enable = mkIf (elem sourceName foundSources) true;
|
||||
}) (import ./sources.nix);
|
||||
|
||||
lspCapabilities =
|
||||
mkIf
|
||||
(elem "nvim_lsp" foundSources)
|
||||
{
|
||||
lspCapabilities = mkIf (elem "nvim_lsp" foundSources) {
|
||||
lsp.capabilities = ''
|
||||
capabilities = vim.tbl_deep_extend("force", capabilities, require('cmp_nvim_lsp').default_capabilities())
|
||||
'';
|
||||
};
|
||||
in
|
||||
in
|
||||
mkMerge [
|
||||
(mkIf cfg.autoEnableSources attrsEnabled)
|
||||
lspCapabilities
|
||||
|
|
|
@ -4,42 +4,45 @@
|
|||
pkgs,
|
||||
config,
|
||||
...
|
||||
} @ args: let
|
||||
cmpOptions = import ./options {inherit lib helpers;};
|
||||
}@args:
|
||||
let
|
||||
cmpOptions = import ./options { inherit lib helpers; };
|
||||
in
|
||||
with lib;
|
||||
helpers.neovim-plugin.mkNeovimPlugin config {
|
||||
name = "cmp";
|
||||
originalName = "nvim-cmp";
|
||||
defaultPackage = pkgs.vimPlugins.nvim-cmp;
|
||||
with lib;
|
||||
helpers.neovim-plugin.mkNeovimPlugin config {
|
||||
name = "cmp";
|
||||
originalName = "nvim-cmp";
|
||||
defaultPackage = pkgs.vimPlugins.nvim-cmp;
|
||||
|
||||
maintainers = [maintainers.GaetanLepage];
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
# Introduced on 2024 February 21
|
||||
# TODO: remove ~June 2024
|
||||
imports = [
|
||||
./deprecations.nix
|
||||
./sources
|
||||
];
|
||||
deprecateExtraOptions = true;
|
||||
# Introduced on 2024 February 21
|
||||
# TODO: remove ~June 2024
|
||||
imports = [
|
||||
./deprecations.nix
|
||||
./sources
|
||||
];
|
||||
deprecateExtraOptions = true;
|
||||
|
||||
extraOptions = {
|
||||
autoEnableSources = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Scans the sources array and installs the plugins if they are known to nixvim.
|
||||
'';
|
||||
};
|
||||
extraOptions = {
|
||||
autoEnableSources = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Scans the sources array and installs the plugins if they are known to nixvim.
|
||||
'';
|
||||
};
|
||||
|
||||
inherit (cmpOptions) filetype cmdline;
|
||||
};
|
||||
inherit (cmpOptions) filetype cmdline;
|
||||
};
|
||||
|
||||
inherit (cmpOptions) settingsOptions settingsExample;
|
||||
inherit (cmpOptions) settingsOptions settingsExample;
|
||||
|
||||
callSetup = false;
|
||||
extraConfig = cfg: {
|
||||
warnings = optional (cfg.autoEnableSources && (helpers.nixvimTypes.isRawType cfg.settings.sources)) ''
|
||||
callSetup = false;
|
||||
extraConfig = cfg: {
|
||||
warnings =
|
||||
optional (cfg.autoEnableSources && (helpers.nixvimTypes.isRawType cfg.settings.sources))
|
||||
''
|
||||
Nixvim (plugins.cmp): You have enabled `autoEnableSources` that tells Nixvim to automatically
|
||||
enable the source plugins with respect to the list of sources provided in `settings.sources`.
|
||||
However, the latter is proveded as a raw lua string which is not parseable by Nixvim.
|
||||
|
@ -49,35 +52,25 @@ in
|
|||
- Dismiss this warning by explicitly setting `autoEnableSources` to `false`;
|
||||
'';
|
||||
|
||||
extraConfigLua =
|
||||
''
|
||||
local cmp = require('cmp')
|
||||
cmp.setup(${helpers.toLuaObject cfg.settings})
|
||||
extraConfigLua =
|
||||
''
|
||||
local cmp = require('cmp')
|
||||
cmp.setup(${helpers.toLuaObject cfg.settings})
|
||||
|
||||
''
|
||||
+ (
|
||||
concatStringsSep "\n"
|
||||
(
|
||||
mapAttrsToList
|
||||
(
|
||||
filetype: settings: "cmp.setup.filetype('${filetype}', ${helpers.toLuaObject settings})\n"
|
||||
)
|
||||
cfg.filetype
|
||||
)
|
||||
)
|
||||
+ (
|
||||
concatStringsSep "\n"
|
||||
(
|
||||
mapAttrsToList
|
||||
(
|
||||
cmdtype: settings: "cmp.setup.cmdline('${cmdtype}', ${helpers.toLuaObject settings})\n"
|
||||
)
|
||||
cfg.cmdline
|
||||
)
|
||||
);
|
||||
''
|
||||
+ (concatStringsSep "\n" (
|
||||
mapAttrsToList (
|
||||
filetype: settings: "cmp.setup.filetype('${filetype}', ${helpers.toLuaObject settings})\n"
|
||||
) cfg.filetype
|
||||
))
|
||||
+ (concatStringsSep "\n" (
|
||||
mapAttrsToList (
|
||||
cmdtype: settings: "cmp.setup.cmdline('${cmdtype}', ${helpers.toLuaObject settings})\n"
|
||||
) cfg.cmdline
|
||||
));
|
||||
|
||||
# If autoEnableSources is set to true, figure out which are provided by the user
|
||||
# and enable the corresponding plugins.
|
||||
plugins = (import ./cmp-helpers.nix args).autoInstallSourcePluginsModule cfg;
|
||||
};
|
||||
}
|
||||
# If autoEnableSources is set to true, figure out which are provided by the user
|
||||
# and enable the corresponding plugins.
|
||||
plugins = (import ./cmp-helpers.nix args).autoInstallSourcePluginsModule cfg;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,164 +1,360 @@
|
|||
{lib, ...}:
|
||||
with lib; let
|
||||
oldPluginBasePath = ["plugins" "nvim-cmp"];
|
||||
newPluginBasePath = ["plugins" "cmp"];
|
||||
settingsPath = newPluginBasePath ++ ["settings"];
|
||||
{ lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
oldPluginBasePath = [
|
||||
"plugins"
|
||||
"nvim-cmp"
|
||||
];
|
||||
newPluginBasePath = [
|
||||
"plugins"
|
||||
"cmp"
|
||||
];
|
||||
settingsPath = newPluginBasePath ++ [ "settings" ];
|
||||
|
||||
renamedOptions = [
|
||||
{old = ["performance" "debounce"];}
|
||||
{old = ["performance" "throttle"];}
|
||||
{
|
||||
old = ["performance" "fetchingTimeout"];
|
||||
new = ["performance" "fetching_timeout"];
|
||||
old = [
|
||||
"performance"
|
||||
"debounce"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = ["performance" "asyncBudget"];
|
||||
new = ["performance" "async_budget"];
|
||||
old = [
|
||||
"performance"
|
||||
"throttle"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = ["performance" "maxViewEntries"];
|
||||
new = ["performance" "max_view_entries"];
|
||||
}
|
||||
{old = ["mapping"];}
|
||||
{
|
||||
old = ["completion" "keywordLength"];
|
||||
new = ["completion" "keyword_length"];
|
||||
old = [
|
||||
"performance"
|
||||
"fetchingTimeout"
|
||||
];
|
||||
new = [
|
||||
"performance"
|
||||
"fetching_timeout"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = ["completion" "keywordPattern"];
|
||||
new = ["completion" "keyword_pattern"];
|
||||
}
|
||||
{old = ["completion" "autocomplete"];}
|
||||
{old = ["completion" "completeopt"];}
|
||||
{
|
||||
old = ["confirmation" "getCommitCharacters"];
|
||||
new = ["confirmation" "get_commit_characters"];
|
||||
old = [
|
||||
"performance"
|
||||
"asyncBudget"
|
||||
];
|
||||
new = [
|
||||
"performance"
|
||||
"async_budget"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = ["formatting" "expandableIndicator"];
|
||||
new = ["formatting" "expandable_indicator"];
|
||||
old = [
|
||||
"performance"
|
||||
"maxViewEntries"
|
||||
];
|
||||
new = [
|
||||
"performance"
|
||||
"max_view_entries"
|
||||
];
|
||||
}
|
||||
{old = ["formatting" "fields"];}
|
||||
{old = ["formatting" "format"];}
|
||||
{ old = [ "mapping" ]; }
|
||||
{
|
||||
old = ["matching" "disallowFuzzyMatching"];
|
||||
new = ["matching" "disallow_fuzzy_matching"];
|
||||
old = [
|
||||
"completion"
|
||||
"keywordLength"
|
||||
];
|
||||
new = [
|
||||
"completion"
|
||||
"keyword_length"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = ["matching" "disallowFullfuzzyMatching"];
|
||||
new = ["matching" "disallow_fullfuzzy_matching"];
|
||||
old = [
|
||||
"completion"
|
||||
"keywordPattern"
|
||||
];
|
||||
new = [
|
||||
"completion"
|
||||
"keyword_pattern"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = ["matching" "disallowPartialFuzzyMatching"];
|
||||
new = ["matching" "disallow_partial_fuzzy_matching"];
|
||||
old = [
|
||||
"completion"
|
||||
"autocomplete"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = ["matching" "disallowPartialMatching"];
|
||||
new = ["matching" "disallow_partial_matching"];
|
||||
old = [
|
||||
"completion"
|
||||
"completeopt"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = ["matching" "disallowPrefixUnmatching"];
|
||||
new = ["matching" "disallow_prefix_unmatching"];
|
||||
old = [
|
||||
"confirmation"
|
||||
"getCommitCharacters"
|
||||
];
|
||||
new = [
|
||||
"confirmation"
|
||||
"get_commit_characters"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = ["sorting" "priorityWeight"];
|
||||
new = ["sorting" "priority_weight"];
|
||||
}
|
||||
{old = ["view" "entries"];}
|
||||
{
|
||||
old = ["view" "docs" "autoOpen"];
|
||||
new = ["view" "docs" "auto_open"];
|
||||
}
|
||||
{old = ["window" "completion" "border"];}
|
||||
{old = ["window" "completion" "winhighlight"];}
|
||||
{old = ["window" "completion" "zindex"];}
|
||||
{old = ["window" "completion" "scrolloff"];}
|
||||
{
|
||||
old = ["window" "completion" "colOffset"];
|
||||
new = ["window" "completion" "col_offset"];
|
||||
old = [
|
||||
"formatting"
|
||||
"expandableIndicator"
|
||||
];
|
||||
new = [
|
||||
"formatting"
|
||||
"expandable_indicator"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = ["window" "completion" "sidePadding"];
|
||||
new = ["window" "completion" "side_padding"];
|
||||
}
|
||||
{old = ["window" "completion" "scrollbar"];}
|
||||
{old = ["window" "documentation" "border"];}
|
||||
{old = ["window" "documentation" "winhighlight"];}
|
||||
{old = ["window" "documentation" "zindex"];}
|
||||
{
|
||||
old = ["window" "documentation" "maxWidth"];
|
||||
new = ["window" "documentation" "max_width"];
|
||||
old = [
|
||||
"formatting"
|
||||
"fields"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = ["window" "documentation" "maxHeight"];
|
||||
new = ["window" "documentation" "max_height"];
|
||||
old = [
|
||||
"formatting"
|
||||
"format"
|
||||
];
|
||||
}
|
||||
{old = ["experimental"];}
|
||||
{
|
||||
old = [
|
||||
"matching"
|
||||
"disallowFuzzyMatching"
|
||||
];
|
||||
new = [
|
||||
"matching"
|
||||
"disallow_fuzzy_matching"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = [
|
||||
"matching"
|
||||
"disallowFullfuzzyMatching"
|
||||
];
|
||||
new = [
|
||||
"matching"
|
||||
"disallow_fullfuzzy_matching"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = [
|
||||
"matching"
|
||||
"disallowPartialFuzzyMatching"
|
||||
];
|
||||
new = [
|
||||
"matching"
|
||||
"disallow_partial_fuzzy_matching"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = [
|
||||
"matching"
|
||||
"disallowPartialMatching"
|
||||
];
|
||||
new = [
|
||||
"matching"
|
||||
"disallow_partial_matching"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = [
|
||||
"matching"
|
||||
"disallowPrefixUnmatching"
|
||||
];
|
||||
new = [
|
||||
"matching"
|
||||
"disallow_prefix_unmatching"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = [
|
||||
"sorting"
|
||||
"priorityWeight"
|
||||
];
|
||||
new = [
|
||||
"sorting"
|
||||
"priority_weight"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = [
|
||||
"view"
|
||||
"entries"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = [
|
||||
"view"
|
||||
"docs"
|
||||
"autoOpen"
|
||||
];
|
||||
new = [
|
||||
"view"
|
||||
"docs"
|
||||
"auto_open"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = [
|
||||
"window"
|
||||
"completion"
|
||||
"border"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = [
|
||||
"window"
|
||||
"completion"
|
||||
"winhighlight"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = [
|
||||
"window"
|
||||
"completion"
|
||||
"zindex"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = [
|
||||
"window"
|
||||
"completion"
|
||||
"scrolloff"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = [
|
||||
"window"
|
||||
"completion"
|
||||
"colOffset"
|
||||
];
|
||||
new = [
|
||||
"window"
|
||||
"completion"
|
||||
"col_offset"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = [
|
||||
"window"
|
||||
"completion"
|
||||
"sidePadding"
|
||||
];
|
||||
new = [
|
||||
"window"
|
||||
"completion"
|
||||
"side_padding"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = [
|
||||
"window"
|
||||
"completion"
|
||||
"scrollbar"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = [
|
||||
"window"
|
||||
"documentation"
|
||||
"border"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = [
|
||||
"window"
|
||||
"documentation"
|
||||
"winhighlight"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = [
|
||||
"window"
|
||||
"documentation"
|
||||
"zindex"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = [
|
||||
"window"
|
||||
"documentation"
|
||||
"maxWidth"
|
||||
];
|
||||
new = [
|
||||
"window"
|
||||
"documentation"
|
||||
"max_width"
|
||||
];
|
||||
}
|
||||
{
|
||||
old = [
|
||||
"window"
|
||||
"documentation"
|
||||
"maxHeight"
|
||||
];
|
||||
new = [
|
||||
"window"
|
||||
"documentation"
|
||||
"max_height"
|
||||
];
|
||||
}
|
||||
{ old = [ "experimental" ]; }
|
||||
];
|
||||
|
||||
renameWarnings =
|
||||
map
|
||||
(
|
||||
rename:
|
||||
mkRenamedOptionModule
|
||||
(oldPluginBasePath ++ rename.old)
|
||||
(settingsPath ++ (rename.new or rename.old))
|
||||
renameWarnings = map (
|
||||
rename:
|
||||
mkRenamedOptionModule (oldPluginBasePath ++ rename.old) (settingsPath ++ (rename.new or rename.old))
|
||||
) renamedOptions;
|
||||
in
|
||||
{
|
||||
imports = renameWarnings ++ [
|
||||
(mkRenamedOptionModule (oldPluginBasePath ++ [ "enable" ]) (newPluginBasePath ++ [ "enable" ]))
|
||||
(mkRenamedOptionModule (oldPluginBasePath ++ [ "autoEnableSources" ]) (
|
||||
newPluginBasePath ++ [ "autoEnableSources" ]
|
||||
))
|
||||
(mkRemovedOptionModule (oldPluginBasePath ++ [ "preselect" ]) ''
|
||||
Use `plugins.cmp.settings.preselect` option. But watch out, you now have to explicitly write `cmp.PreselectMode.<mode>`.
|
||||
See the option documentation for more details.
|
||||
'')
|
||||
(mkRemovedOptionModule (oldPluginBasePath ++ [ "mappingPresets" ])
|
||||
"If you want to have a complex mapping logic, express it in raw lua within the `plugins.cmp.settings.mapping` option."
|
||||
)
|
||||
renamedOptions;
|
||||
in {
|
||||
imports =
|
||||
renameWarnings
|
||||
++ [
|
||||
(mkRemovedOptionModule
|
||||
(
|
||||
mkRenamedOptionModule
|
||||
(oldPluginBasePath ++ ["enable"])
|
||||
(newPluginBasePath ++ ["enable"])
|
||||
oldPluginBasePath
|
||||
++ [
|
||||
"snippet"
|
||||
"expand"
|
||||
]
|
||||
)
|
||||
''
|
||||
Use `plugins.cmp.settings.snippet.expand` option. But watch out, you can no longer put only the name of the snippet engine.
|
||||
If you use `luasnip` for instance, set:
|
||||
```
|
||||
plugins.cmp.settings.snippet.expand = "function(args) require('luasnip').lsp_expand(args.body) end";
|
||||
```
|
||||
''
|
||||
)
|
||||
(mkRemovedOptionModule
|
||||
(
|
||||
mkRenamedOptionModule
|
||||
(oldPluginBasePath ++ ["autoEnableSources"])
|
||||
(newPluginBasePath ++ ["autoEnableSources"])
|
||||
oldPluginBasePath
|
||||
++ [
|
||||
"sorting"
|
||||
"comparators"
|
||||
]
|
||||
)
|
||||
(
|
||||
mkRemovedOptionModule
|
||||
(oldPluginBasePath ++ ["preselect"])
|
||||
''
|
||||
Use `plugins.cmp.settings.preselect` option. But watch out, you now have to explicitly write `cmp.PreselectMode.<mode>`.
|
||||
See the option documentation for more details.
|
||||
''
|
||||
)
|
||||
(
|
||||
mkRemovedOptionModule
|
||||
(oldPluginBasePath ++ ["mappingPresets"])
|
||||
"If you want to have a complex mapping logic, express it in raw lua within the `plugins.cmp.settings.mapping` option."
|
||||
)
|
||||
(
|
||||
mkRemovedOptionModule
|
||||
(oldPluginBasePath ++ ["snippet" "expand"])
|
||||
''
|
||||
Use `plugins.cmp.settings.snippet.expand` option. But watch out, you can no longer put only the name of the snippet engine.
|
||||
If you use `luasnip` for instance, set:
|
||||
```
|
||||
plugins.cmp.settings.snippet.expand = "function(args) require('luasnip').lsp_expand(args.body) end";
|
||||
```
|
||||
''
|
||||
)
|
||||
(
|
||||
mkRemovedOptionModule
|
||||
(oldPluginBasePath ++ ["sorting" "comparators"])
|
||||
''
|
||||
Use `plugins.cmp.settings.sorting.comparators` option. But watch out, you can no longer put only the name of the comparators.
|
||||
See the option documentation for more details.
|
||||
''
|
||||
)
|
||||
(
|
||||
mkRemovedOptionModule
|
||||
(oldPluginBasePath ++ ["sources"])
|
||||
''
|
||||
Use `plugins.cmp.settings.sources` option. But watch out, you can no longer provide a list of lists of sources.
|
||||
For this type of use, directly write lua.
|
||||
See the option documentation for more details.
|
||||
''
|
||||
)
|
||||
];
|
||||
''
|
||||
Use `plugins.cmp.settings.sorting.comparators` option. But watch out, you can no longer put only the name of the comparators.
|
||||
See the option documentation for more details.
|
||||
''
|
||||
)
|
||||
(mkRemovedOptionModule (oldPluginBasePath ++ [ "sources" ]) ''
|
||||
Use `plugins.cmp.settings.sources` option. But watch out, you can no longer provide a list of lists of sources.
|
||||
For this type of use, directly write lua.
|
||||
See the option documentation for more details.
|
||||
'')
|
||||
];
|
||||
}
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
}:
|
||||
with lib; rec {
|
||||
settingsOptions = import ./settings-options.nix {inherit lib helpers;};
|
||||
{ lib, helpers }:
|
||||
with lib;
|
||||
rec {
|
||||
settingsOptions = import ./settings-options.nix { inherit lib helpers; };
|
||||
|
||||
settingsExample = {
|
||||
snippet.expand = "function(args) require('luasnip').lsp_expand(args.body) end";
|
||||
|
@ -29,46 +27,44 @@ with lib; rec {
|
|||
'';
|
||||
};
|
||||
|
||||
attrsOfOptions = with types;
|
||||
attrsOf (
|
||||
submodule {
|
||||
freeformType = attrsOf anything;
|
||||
options = settingsOptions;
|
||||
}
|
||||
);
|
||||
attrsOfOptions =
|
||||
with types;
|
||||
attrsOf (submodule {
|
||||
freeformType = attrsOf anything;
|
||||
options = settingsOptions;
|
||||
});
|
||||
|
||||
filetype = mkOption {
|
||||
type = attrsOfOptions;
|
||||
default = {};
|
||||
default = { };
|
||||
description = "Options for `cmp.filetype()`.";
|
||||
example = {
|
||||
python = {
|
||||
sources = [
|
||||
{name = "nvim_lsp";}
|
||||
];
|
||||
sources = [ { name = "nvim_lsp"; } ];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
cmdline = mkOption {
|
||||
type = attrsOfOptions;
|
||||
default = {};
|
||||
default = { };
|
||||
description = "Options for `cmp.cmdline()`.";
|
||||
example = {
|
||||
"/" = {
|
||||
mapping.__raw = "cmp.mapping.preset.cmdline()";
|
||||
sources = [
|
||||
{name = "buffer";}
|
||||
];
|
||||
sources = [ { name = "buffer"; } ];
|
||||
};
|
||||
":" = {
|
||||
mapping.__raw = "cmp.mapping.preset.cmdline()";
|
||||
sources = [
|
||||
{name = "path";}
|
||||
{ name = "path"; }
|
||||
{
|
||||
name = "cmdline";
|
||||
option = {
|
||||
ignore_cmds = ["Man" "!"];
|
||||
ignore_cmds = [
|
||||
"Man"
|
||||
"!"
|
||||
];
|
||||
};
|
||||
}
|
||||
];
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
{ lib, helpers }:
|
||||
with lib;
|
||||
{
|
||||
lib,
|
||||
helpers,
|
||||
}:
|
||||
with lib; {
|
||||
performance = {
|
||||
debounce = helpers.defaultNullOpts.mkUnsignedInt 60 ''
|
||||
Sets debounce time.
|
||||
|
@ -39,16 +37,16 @@ with lib; {
|
|||
'';
|
||||
|
||||
mapping = mkOption {
|
||||
default = {};
|
||||
type = with helpers.nixvimTypes;
|
||||
maybeRaw
|
||||
(attrsOf strLua);
|
||||
apply = v:
|
||||
# Handle the raw case first
|
||||
if helpers.nixvimTypes.isRawType v
|
||||
then v
|
||||
default = { };
|
||||
type = with helpers.nixvimTypes; maybeRaw (attrsOf strLua);
|
||||
apply =
|
||||
v:
|
||||
# Handle the raw case first
|
||||
if helpers.nixvimTypes.isRawType v then
|
||||
v
|
||||
# When v is an attrs **but not {__raw = ...}**
|
||||
else mapAttrs (_: helpers.mkRaw) v;
|
||||
else
|
||||
mapAttrs (_: helpers.mkRaw) v;
|
||||
example = {
|
||||
"<C-d>" = "cmp.mapping.scroll_docs(-4)";
|
||||
"<C-f>" = "cmp.mapping.scroll_docs(4)";
|
||||
|
@ -110,24 +108,16 @@ with lib; {
|
|||
The number of characters needed to trigger auto-completion.
|
||||
'';
|
||||
|
||||
keyword_pattern =
|
||||
helpers.defaultNullOpts.mkLua
|
||||
''[[\%(-\?\d\+\%(\.\d\+\)\?\|\h\w*\%(-\w*\)*\)]]''
|
||||
"The default keyword pattern.";
|
||||
keyword_pattern = helpers.defaultNullOpts.mkLua ''[[\%(-\?\d\+\%(\.\d\+\)\?\|\h\w*\%(-\w*\)*\)]]'' "The default keyword pattern.";
|
||||
|
||||
autocomplete =
|
||||
helpers.defaultNullOpts.mkNullable
|
||||
(
|
||||
with helpers.nixvimTypes;
|
||||
either
|
||||
(enum [false])
|
||||
(listOf strLua)
|
||||
)
|
||||
''["require('cmp.types').cmp.TriggerEvent.TextChanged"]''
|
||||
''
|
||||
The event to trigger autocompletion.
|
||||
If set to `false`, then completion is only invoked manually (e.g. by calling `cmp.complete`).
|
||||
'';
|
||||
(with helpers.nixvimTypes; either (enum [ false ]) (listOf strLua))
|
||||
''["require('cmp.types').cmp.TriggerEvent.TextChanged"]''
|
||||
''
|
||||
The event to trigger autocompletion.
|
||||
If set to `false`, then completion is only invoked manually (e.g. by calling `cmp.complete`).
|
||||
'';
|
||||
|
||||
completeopt = helpers.defaultNullOpts.mkStr "menu,menuone,noselect" ''
|
||||
Like vim's completeopt setting.
|
||||
|
@ -138,15 +128,15 @@ with lib; {
|
|||
confirmation = {
|
||||
get_commit_characters =
|
||||
helpers.defaultNullOpts.mkLuaFn
|
||||
''
|
||||
function(commit_characters)
|
||||
return commit_characters
|
||||
end
|
||||
''
|
||||
''
|
||||
You can append or exclude `commitCharacters` via this configuration option function.
|
||||
The `commitCharacters` are defined by the LSP spec.
|
||||
'';
|
||||
''
|
||||
function(commit_characters)
|
||||
return commit_characters
|
||||
end
|
||||
''
|
||||
''
|
||||
You can append or exclude `commitCharacters` via this configuration option function.
|
||||
The `commitCharacters` are defined by the LSP spec.
|
||||
'';
|
||||
};
|
||||
|
||||
formatting = {
|
||||
|
@ -160,21 +150,21 @@ with lib; {
|
|||
|
||||
format =
|
||||
helpers.defaultNullOpts.mkLuaFn
|
||||
''
|
||||
function(_, vim_item)
|
||||
return vim_item
|
||||
end
|
||||
''
|
||||
''
|
||||
`fun(entry: cmp.Entry, vim_item: vim.CompletedItem): vim.CompletedItem`
|
||||
''
|
||||
function(_, vim_item)
|
||||
return vim_item
|
||||
end
|
||||
''
|
||||
''
|
||||
`fun(entry: cmp.Entry, vim_item: vim.CompletedItem): vim.CompletedItem`
|
||||
|
||||
The function used to customize the appearance of the completion menu.
|
||||
See `|complete-items|`.
|
||||
This value can also be used to modify the `dup` property.
|
||||
The function used to customize the appearance of the completion menu.
|
||||
See `|complete-items|`.
|
||||
This value can also be used to modify the `dup` property.
|
||||
|
||||
NOTE: The `vim.CompletedItem` can contain the special properties `abbr_hl_group`,
|
||||
`kind_hl_group` and `menu_hl_group`.
|
||||
'';
|
||||
NOTE: The `vim.CompletedItem` can contain the special properties `abbr_hl_group`,
|
||||
`kind_hl_group` and `menu_hl_group`.
|
||||
'';
|
||||
};
|
||||
|
||||
matching = {
|
||||
|
@ -210,12 +200,7 @@ with lib; {
|
|||
|
||||
comparators = mkOption {
|
||||
type = with helpers.nixvimTypes; nullOr (listOf strLuaFn);
|
||||
apply = v:
|
||||
helpers.ifNonNull' v (
|
||||
map
|
||||
helpers.mkRaw
|
||||
v
|
||||
);
|
||||
apply = v: helpers.ifNonNull' v (map helpers.mkRaw v);
|
||||
default = null;
|
||||
description = ''
|
||||
The function to customize the sorting behavior.
|
||||
|
@ -240,26 +225,20 @@ with lib; {
|
|||
};
|
||||
};
|
||||
|
||||
sources = import ./sources-option.nix {inherit lib helpers;};
|
||||
sources = import ./sources-option.nix { inherit lib helpers; };
|
||||
|
||||
view = {
|
||||
entries =
|
||||
helpers.defaultNullOpts.mkNullable
|
||||
(
|
||||
with types;
|
||||
either
|
||||
str
|
||||
(attrsOf anything)
|
||||
)
|
||||
''
|
||||
{
|
||||
name = "custom";
|
||||
selection_order = "top_down";
|
||||
}
|
||||
''
|
||||
''
|
||||
The view class used to customize nvim-cmp's appearance.
|
||||
'';
|
||||
helpers.defaultNullOpts.mkNullable (with types; either str (attrsOf anything))
|
||||
''
|
||||
{
|
||||
name = "custom";
|
||||
selection_order = "top_down";
|
||||
}
|
||||
''
|
||||
''
|
||||
The view class used to customize nvim-cmp's appearance.
|
||||
'';
|
||||
|
||||
docs = {
|
||||
auto_open = helpers.defaultNullOpts.mkBool true ''
|
||||
|
@ -268,79 +247,71 @@ with lib; {
|
|||
};
|
||||
};
|
||||
|
||||
window = let
|
||||
mkWinhighlightOption = default:
|
||||
helpers.defaultNullOpts.mkStr
|
||||
default
|
||||
''
|
||||
Specify the window's winhighlight option.
|
||||
window =
|
||||
let
|
||||
mkWinhighlightOption =
|
||||
default:
|
||||
helpers.defaultNullOpts.mkStr default ''
|
||||
Specify the window's winhighlight option.
|
||||
See `|nvim_open_win|`.
|
||||
'';
|
||||
|
||||
zindex = helpers.mkNullOrOption types.ints.unsigned ''
|
||||
The window's zindex.
|
||||
See `|nvim_open_win|`.
|
||||
'';
|
||||
in
|
||||
{
|
||||
completion = {
|
||||
border =
|
||||
helpers.defaultNullOpts.mkBorder ''[ "" "" "" "" "" "" "" "" ]'' "nvim-cmp completion popup menu"
|
||||
"";
|
||||
|
||||
zindex = helpers.mkNullOrOption types.ints.unsigned ''
|
||||
The window's zindex.
|
||||
See `|nvim_open_win|`.
|
||||
'';
|
||||
in {
|
||||
completion = {
|
||||
border =
|
||||
helpers.defaultNullOpts.mkBorder
|
||||
''[ "" "" "" "" "" "" "" "" ]''
|
||||
"nvim-cmp completion popup menu"
|
||||
"";
|
||||
winhighlight = mkWinhighlightOption "Normal:Pmenu,FloatBorder:Pmenu,CursorLine:PmenuSel,Search:None";
|
||||
|
||||
winhighlight =
|
||||
mkWinhighlightOption
|
||||
"Normal:Pmenu,FloatBorder:Pmenu,CursorLine:PmenuSel,Search:None";
|
||||
inherit zindex;
|
||||
|
||||
inherit zindex;
|
||||
scrolloff = helpers.defaultNullOpts.mkUnsignedInt 0 ''
|
||||
Specify the window's scrolloff option.
|
||||
See |'scrolloff'|.
|
||||
'';
|
||||
|
||||
scrolloff = helpers.defaultNullOpts.mkUnsignedInt 0 ''
|
||||
Specify the window's scrolloff option.
|
||||
See |'scrolloff'|.
|
||||
'';
|
||||
col_offset = helpers.defaultNullOpts.mkInt 0 ''
|
||||
Offsets the completion window relative to the cursor.
|
||||
'';
|
||||
|
||||
col_offset = helpers.defaultNullOpts.mkInt 0 ''
|
||||
Offsets the completion window relative to the cursor.
|
||||
'';
|
||||
side_padding = helpers.defaultNullOpts.mkUnsignedInt 1 ''
|
||||
The amount of padding to add on the completion window's sides.
|
||||
'';
|
||||
|
||||
side_padding = helpers.defaultNullOpts.mkUnsignedInt 1 ''
|
||||
The amount of padding to add on the completion window's sides.
|
||||
'';
|
||||
scrollbar = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether the scrollbar should be enabled if there are more items that fit.
|
||||
'';
|
||||
};
|
||||
|
||||
scrollbar = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether the scrollbar should be enabled if there are more items that fit.
|
||||
'';
|
||||
};
|
||||
documentation = {
|
||||
border =
|
||||
helpers.defaultNullOpts.mkBorder ''[ "" "" "" " " "" "" "" " " ]''
|
||||
"nvim-cmp documentation popup menu"
|
||||
"";
|
||||
|
||||
documentation = {
|
||||
border =
|
||||
helpers.defaultNullOpts.mkBorder
|
||||
''[ "" "" "" " " "" "" "" " " ]''
|
||||
"nvim-cmp documentation popup menu"
|
||||
"";
|
||||
winhighlight = mkWinhighlightOption "FloatBorder:NormalFloat";
|
||||
|
||||
winhighlight = mkWinhighlightOption "FloatBorder:NormalFloat";
|
||||
inherit zindex;
|
||||
|
||||
inherit zindex;
|
||||
|
||||
max_width =
|
||||
helpers.mkNullOrStrLuaOr types.ints.unsigned
|
||||
''
|
||||
max_width = helpers.mkNullOrStrLuaOr types.ints.unsigned ''
|
||||
The documentation window's max width.
|
||||
|
||||
Default: "math.floor((40 * 2) * (vim.o.columns / (40 * 2 * 16 / 9)))"
|
||||
'';
|
||||
|
||||
max_height =
|
||||
helpers.mkNullOrStrLuaOr types.ints.unsigned
|
||||
''
|
||||
max_height = helpers.mkNullOrStrLuaOr types.ints.unsigned ''
|
||||
The documentation window's max height.
|
||||
|
||||
Default: "math.floor(40 * (40 / vim.o.lines))"
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# This can be kept as types.attrs since experimental features are often removed or completely
|
||||
# changed after a while
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
}:
|
||||
with lib; let
|
||||
{ lib, helpers }:
|
||||
with lib;
|
||||
let
|
||||
sourceType = types.submodule {
|
||||
freeformType = with types; attrsOf anything;
|
||||
options = {
|
||||
|
@ -81,27 +79,26 @@ with lib; let
|
|||
};
|
||||
};
|
||||
in
|
||||
mkOption {
|
||||
default = [];
|
||||
type = with helpers.nixvimTypes;
|
||||
maybeRaw (listOf sourceType);
|
||||
description = ''
|
||||
The sources to use.
|
||||
Can either be a list of `sourceConfigs` which will be made directly to a Lua object.
|
||||
Or it can be a raw lua string which might be necessary for more advanced use cases.
|
||||
mkOption {
|
||||
default = [ ];
|
||||
type = with helpers.nixvimTypes; maybeRaw (listOf sourceType);
|
||||
description = ''
|
||||
The sources to use.
|
||||
Can either be a list of `sourceConfigs` which will be made directly to a Lua object.
|
||||
Or it can be a raw lua string which might be necessary for more advanced use cases.
|
||||
|
||||
WARNING:
|
||||
If `plugins.cmp.autoEnableSources` Nixivm will automatically enable the corresponding source
|
||||
plugins. This will work only when this option is set to a list.
|
||||
If you use a raw lua string, you will need to explicitly enable the relevant source plugins in
|
||||
your nixvim configuration.
|
||||
WARNING:
|
||||
If `plugins.cmp.autoEnableSources` Nixivm will automatically enable the corresponding source
|
||||
plugins. This will work only when this option is set to a list.
|
||||
If you use a raw lua string, you will need to explicitly enable the relevant source plugins in
|
||||
your nixvim configuration.
|
||||
|
||||
Default: `[]`
|
||||
'';
|
||||
example = [
|
||||
{name = "nvim_lsp";}
|
||||
{name = "luasnip";}
|
||||
{name = "path";}
|
||||
{name = "buffer";}
|
||||
];
|
||||
}
|
||||
Default: `[]`
|
||||
'';
|
||||
example = [
|
||||
{ name = "nvim_lsp"; }
|
||||
{ name = "luasnip"; }
|
||||
{ name = "path"; }
|
||||
{ name = "buffer"; }
|
||||
];
|
||||
}
|
||||
|
|
|
@ -4,10 +4,12 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.cmp-fish;
|
||||
in {
|
||||
meta.maintainers = [maintainers.GaetanLepage];
|
||||
in
|
||||
{
|
||||
meta.maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
options.plugins.cmp-fish = {
|
||||
fishPackage = mkOption {
|
||||
|
@ -21,7 +23,5 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
extraPackages = [cfg.fishPackage];
|
||||
};
|
||||
config = mkIf cfg.enable { extraPackages = [ cfg.fishPackage ]; };
|
||||
}
|
||||
|
|
|
@ -4,9 +4,11 @@
|
|||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.cmp-git;
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.plugins.cmp-git.settings = helpers.neovim-plugin.mkSettingsOption {
|
||||
pluginName = "cmp_git";
|
||||
options = {
|
||||
|
@ -30,13 +32,13 @@ in {
|
|||
|
||||
sort_by =
|
||||
helpers.defaultNullOpts.mkNullable types.anything
|
||||
''{__raw = "require('cmp_git.sort').git.commits";}''
|
||||
"Function used to sort the commits.";
|
||||
''{__raw = "require('cmp_git.sort').git.commits";}''
|
||||
"Function used to sort the commits.";
|
||||
|
||||
format =
|
||||
helpers.defaultNullOpts.mkNullable types.anything
|
||||
''{__raw = "require('cmp_git.format').git.commits";}''
|
||||
"Function used to format the commits.";
|
||||
''{__raw = "require('cmp_git.format').git.commits";}''
|
||||
"Function used to format the commits.";
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -47,9 +49,8 @@ in {
|
|||
|
||||
issues = {
|
||||
fields =
|
||||
helpers.defaultNullOpts.mkListOf types.str
|
||||
''["title" "number" "body" "updatedAt" "state"]''
|
||||
"The fields used for issues.";
|
||||
helpers.defaultNullOpts.mkListOf types.str ''["title" "number" "body" "updatedAt" "state"]''
|
||||
"The fields used for issues.";
|
||||
|
||||
filter = helpers.defaultNullOpts.mkStr "all" ''
|
||||
The filter to use when fetching issues.
|
||||
|
@ -65,13 +66,13 @@ in {
|
|||
|
||||
sort_by =
|
||||
helpers.defaultNullOpts.mkNullable types.anything
|
||||
''{__raw = "require('cmp_git.sort').github.issues";}''
|
||||
"Function used to sort the issues.";
|
||||
''{__raw = "require('cmp_git.sort').github.issues";}''
|
||||
"Function used to sort the issues.";
|
||||
|
||||
format =
|
||||
helpers.defaultNullOpts.mkNullable types.anything
|
||||
''{__raw = "require('cmp_git.format').github.issues";}''
|
||||
"Function used to format the issues.";
|
||||
''{__raw = "require('cmp_git.format').github.issues";}''
|
||||
"Function used to format the issues.";
|
||||
};
|
||||
|
||||
mentions = {
|
||||
|
@ -81,20 +82,19 @@ in {
|
|||
|
||||
sort_by =
|
||||
helpers.defaultNullOpts.mkNullable types.anything
|
||||
''{__raw = "require('cmp_git.sort').github.mentions";}''
|
||||
"Function used to sort the mentions.";
|
||||
''{__raw = "require('cmp_git.sort').github.mentions";}''
|
||||
"Function used to sort the mentions.";
|
||||
|
||||
format =
|
||||
helpers.defaultNullOpts.mkNullable types.anything
|
||||
''{__raw = "require('cmp_git.format').github.mentions";}''
|
||||
"Function used to format the mentions.";
|
||||
''{__raw = "require('cmp_git.format').github.mentions";}''
|
||||
"Function used to format the mentions.";
|
||||
};
|
||||
|
||||
pull_requests = {
|
||||
fields =
|
||||
helpers.defaultNullOpts.mkListOf types.str
|
||||
''["title" "number" "body" "updatedAt" "state"]''
|
||||
"The fields used for pull requests.";
|
||||
helpers.defaultNullOpts.mkListOf types.str ''["title" "number" "body" "updatedAt" "state"]''
|
||||
"The fields used for pull requests.";
|
||||
|
||||
limit = helpers.defaultNullOpts.mkUnsignedInt 100 ''
|
||||
Max number of pull requests to fetch.
|
||||
|
@ -106,13 +106,13 @@ in {
|
|||
|
||||
sort_by =
|
||||
helpers.defaultNullOpts.mkNullable types.anything
|
||||
''{__raw = "require('cmp_git.sort').github.pull_requests";}''
|
||||
"Function used to sort the pull requests.";
|
||||
''{__raw = "require('cmp_git.sort').github.pull_requests";}''
|
||||
"Function used to sort the pull requests.";
|
||||
|
||||
format =
|
||||
helpers.defaultNullOpts.mkNullable types.anything
|
||||
''{__raw = "require('cmp_git.format').github.pull_requests";}''
|
||||
"Function used to format the pull requests.";
|
||||
''{__raw = "require('cmp_git.format').github.pull_requests";}''
|
||||
"Function used to format the pull requests.";
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -132,13 +132,13 @@ in {
|
|||
|
||||
sort_by =
|
||||
helpers.defaultNullOpts.mkNullable types.anything
|
||||
''{__raw = "require('cmp_git.sort').gitlab.issues";}''
|
||||
"Function used to sort the issues.";
|
||||
''{__raw = "require('cmp_git.sort').gitlab.issues";}''
|
||||
"Function used to sort the issues.";
|
||||
|
||||
format =
|
||||
helpers.defaultNullOpts.mkNullable types.anything
|
||||
''{__raw = "require('cmp_git.format').gitlab.issues";}''
|
||||
"Function used to format the issues.";
|
||||
''{__raw = "require('cmp_git.format').gitlab.issues";}''
|
||||
"Function used to format the issues.";
|
||||
};
|
||||
|
||||
mentions = {
|
||||
|
@ -148,13 +148,13 @@ in {
|
|||
|
||||
sort_by =
|
||||
helpers.defaultNullOpts.mkNullable types.anything
|
||||
''{__raw = "require('cmp_git.sort').gitlab.mentions";}''
|
||||
"Function used to sort the mentions.";
|
||||
''{__raw = "require('cmp_git.sort').gitlab.mentions";}''
|
||||
"Function used to sort the mentions.";
|
||||
|
||||
format =
|
||||
helpers.defaultNullOpts.mkNullable types.anything
|
||||
''{__raw = "require('cmp_git.format').gitlab.mentions";}''
|
||||
"Function used to format the mentions.";
|
||||
''{__raw = "require('cmp_git.format').gitlab.mentions";}''
|
||||
"Function used to format the mentions.";
|
||||
};
|
||||
|
||||
merge_requests = {
|
||||
|
@ -168,114 +168,118 @@ in {
|
|||
|
||||
sort_by =
|
||||
helpers.defaultNullOpts.mkNullable types.anything
|
||||
''{__raw = "require('cmp_git.sort').gitlab.merge_requests";}''
|
||||
"Function used to sort the merge requests.";
|
||||
''{__raw = "require('cmp_git.sort').gitlab.merge_requests";}''
|
||||
"Function used to sort the merge requests.";
|
||||
|
||||
format =
|
||||
helpers.defaultNullOpts.mkNullable types.anything
|
||||
''{__raw = "require('cmp_git.format').gitlab.merge_requests";}''
|
||||
"Function used to format the merge requests.";
|
||||
''{__raw = "require('cmp_git.format').gitlab.merge_requests";}''
|
||||
"Function used to format the merge requests.";
|
||||
};
|
||||
};
|
||||
|
||||
trigger_actions =
|
||||
helpers.defaultNullOpts.mkListOf
|
||||
(types.submodule {
|
||||
options = {
|
||||
debug_name = helpers.mkNullOrStr "Debug name.";
|
||||
(types.submodule {
|
||||
options = {
|
||||
debug_name = helpers.mkNullOrStr "Debug name.";
|
||||
|
||||
trigger_character = mkOption {
|
||||
type = types.str;
|
||||
example = ":";
|
||||
description = ''
|
||||
The trigger character.
|
||||
Has to be a single character
|
||||
'';
|
||||
};
|
||||
trigger_character = mkOption {
|
||||
type = types.str;
|
||||
example = ":";
|
||||
description = ''
|
||||
The trigger character.
|
||||
Has to be a single character
|
||||
'';
|
||||
};
|
||||
|
||||
action = mkOption {
|
||||
type = helpers.nixvimTypes.strLuaFn;
|
||||
apply = helpers.mkRaw;
|
||||
description = ''
|
||||
The parameters to the action function are the different sources (currently `git`,
|
||||
`gitlab` and `github`), the completion callback, the trigger character, the
|
||||
parameters passed to complete from nvim-cmp, and the current git info.
|
||||
'';
|
||||
example = ''
|
||||
function(sources, trigger_char, callback, params, git_info)
|
||||
return sources.git:get_commits(callback, params, trigger_char)
|
||||
end
|
||||
'';
|
||||
action = mkOption {
|
||||
type = helpers.nixvimTypes.strLuaFn;
|
||||
apply = helpers.mkRaw;
|
||||
description = ''
|
||||
The parameters to the action function are the different sources (currently `git`,
|
||||
`gitlab` and `github`), the completion callback, the trigger character, the
|
||||
parameters passed to complete from nvim-cmp, and the current git info.
|
||||
'';
|
||||
example = ''
|
||||
function(sources, trigger_char, callback, params, git_info)
|
||||
return sources.git:get_commits(callback, params, trigger_char)
|
||||
end
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
})
|
||||
''
|
||||
[
|
||||
{
|
||||
debug_name = "git_commits";
|
||||
trigger_character = ":";
|
||||
action = \'\'
|
||||
function(sources, trigger_char, callback, params, git_info)
|
||||
return sources.git:get_commits(callback, params, trigger_char)
|
||||
end
|
||||
\'\';
|
||||
}
|
||||
{
|
||||
debug_name = "gitlab_issues";
|
||||
trigger_character = "#";
|
||||
action = \'\'
|
||||
function(sources, trigger_char, callback, params, git_info)
|
||||
return sources.gitlab:get_issues(callback, git_info, trigger_char)
|
||||
end
|
||||
\'\';
|
||||
}
|
||||
{
|
||||
debug_name = "gitlab_mentions";
|
||||
trigger_character = "@";
|
||||
action = \'\'
|
||||
function(sources, trigger_char, callback, params, git_info)
|
||||
return sources.gitlab:get_mentions(callback, git_info, trigger_char)
|
||||
end
|
||||
\'\';
|
||||
}
|
||||
{
|
||||
debug_name = "gitlab_mrs";
|
||||
trigger_character = "!";
|
||||
action = \'\'
|
||||
function(sources, trigger_char, callback, params, git_info)
|
||||
return sources.gitlab:get_merge_requests(callback, git_info, trigger_char)
|
||||
end
|
||||
\'\';
|
||||
}
|
||||
{
|
||||
debug_name = "github_issues_and_pr";
|
||||
trigger_character = "#";
|
||||
action = \'\'
|
||||
function(sources, trigger_char, callback, params, git_info)
|
||||
return sources.github:get_issues_and_prs(callback, git_info, trigger_char)
|
||||
end
|
||||
\'\';
|
||||
}
|
||||
{
|
||||
debug_name = "github_mentions";
|
||||
trigger_character = "@";
|
||||
action = \'\'
|
||||
function(sources, trigger_char, callback, params, git_info)
|
||||
return sources.github:get_mentions(callback, git_info, trigger_char)
|
||||
end
|
||||
\'\';
|
||||
}
|
||||
]
|
||||
''
|
||||
''
|
||||
If you want specific behaviour for a trigger or new behaviour for a trigger, you need to
|
||||
add an entry in the `trigger_actions` list of the config.
|
||||
The two necessary fields are the `trigger_character` and the `action`.
|
||||
'';
|
||||
})
|
||||
''
|
||||
[
|
||||
{
|
||||
debug_name = "git_commits";
|
||||
trigger_character = ":";
|
||||
action = \'\'
|
||||
function(sources, trigger_char, callback, params, git_info)
|
||||
return sources.git:get_commits(callback, params, trigger_char)
|
||||
end
|
||||
\'\';
|
||||
}
|
||||
{
|
||||
debug_name = "gitlab_issues";
|
||||
trigger_character = "#";
|
||||
action = \'\'
|
||||
function(sources, trigger_char, callback, params, git_info)
|
||||
return sources.gitlab:get_issues(callback, git_info, trigger_char)
|
||||
end
|
||||
\'\';
|
||||
}
|
||||
{
|
||||
debug_name = "gitlab_mentions";
|
||||
trigger_character = "@";
|
||||
action = \'\'
|
||||
function(sources, trigger_char, callback, params, git_info)
|
||||
return sources.gitlab:get_mentions(callback, git_info, trigger_char)
|
||||
end
|
||||
\'\';
|
||||
}
|
||||
{
|
||||
debug_name = "gitlab_mrs";
|
||||
trigger_character = "!";
|
||||
action = \'\'
|
||||
function(sources, trigger_char, callback, params, git_info)
|
||||
return sources.gitlab:get_merge_requests(callback, git_info, trigger_char)
|
||||
end
|
||||
\'\';
|
||||
}
|
||||
{
|
||||
debug_name = "github_issues_and_pr";
|
||||
trigger_character = "#";
|
||||
action = \'\'
|
||||
function(sources, trigger_char, callback, params, git_info)
|
||||
return sources.github:get_issues_and_prs(callback, git_info, trigger_char)
|
||||
end
|
||||
\'\';
|
||||
}
|
||||
{
|
||||
debug_name = "github_mentions";
|
||||
trigger_character = "@";
|
||||
action = \'\'
|
||||
function(sources, trigger_char, callback, params, git_info)
|
||||
return sources.github:get_mentions(callback, git_info, trigger_char)
|
||||
end
|
||||
\'\';
|
||||
}
|
||||
]
|
||||
''
|
||||
''
|
||||
If you want specific behaviour for a trigger or new behaviour for a trigger, you need to
|
||||
add an entry in the `trigger_actions` list of the config.
|
||||
The two necessary fields are the `trigger_character` and the `action`.
|
||||
'';
|
||||
};
|
||||
|
||||
example = {
|
||||
remotes = ["upstream" "origin" "foo"];
|
||||
remotes = [
|
||||
"upstream"
|
||||
"origin"
|
||||
"foo"
|
||||
];
|
||||
github.issues = {
|
||||
filter = "all";
|
||||
limit = 250;
|
||||
|
|
|
@ -4,41 +4,44 @@
|
|||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.cmp-tabby;
|
||||
in {
|
||||
meta.maintainers = [maintainers.GaetanLepage];
|
||||
in
|
||||
{
|
||||
meta.maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
options.plugins.cmp-tabby =
|
||||
helpers.neovim-plugin.extraOptionsOptions
|
||||
// {
|
||||
host = helpers.defaultNullOpts.mkStr "http://localhost:5000" ''
|
||||
The address of the tabby host server.
|
||||
'';
|
||||
options.plugins.cmp-tabby = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
host = helpers.defaultNullOpts.mkStr "http://localhost:5000" ''
|
||||
The address of the tabby host server.
|
||||
'';
|
||||
|
||||
maxLines = helpers.defaultNullOpts.mkUnsignedInt 100 ''
|
||||
The max number of lines to complete.
|
||||
'';
|
||||
maxLines = helpers.defaultNullOpts.mkUnsignedInt 100 ''
|
||||
The max number of lines to complete.
|
||||
'';
|
||||
|
||||
runOnEveryKeyStroke = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to run the completion on every keystroke.
|
||||
'';
|
||||
runOnEveryKeyStroke = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to run the completion on every keystroke.
|
||||
'';
|
||||
|
||||
stop = helpers.defaultNullOpts.mkListOf types.str ''["\n"]'' "";
|
||||
};
|
||||
stop = helpers.defaultNullOpts.mkListOf types.str ''["\n"]'' "";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
extraConfigLua = let
|
||||
setupOptions = with cfg;
|
||||
{
|
||||
inherit host;
|
||||
max_lines = maxLines;
|
||||
run_on_every_keystroke = runOnEveryKeyStroke;
|
||||
inherit stop;
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
in ''
|
||||
require('cmp_tabby.config'):setup(${helpers.toLuaObject setupOptions})
|
||||
'';
|
||||
extraConfigLua =
|
||||
let
|
||||
setupOptions =
|
||||
with cfg;
|
||||
{
|
||||
inherit host;
|
||||
max_lines = maxLines;
|
||||
run_on_every_keystroke = runOnEveryKeyStroke;
|
||||
inherit stop;
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
in
|
||||
''
|
||||
require('cmp_tabby.config'):setup(${helpers.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -4,9 +4,11 @@
|
|||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.cmp-tabnine;
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.plugins.cmp-tabnine = helpers.neovim-plugin.extraOptionsOptions;
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
|
|
@ -5,85 +5,79 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.codeium-nvim;
|
||||
in {
|
||||
meta.maintainers = [maintainers.GaetanLepage];
|
||||
in
|
||||
{
|
||||
meta.maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
options.plugins.codeium-nvim =
|
||||
helpers.neovim-plugin.extraOptionsOptions
|
||||
// {
|
||||
package = helpers.mkPackageOption "codeium.nvim" pkgs.vimPlugins.codeium-nvim;
|
||||
options.plugins.codeium-nvim = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
package = helpers.mkPackageOption "codeium.nvim" pkgs.vimPlugins.codeium-nvim;
|
||||
|
||||
configPath =
|
||||
helpers.defaultNullOpts.mkStr
|
||||
''{__raw = "vim.fn.stdpath('cache') .. '/codeium/config.json'";}''
|
||||
"The path to the config file, used to store the API key.";
|
||||
configPath = helpers.defaultNullOpts.mkStr ''{__raw = "vim.fn.stdpath('cache') .. '/codeium/config.json'";}'' "The path to the config file, used to store the API key.";
|
||||
|
||||
binPath =
|
||||
helpers.defaultNullOpts.mkStr
|
||||
''{__raw = "vim.fn.stdpath('cache') .. '/codeium/bin'";}''
|
||||
"The path to the directory where the Codeium server will be downloaded to.";
|
||||
binPath = helpers.defaultNullOpts.mkStr ''{__raw = "vim.fn.stdpath('cache') .. '/codeium/bin'";}'' "The path to the directory where the Codeium server will be downloaded to.";
|
||||
|
||||
api = {
|
||||
host = helpers.defaultNullOpts.mkStr "server.codeium.com" ''
|
||||
The hostname of the API server to use.
|
||||
'';
|
||||
api = {
|
||||
host = helpers.defaultNullOpts.mkStr "server.codeium.com" ''
|
||||
The hostname of the API server to use.
|
||||
'';
|
||||
|
||||
port = helpers.defaultNullOpts.mkPositiveInt 443 ''
|
||||
The port of the API server to use.
|
||||
'';
|
||||
};
|
||||
|
||||
tools = {
|
||||
uname = helpers.mkNullOrOption types.str "The path to the `uname` binary.";
|
||||
|
||||
uuidgen = helpers.mkNullOrOption types.str "The path to the `uuidgen` binary.";
|
||||
|
||||
curl = helpers.mkNullOrOption types.str "The path to the `curl` binary.";
|
||||
|
||||
gzip = helpers.mkNullOrOption types.str "The path to the `gzip` binary.";
|
||||
|
||||
languageServer = helpers.mkNullOrOption types.str ''
|
||||
The path to the language server downloaded from the official source.
|
||||
'';
|
||||
};
|
||||
|
||||
wrapper = helpers.mkNullOrOption types.str ''
|
||||
The path to a wrapper script/binary that is used to execute any binaries not listed under
|
||||
tools.
|
||||
This is primarily useful for NixOS, where a FHS wrapper can be used for the downloaded
|
||||
codeium server.
|
||||
port = helpers.defaultNullOpts.mkPositiveInt 443 ''
|
||||
The port of the API server to use.
|
||||
'';
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
extraConfigLua = let
|
||||
setupOptions = with cfg;
|
||||
{
|
||||
config_path = configPath;
|
||||
bin_path = binPath;
|
||||
api = with api; {
|
||||
inherit host;
|
||||
port =
|
||||
if isInt port
|
||||
then toString port
|
||||
else port;
|
||||
};
|
||||
tools = with tools; {
|
||||
inherit
|
||||
uname
|
||||
uuidgen
|
||||
curl
|
||||
gzip
|
||||
;
|
||||
language_server = languageServer;
|
||||
};
|
||||
inherit wrapper;
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
in ''
|
||||
require('codeium').setup(${helpers.toLuaObject setupOptions})
|
||||
tools = {
|
||||
uname = helpers.mkNullOrOption types.str "The path to the `uname` binary.";
|
||||
|
||||
uuidgen = helpers.mkNullOrOption types.str "The path to the `uuidgen` binary.";
|
||||
|
||||
curl = helpers.mkNullOrOption types.str "The path to the `curl` binary.";
|
||||
|
||||
gzip = helpers.mkNullOrOption types.str "The path to the `gzip` binary.";
|
||||
|
||||
languageServer = helpers.mkNullOrOption types.str ''
|
||||
The path to the language server downloaded from the official source.
|
||||
'';
|
||||
};
|
||||
|
||||
wrapper = helpers.mkNullOrOption types.str ''
|
||||
The path to a wrapper script/binary that is used to execute any binaries not listed under
|
||||
tools.
|
||||
This is primarily useful for NixOS, where a FHS wrapper can be used for the downloaded
|
||||
codeium server.
|
||||
'';
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
extraConfigLua =
|
||||
let
|
||||
setupOptions =
|
||||
with cfg;
|
||||
{
|
||||
config_path = configPath;
|
||||
bin_path = binPath;
|
||||
api = with api; {
|
||||
inherit host;
|
||||
port = if isInt port then toString port else port;
|
||||
};
|
||||
tools = with tools; {
|
||||
inherit
|
||||
uname
|
||||
uuidgen
|
||||
curl
|
||||
gzip
|
||||
;
|
||||
language_server = languageServer;
|
||||
};
|
||||
inherit wrapper;
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
in
|
||||
''
|
||||
require('codeium').setup(${helpers.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -4,63 +4,58 @@
|
|||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
copilot-lua-cfg = config.plugins.copilot-lua;
|
||||
cfg = config.plugins.copilot-cmp;
|
||||
in {
|
||||
options.plugins.copilot-cmp =
|
||||
helpers.neovim-plugin.extraOptionsOptions
|
||||
// {
|
||||
event =
|
||||
helpers.defaultNullOpts.mkNullable
|
||||
(with types; listOf str)
|
||||
''["InsertEnter" "LspAttach"]''
|
||||
in
|
||||
{
|
||||
options.plugins.copilot-cmp = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
event =
|
||||
helpers.defaultNullOpts.mkNullable (with types; listOf str) ''["InsertEnter" "LspAttach"]''
|
||||
''
|
||||
Configures when the source is registered.
|
||||
Unless you have a unique problem for your particular configuration you probably don't want
|
||||
to touch this.
|
||||
'';
|
||||
|
||||
fixPairs = helpers.defaultNullOpts.mkBool true ''
|
||||
Suppose you have the following code: `print('h')`.
|
||||
Copilot might try to account for the `'` and `)` and complete it with this: `print('hello`.
|
||||
fixPairs = helpers.defaultNullOpts.mkBool true ''
|
||||
Suppose you have the following code: `print('h')`.
|
||||
Copilot might try to account for the `'` and `)` and complete it with this: `print('hello`.
|
||||
|
||||
This is not good behavior for consistency reasons and will just end up deleting the two ending
|
||||
characters.
|
||||
This option fixes that.
|
||||
Don't turn this off unless you are having problems with pairs and believe this might be
|
||||
causing them.
|
||||
'';
|
||||
};
|
||||
This is not good behavior for consistency reasons and will just end up deleting the two ending
|
||||
characters.
|
||||
This option fixes that.
|
||||
Don't turn this off unless you are having problems with pairs and believe this might be
|
||||
causing them.
|
||||
'';
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
warnings =
|
||||
optional
|
||||
((!isBool copilot-lua-cfg.suggestion.enabled) || copilot-lua-cfg.suggestion.enabled)
|
||||
''
|
||||
optional ((!isBool copilot-lua-cfg.suggestion.enabled) || copilot-lua-cfg.suggestion.enabled) ''
|
||||
It is recommended to disable copilot's `suggestion` module, as it can interfere with
|
||||
completions properly appearing in copilot-cmp.
|
||||
''
|
||||
++ optional
|
||||
(
|
||||
(!isBool copilot-lua-cfg.panel.enabled) || copilot-lua-cfg.panel.enabled
|
||||
)
|
||||
''
|
||||
++ optional ((!isBool copilot-lua-cfg.panel.enabled) || copilot-lua-cfg.panel.enabled) ''
|
||||
It is recommended to disable copilot's `panel` module, as it can interfere with completions
|
||||
properly appearing in copilot-cmp.
|
||||
'';
|
||||
|
||||
plugins.copilot-lua.enable = true;
|
||||
|
||||
extraConfigLua = let
|
||||
setupOptions = with cfg;
|
||||
{
|
||||
inherit event;
|
||||
fix_pairs = fixPairs;
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
in ''
|
||||
require('copilot_cmp').setup(${helpers.toLuaObject setupOptions})
|
||||
'';
|
||||
extraConfigLua =
|
||||
let
|
||||
setupOptions =
|
||||
with cfg;
|
||||
{
|
||||
inherit event;
|
||||
fix_pairs = fixPairs;
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
in
|
||||
''
|
||||
require('copilot_cmp').setup(${helpers.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -4,9 +4,11 @@
|
|||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.crates-nvim;
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.plugins.crates-nvim = helpers.neovim-plugin.extraOptionsOptions;
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
|
|
@ -5,27 +5,28 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cmpLib = import ../cmp-helpers.nix {inherit lib config helpers pkgs;};
|
||||
with lib;
|
||||
let
|
||||
cmpLib = import ../cmp-helpers.nix {
|
||||
inherit
|
||||
lib
|
||||
config
|
||||
helpers
|
||||
pkgs
|
||||
;
|
||||
};
|
||||
cmpSourcesPluginNames = attrValues (import ../sources.nix);
|
||||
pluginModules =
|
||||
map
|
||||
(
|
||||
name:
|
||||
cmpLib.mkCmpSourcePlugin {inherit name;}
|
||||
)
|
||||
cmpSourcesPluginNames;
|
||||
in {
|
||||
pluginModules = map (name: cmpLib.mkCmpSourcePlugin { inherit name; }) cmpSourcesPluginNames;
|
||||
in
|
||||
{
|
||||
# For extra cmp plugins
|
||||
imports =
|
||||
[
|
||||
./codeium-nvim.nix
|
||||
./copilot-cmp.nix
|
||||
./cmp-fish.nix
|
||||
./cmp-git.nix
|
||||
./cmp-tabby.nix
|
||||
./cmp-tabnine.nix
|
||||
./crates-nvim.nix
|
||||
]
|
||||
++ pluginModules;
|
||||
imports = [
|
||||
./codeium-nvim.nix
|
||||
./copilot-cmp.nix
|
||||
./cmp-fish.nix
|
||||
./cmp-git.nix
|
||||
./cmp-tabby.nix
|
||||
./cmp-tabnine.nix
|
||||
./crates-nvim.nix
|
||||
] ++ pluginModules;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
keymapsDefinitions = {
|
||||
clear = {
|
||||
default = "<C-]>";
|
||||
|
@ -34,36 +35,36 @@ with lib; let
|
|||
};
|
||||
};
|
||||
in
|
||||
helpers.vim-plugin.mkVimPlugin config {
|
||||
name = "codeium-vim";
|
||||
originalName = "codeium.vim";
|
||||
defaultPackage = pkgs.vimPlugins.codeium-vim;
|
||||
globalPrefix = "codeium_";
|
||||
helpers.vim-plugin.mkVimPlugin config {
|
||||
name = "codeium-vim";
|
||||
originalName = "codeium.vim";
|
||||
defaultPackage = pkgs.vimPlugins.codeium-vim;
|
||||
globalPrefix = "codeium_";
|
||||
|
||||
maintainers = [maintainers.GaetanLepage];
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
# TODO introduced 2024-02-19: remove 2024-03-19
|
||||
deprecateExtraConfig = true;
|
||||
optionsRenamedToSettings = [
|
||||
"bin"
|
||||
"filetypes"
|
||||
"manual"
|
||||
"noMapTab"
|
||||
"idleDelay"
|
||||
"render"
|
||||
"tabFallback"
|
||||
"disableBindings"
|
||||
];
|
||||
# TODO introduced 2024-02-19: remove 2024-03-19
|
||||
deprecateExtraConfig = true;
|
||||
optionsRenamedToSettings = [
|
||||
"bin"
|
||||
"filetypes"
|
||||
"manual"
|
||||
"noMapTab"
|
||||
"idleDelay"
|
||||
"render"
|
||||
"tabFallback"
|
||||
"disableBindings"
|
||||
];
|
||||
|
||||
settingsOptions = {
|
||||
bin = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = "${pkgs.codeium}/bin/codeium_language_server";
|
||||
description = "The path to the codeium language server executable.";
|
||||
};
|
||||
settingsOptions = {
|
||||
bin = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = "${pkgs.codeium}/bin/codeium_language_server";
|
||||
description = "The path to the codeium language server executable.";
|
||||
};
|
||||
|
||||
filetypes =
|
||||
helpers.defaultNullOpts.mkAttrsOf types.bool
|
||||
filetypes =
|
||||
helpers.defaultNullOpts.mkAttrsOf types.bool
|
||||
''
|
||||
{
|
||||
help = false;
|
||||
|
@ -77,65 +78,61 @@ in
|
|||
This can be used to opt out of completions for certain filetypes.
|
||||
'';
|
||||
|
||||
manual = helpers.defaultNullOpts.mkBool false ''
|
||||
If true, codeium completions will never automatically trigger.
|
||||
'';
|
||||
manual = helpers.defaultNullOpts.mkBool false ''
|
||||
If true, codeium completions will never automatically trigger.
|
||||
'';
|
||||
|
||||
no_map_tab = helpers.defaultNullOpts.mkBool false ''
|
||||
Whether to disable the `<Tab>` keybinding.
|
||||
'';
|
||||
no_map_tab = helpers.defaultNullOpts.mkBool false ''
|
||||
Whether to disable the `<Tab>` keybinding.
|
||||
'';
|
||||
|
||||
idle_delay = helpers.defaultNullOpts.mkPositiveInt 75 ''
|
||||
Delay in milliseconds before autocompletions are shown (limited by language server to a
|
||||
minimum of 75).
|
||||
'';
|
||||
idle_delay = helpers.defaultNullOpts.mkPositiveInt 75 ''
|
||||
Delay in milliseconds before autocompletions are shown (limited by language server to a
|
||||
minimum of 75).
|
||||
'';
|
||||
|
||||
render = helpers.defaultNullOpts.mkBool true ''
|
||||
A global boolean flag that controls whether codeium renders are enabled or disabled.
|
||||
'';
|
||||
render = helpers.defaultNullOpts.mkBool true ''
|
||||
A global boolean flag that controls whether codeium renders are enabled or disabled.
|
||||
'';
|
||||
|
||||
tab_fallback = helpers.mkNullOrOption types.str ''
|
||||
The fallback key when there is no suggestion display in `codeium#Accept()`.
|
||||
tab_fallback = helpers.mkNullOrOption types.str ''
|
||||
The fallback key when there is no suggestion display in `codeium#Accept()`.
|
||||
|
||||
Default: "\<C-N>" when a popup menu is visible, else "\t".
|
||||
'';
|
||||
Default: "\<C-N>" when a popup menu is visible, else "\t".
|
||||
'';
|
||||
|
||||
disable_bindings = helpers.defaultNullOpts.mkBool false ''
|
||||
Whether to disable default keybindings.
|
||||
'';
|
||||
};
|
||||
disable_bindings = helpers.defaultNullOpts.mkBool false ''
|
||||
Whether to disable default keybindings.
|
||||
'';
|
||||
};
|
||||
|
||||
extraOptions = {
|
||||
keymaps =
|
||||
mapAttrs
|
||||
(
|
||||
extraOptions = {
|
||||
keymaps = mapAttrs (
|
||||
optionName: v:
|
||||
helpers.defaultNullOpts.mkStr v.default ''
|
||||
${v.description}
|
||||
Command: `${v.command}`
|
||||
''
|
||||
) keymapsDefinitions;
|
||||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
plugins.codeium-vim.settings.enabled = true;
|
||||
|
||||
keymaps =
|
||||
let
|
||||
processKeymap =
|
||||
optionName: v:
|
||||
helpers.defaultNullOpts.mkStr v.default ''
|
||||
${v.description}
|
||||
Command: `${v.command}`
|
||||
''
|
||||
)
|
||||
keymapsDefinitions;
|
||||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
plugins.codeium-vim.settings.enabled = true;
|
||||
|
||||
keymaps = let
|
||||
processKeymap = optionName: v:
|
||||
optional
|
||||
(v != null)
|
||||
{
|
||||
optional (v != null) {
|
||||
key = v;
|
||||
action = let
|
||||
inherit (keymapsDefinitions.${optionName}) command;
|
||||
in
|
||||
action =
|
||||
let
|
||||
inherit (keymapsDefinitions.${optionName}) command;
|
||||
in
|
||||
helpers.mkRaw "function() ${command} end";
|
||||
};
|
||||
|
||||
keymapsList = flatten (
|
||||
mapAttrsToList processKeymap cfg.keymaps
|
||||
);
|
||||
keymapsList = flatten (mapAttrsToList processKeymap cfg.keymaps);
|
||||
|
||||
defaults = {
|
||||
mode = "i";
|
||||
|
@ -145,8 +142,6 @@ in
|
|||
};
|
||||
};
|
||||
in
|
||||
helpers.keymaps.mkKeymaps
|
||||
defaults
|
||||
keymapsList;
|
||||
};
|
||||
}
|
||||
helpers.keymaps.mkKeymaps defaults keymapsList;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -5,13 +5,16 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.copilot-lua;
|
||||
in {
|
||||
in
|
||||
{
|
||||
options = {
|
||||
plugins.copilot-lua = let
|
||||
keymapOption = helpers.defaultNullOpts.mkNullable (with types; either (enum [false]) str);
|
||||
in
|
||||
plugins.copilot-lua =
|
||||
let
|
||||
keymapOption = helpers.defaultNullOpts.mkNullable (with types; either (enum [ false ]) str);
|
||||
in
|
||||
helpers.neovim-plugin.extraOptionsOptions
|
||||
// {
|
||||
enable = mkEnableOption "copilot.lua";
|
||||
|
@ -36,9 +39,18 @@ in {
|
|||
};
|
||||
|
||||
layout = {
|
||||
position = helpers.defaultNullOpts.mkEnum ["bottom" "top" "left" "right"] "bottom" ''
|
||||
The panel position.
|
||||
'';
|
||||
position =
|
||||
helpers.defaultNullOpts.mkEnum
|
||||
[
|
||||
"bottom"
|
||||
"top"
|
||||
"left"
|
||||
"right"
|
||||
]
|
||||
"bottom"
|
||||
''
|
||||
The panel position.
|
||||
'';
|
||||
|
||||
ratio = helpers.defaultNullOpts.mkNullable (types.numbers.between 0.0 1.0) "0.4" ''
|
||||
The panel ratio.
|
||||
|
@ -69,52 +81,51 @@ in {
|
|||
};
|
||||
|
||||
filetypes =
|
||||
helpers.defaultNullOpts.mkNullable
|
||||
(with types; attrsOf (either bool helpers.nixvimTypes.rawLua))
|
||||
''
|
||||
{
|
||||
yaml = false;
|
||||
markdown = false;
|
||||
help = false;
|
||||
gitcommit = false;
|
||||
gitrebase = false;
|
||||
hgcommit = false;
|
||||
svn = false;
|
||||
cvs = false;
|
||||
"." = false;
|
||||
}
|
||||
''
|
||||
''
|
||||
Specify filetypes for attaching copilot.
|
||||
Each value can be either a boolean or a lua function that returns a boolean.
|
||||
|
||||
Example:
|
||||
```nix
|
||||
helpers.defaultNullOpts.mkNullable (with types; attrsOf (either bool helpers.nixvimTypes.rawLua))
|
||||
''
|
||||
{
|
||||
markdown = true; # overrides default
|
||||
terraform = false; # disallow specific filetype
|
||||
sh.__raw = \'\'
|
||||
function ()
|
||||
if string.match(vim.fs.basename(vim.api.nvim_buf_get_name(0)), '^%.env.*') then
|
||||
-- disable for .env files
|
||||
return false
|
||||
yaml = false;
|
||||
markdown = false;
|
||||
help = false;
|
||||
gitcommit = false;
|
||||
gitrebase = false;
|
||||
hgcommit = false;
|
||||
svn = false;
|
||||
cvs = false;
|
||||
"." = false;
|
||||
}
|
||||
''
|
||||
''
|
||||
Specify filetypes for attaching copilot.
|
||||
Each value can be either a boolean or a lua function that returns a boolean.
|
||||
|
||||
Example:
|
||||
```nix
|
||||
{
|
||||
markdown = true; # overrides default
|
||||
terraform = false; # disallow specific filetype
|
||||
sh.__raw = \'\'
|
||||
function ()
|
||||
if string.match(vim.fs.basename(vim.api.nvim_buf_get_name(0)), '^%.env.*') then
|
||||
-- disable for .env files
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
return true
|
||||
end
|
||||
\'\';
|
||||
}
|
||||
```
|
||||
\'\';
|
||||
}
|
||||
```
|
||||
|
||||
The key `"*"` can be used to disable the default configuration.
|
||||
Example:
|
||||
```nix
|
||||
{
|
||||
javascript = true; # allow specific filetype
|
||||
typescript = true; # allow specific filetype
|
||||
"*" = false; # disable for all other filetypes and ignore default `filetypes`
|
||||
}
|
||||
```
|
||||
'';
|
||||
The key `"*"` can be used to disable the default configuration.
|
||||
Example:
|
||||
```nix
|
||||
{
|
||||
javascript = true; # allow specific filetype
|
||||
typescript = true; # allow specific filetype
|
||||
"*" = false; # disable for all other filetypes and ignore default `filetypes`
|
||||
}
|
||||
```
|
||||
'';
|
||||
|
||||
copilotNodeCommand = mkOption {
|
||||
type = types.str;
|
||||
|
@ -164,41 +175,44 @@ in {
|
|||
}
|
||||
];
|
||||
|
||||
extraPlugins = [cfg.package];
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua = let
|
||||
setupOptions = with cfg;
|
||||
{
|
||||
panel = with panel; {
|
||||
inherit enabled;
|
||||
auto_refresh = autoRefresh;
|
||||
keymap = with keymap; {
|
||||
jump_prev = jumpPrev;
|
||||
jump_next = jumpNext;
|
||||
inherit accept refresh open;
|
||||
extraConfigLua =
|
||||
let
|
||||
setupOptions =
|
||||
with cfg;
|
||||
{
|
||||
panel = with panel; {
|
||||
inherit enabled;
|
||||
auto_refresh = autoRefresh;
|
||||
keymap = with keymap; {
|
||||
jump_prev = jumpPrev;
|
||||
jump_next = jumpNext;
|
||||
inherit accept refresh open;
|
||||
};
|
||||
layout = with layout; {
|
||||
inherit position ratio;
|
||||
};
|
||||
};
|
||||
layout = with layout; {
|
||||
inherit position ratio;
|
||||
suggestion = with suggestion; {
|
||||
inherit enabled;
|
||||
auto_trigger = autoTrigger;
|
||||
inherit debounce;
|
||||
keymap = with keymap; {
|
||||
inherit accept;
|
||||
accept_word = acceptWord;
|
||||
accept_line = acceptLine;
|
||||
inherit next prev dismiss;
|
||||
};
|
||||
};
|
||||
};
|
||||
suggestion = with suggestion; {
|
||||
inherit enabled;
|
||||
auto_trigger = autoTrigger;
|
||||
inherit debounce;
|
||||
keymap = with keymap; {
|
||||
inherit accept;
|
||||
accept_word = acceptWord;
|
||||
accept_line = acceptLine;
|
||||
inherit next prev dismiss;
|
||||
};
|
||||
};
|
||||
inherit filetypes;
|
||||
copilot_node_command = copilotNodeCommand;
|
||||
server_opts_overrides = serverOptsOverrides;
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
in ''
|
||||
require('copilot').setup(${helpers.toLuaObject setupOptions})
|
||||
'';
|
||||
inherit filetypes;
|
||||
copilot_node_command = copilotNodeCommand;
|
||||
server_opts_overrides = serverOptsOverrides;
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
in
|
||||
''
|
||||
require('copilot').setup(${helpers.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -7,79 +7,79 @@
|
|||
}:
|
||||
with lib;
|
||||
with helpers.vim-plugin;
|
||||
helpers.vim-plugin.mkVimPlugin config {
|
||||
name = "copilot-vim";
|
||||
originalName = "copilot.vim";
|
||||
defaultPackage = pkgs.vimPlugins.copilot-vim;
|
||||
globalPrefix = "copilot_";
|
||||
helpers.vim-plugin.mkVimPlugin config {
|
||||
name = "copilot-vim";
|
||||
originalName = "copilot.vim";
|
||||
defaultPackage = pkgs.vimPlugins.copilot-vim;
|
||||
globalPrefix = "copilot_";
|
||||
|
||||
maintainers = [maintainers.GaetanLepage];
|
||||
maintainers = [ maintainers.GaetanLepage ];
|
||||
|
||||
# TODO introduced 2024-03-02: remove 2024-05-02
|
||||
deprecateExtraConfig = true;
|
||||
optionsRenamedToSettings = [
|
||||
"nodeCommand"
|
||||
"filetypes"
|
||||
"proxy"
|
||||
];
|
||||
# TODO introduced 2024-03-02: remove 2024-05-02
|
||||
deprecateExtraConfig = true;
|
||||
optionsRenamedToSettings = [
|
||||
"nodeCommand"
|
||||
"filetypes"
|
||||
"proxy"
|
||||
];
|
||||
|
||||
settingsOptions = {
|
||||
node_command = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = "${pkgs.nodejs-18_x}/bin/node";
|
||||
description = "Tell Copilot what `node` binary to use.";
|
||||
};
|
||||
|
||||
filetypes = mkOption {
|
||||
type = with types; nullOr (attrsOf bool);
|
||||
default = null;
|
||||
description = "A dictionary mapping file types to their enabled status.";
|
||||
example = {
|
||||
"*" = false;
|
||||
python = true;
|
||||
};
|
||||
};
|
||||
|
||||
proxy = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
description = ''
|
||||
Tell Copilot what proxy server to use.
|
||||
|
||||
If this is not set, Copilot will use the value of environment variables like
|
||||
`$HTTPS_PROXY`.
|
||||
'';
|
||||
example = "localhost:3128";
|
||||
};
|
||||
|
||||
proxy_strict_ssl = helpers.mkNullOrOption types.bool ''
|
||||
Corporate proxies sometimes use a man-in-the-middle SSL certificate which is incompatible
|
||||
with GitHub Copilot.
|
||||
To work around this, SSL certificate verification can be disabled by setting this option to
|
||||
`false`.
|
||||
|
||||
You can also tell `Node.js` to disable SSL verification by setting the
|
||||
`$NODE_TLS_REJECT_UNAUTHORIZED` environment variable to `"0"`.
|
||||
'';
|
||||
|
||||
workspace_folders = helpers.mkNullOrOption (with types; listOf str) ''
|
||||
A list of "workspace folders" or project roots that Copilot may use to improve to improve
|
||||
the quality of suggestions.
|
||||
|
||||
Example: ["~/Projects/myproject"]
|
||||
|
||||
You can also set `b:workspace_folder` for an individual buffer and newly seen values will be
|
||||
added automatically.
|
||||
'';
|
||||
settingsOptions = {
|
||||
node_command = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = "${pkgs.nodejs-18_x}/bin/node";
|
||||
description = "Tell Copilot what `node` binary to use.";
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
filetypes = {
|
||||
filetypes = mkOption {
|
||||
type = with types; nullOr (attrsOf bool);
|
||||
default = null;
|
||||
description = "A dictionary mapping file types to their enabled status.";
|
||||
example = {
|
||||
"*" = false;
|
||||
python = true;
|
||||
};
|
||||
proxy = "localhost:3128";
|
||||
proxy_strict_ssl = false;
|
||||
workspace_folders = ["~/Projects/myproject"];
|
||||
};
|
||||
}
|
||||
|
||||
proxy = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
description = ''
|
||||
Tell Copilot what proxy server to use.
|
||||
|
||||
If this is not set, Copilot will use the value of environment variables like
|
||||
`$HTTPS_PROXY`.
|
||||
'';
|
||||
example = "localhost:3128";
|
||||
};
|
||||
|
||||
proxy_strict_ssl = helpers.mkNullOrOption types.bool ''
|
||||
Corporate proxies sometimes use a man-in-the-middle SSL certificate which is incompatible
|
||||
with GitHub Copilot.
|
||||
To work around this, SSL certificate verification can be disabled by setting this option to
|
||||
`false`.
|
||||
|
||||
You can also tell `Node.js` to disable SSL verification by setting the
|
||||
`$NODE_TLS_REJECT_UNAUTHORIZED` environment variable to `"0"`.
|
||||
'';
|
||||
|
||||
workspace_folders = helpers.mkNullOrOption (with types; listOf str) ''
|
||||
A list of "workspace folders" or project roots that Copilot may use to improve to improve
|
||||
the quality of suggestions.
|
||||
|
||||
Example: ["~/Projects/myproject"]
|
||||
|
||||
You can also set `b:workspace_folder` for an individual buffer and newly seen values will be
|
||||
added automatically.
|
||||
'';
|
||||
};
|
||||
|
||||
settingsExample = {
|
||||
filetypes = {
|
||||
"*" = false;
|
||||
python = true;
|
||||
};
|
||||
proxy = "localhost:3128";
|
||||
proxy_strict_ssl = false;
|
||||
workspace_folders = [ "~/Projects/myproject" ];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -5,40 +5,44 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.coq-thirdparty;
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.plugins.coq-thirdparty = {
|
||||
enable = mkEnableOption "coq-thirdparty";
|
||||
|
||||
package = helpers.mkPackageOption "coq-thirdparty" pkgs.vimPlugins.coq-thirdparty;
|
||||
|
||||
sources = mkOption {
|
||||
type = types.listOf (types.submodule {
|
||||
freeformType = types.attrs;
|
||||
type = types.listOf (
|
||||
types.submodule {
|
||||
freeformType = types.attrs;
|
||||
|
||||
options = {
|
||||
src = mkOption {
|
||||
type = types.str;
|
||||
description = "The name of the source";
|
||||
};
|
||||
options = {
|
||||
src = mkOption {
|
||||
type = types.str;
|
||||
description = "The name of the source";
|
||||
};
|
||||
|
||||
short_name = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
description = ''
|
||||
A short name for the source.
|
||||
If not specified, it is uppercase `src`.
|
||||
'';
|
||||
example = "nLUA";
|
||||
default = null;
|
||||
short_name = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
description = ''
|
||||
A short name for the source.
|
||||
If not specified, it is uppercase `src`.
|
||||
'';
|
||||
example = "nLUA";
|
||||
default = null;
|
||||
};
|
||||
};
|
||||
};
|
||||
});
|
||||
}
|
||||
);
|
||||
description = ''
|
||||
List of sources.
|
||||
Each source is a free-form type, so additional settings like `accept_key` may be specified even if they are not declared by nixvim.
|
||||
'';
|
||||
default = [];
|
||||
default = [ ];
|
||||
example = [
|
||||
{
|
||||
src = "nvimlua";
|
||||
|
@ -53,13 +57,13 @@ in {
|
|||
short_name = "COP";
|
||||
accept_key = "<c-f>";
|
||||
}
|
||||
{src = "demo";}
|
||||
{ src = "demo"; }
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
extraPlugins = [cfg.package];
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua = ''
|
||||
require('coq_3p')(${helpers.toLuaObject cfg.sources})
|
||||
|
|
|
@ -6,78 +6,87 @@
|
|||
...
|
||||
}:
|
||||
with lib;
|
||||
helpers.neovim-plugin.mkNeovimPlugin config {
|
||||
name = "coq-nvim";
|
||||
originalName = "coq_nvim";
|
||||
defaultPackage = pkgs.vimPlugins.coq_nvim;
|
||||
helpers.neovim-plugin.mkNeovimPlugin config {
|
||||
name = "coq-nvim";
|
||||
originalName = "coq_nvim";
|
||||
defaultPackage = pkgs.vimPlugins.coq_nvim;
|
||||
|
||||
maintainers = [maintainers.traxys helpers.maintainers.Kareem-Medhat];
|
||||
maintainers = [
|
||||
maintainers.traxys
|
||||
helpers.maintainers.Kareem-Medhat
|
||||
];
|
||||
|
||||
extraOptions = {
|
||||
installArtifacts = mkEnableOption "and install coq-artifacts";
|
||||
artifactsPackage = mkOption {
|
||||
type = types.package;
|
||||
description = "Package to use for coq-artifacts (when enabled with installArtifacts)";
|
||||
default = pkgs.vimPlugins.coq-artifacts;
|
||||
};
|
||||
extraOptions = {
|
||||
installArtifacts = mkEnableOption "and install coq-artifacts";
|
||||
artifactsPackage = mkOption {
|
||||
type = types.package;
|
||||
description = "Package to use for coq-artifacts (when enabled with installArtifacts)";
|
||||
default = pkgs.vimPlugins.coq-artifacts;
|
||||
};
|
||||
};
|
||||
|
||||
# TODO: Introduced 12-03-2022, remove 12-05-2022
|
||||
optionsRenamedToSettings = [
|
||||
"xdg"
|
||||
"autoStart"
|
||||
];
|
||||
imports = let
|
||||
basePath = ["plugins" "coq-nvim"];
|
||||
settingsPath = basePath ++ ["settings"];
|
||||
in [
|
||||
(
|
||||
mkRenamedOptionModule
|
||||
(basePath ++ ["recommendedKeymaps"])
|
||||
(settingsPath ++ ["keymap" "recommended"])
|
||||
)
|
||||
|
||||
(
|
||||
mkRenamedOptionModule
|
||||
(basePath ++ ["alwaysComplete"])
|
||||
(settingsPath ++ ["completion" "always"])
|
||||
)
|
||||
];
|
||||
|
||||
callSetup = false;
|
||||
settingsOptions = {
|
||||
auto_start =
|
||||
helpers.mkNullOrOption
|
||||
(with helpers.nixvimTypes; maybeRaw (either bool (enum ["shut-up"])))
|
||||
"Auto-start or shut up";
|
||||
|
||||
xdg = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Use XDG paths. May be required when installing coq with Nix.";
|
||||
};
|
||||
|
||||
keymap.recommended = helpers.defaultNullOpts.mkBool true "Use the recommended keymaps";
|
||||
|
||||
completion.always = helpers.defaultNullOpts.mkBool true "Always trigger completion on keystroke";
|
||||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
extraPlugins = mkIf cfg.installArtifacts [
|
||||
cfg.artifactsPackage
|
||||
# TODO: Introduced 12-03-2022, remove 12-05-2022
|
||||
optionsRenamedToSettings = [
|
||||
"xdg"
|
||||
"autoStart"
|
||||
];
|
||||
imports =
|
||||
let
|
||||
basePath = [
|
||||
"plugins"
|
||||
"coq-nvim"
|
||||
];
|
||||
settingsPath = basePath ++ [ "settings" ];
|
||||
in
|
||||
[
|
||||
(mkRenamedOptionModule (basePath ++ [ "recommendedKeymaps" ]) (
|
||||
settingsPath
|
||||
++ [
|
||||
"keymap"
|
||||
"recommended"
|
||||
]
|
||||
))
|
||||
|
||||
globals = {
|
||||
coq_settings = cfg.settings;
|
||||
};
|
||||
(mkRenamedOptionModule (basePath ++ [ "alwaysComplete" ]) (
|
||||
settingsPath
|
||||
++ [
|
||||
"completion"
|
||||
"always"
|
||||
]
|
||||
))
|
||||
];
|
||||
|
||||
extraConfigLua = "require('coq')";
|
||||
callSetup = false;
|
||||
settingsOptions = {
|
||||
auto_start = helpers.mkNullOrOption (
|
||||
with helpers.nixvimTypes; maybeRaw (either bool (enum [ "shut-up" ]))
|
||||
) "Auto-start or shut up";
|
||||
|
||||
plugins.lsp = {
|
||||
preConfig = ''
|
||||
local coq = require 'coq'
|
||||
'';
|
||||
setupWrappers = [(s: ''coq.lsp_ensure_capabilities(${s})'')];
|
||||
};
|
||||
xdg = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Use XDG paths. May be required when installing coq with Nix.";
|
||||
};
|
||||
}
|
||||
|
||||
keymap.recommended = helpers.defaultNullOpts.mkBool true "Use the recommended keymaps";
|
||||
|
||||
completion.always = helpers.defaultNullOpts.mkBool true "Always trigger completion on keystroke";
|
||||
};
|
||||
|
||||
extraConfig = cfg: {
|
||||
extraPlugins = mkIf cfg.installArtifacts [ cfg.artifactsPackage ];
|
||||
|
||||
globals = {
|
||||
coq_settings = cfg.settings;
|
||||
};
|
||||
|
||||
extraConfigLua = "require('coq')";
|
||||
|
||||
plugins.lsp = {
|
||||
preConfig = ''
|
||||
local coq = require 'coq'
|
||||
'';
|
||||
setupWrappers = [ (s: ''coq.lsp_ensure_capabilities(${s})'') ];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -5,85 +5,86 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.lspkind;
|
||||
in {
|
||||
options.plugins.lspkind =
|
||||
helpers.neovim-plugin.extraOptionsOptions
|
||||
// {
|
||||
enable = mkEnableOption "lspkind.nvim";
|
||||
in
|
||||
{
|
||||
options.plugins.lspkind = helpers.neovim-plugin.extraOptionsOptions // {
|
||||
enable = mkEnableOption "lspkind.nvim";
|
||||
|
||||
package = helpers.mkPackageOption "lspkind" pkgs.vimPlugins.lspkind-nvim;
|
||||
package = helpers.mkPackageOption "lspkind" pkgs.vimPlugins.lspkind-nvim;
|
||||
|
||||
mode =
|
||||
helpers.defaultNullOpts.mkEnum
|
||||
["text" "text_symbol" "symbol_text" "symbol"]
|
||||
"symbol_text"
|
||||
"Defines how annotations are shown";
|
||||
mode = helpers.defaultNullOpts.mkEnum [
|
||||
"text"
|
||||
"text_symbol"
|
||||
"symbol_text"
|
||||
"symbol"
|
||||
] "symbol_text" "Defines how annotations are shown";
|
||||
|
||||
preset = helpers.defaultNullOpts.mkEnum ["default" "codicons"] "codicons" "Default symbol map";
|
||||
preset = helpers.defaultNullOpts.mkEnum [
|
||||
"default"
|
||||
"codicons"
|
||||
] "codicons" "Default symbol map";
|
||||
|
||||
symbolMap = helpers.mkNullOrOption (types.attrsOf types.str) "Override preset symbols";
|
||||
symbolMap = helpers.mkNullOrOption (types.attrsOf types.str) "Override preset symbols";
|
||||
|
||||
cmp = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Integrate with nvim-cmp";
|
||||
};
|
||||
|
||||
maxWidth =
|
||||
helpers.mkNullOrOption types.int
|
||||
"Maximum number of characters to show in the popup";
|
||||
|
||||
ellipsisChar =
|
||||
helpers.mkNullOrOption types.str
|
||||
"Character to show when the popup exceeds maxwidth";
|
||||
|
||||
menu = helpers.mkNullOrOption (types.attrsOf types.str) "Show source names in the popup";
|
||||
|
||||
after =
|
||||
helpers.mkNullOrOption types.str
|
||||
"Function to run after calculating the formatting. function(entry, vim_item, kind)";
|
||||
cmp = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Integrate with nvim-cmp";
|
||||
};
|
||||
};
|
||||
|
||||
config = let
|
||||
doCmp = cfg.cmp.enable && config.plugins.cmp.enable;
|
||||
options =
|
||||
{
|
||||
inherit (cfg) mode preset;
|
||||
symbol_map = cfg.symbolMap;
|
||||
}
|
||||
// (
|
||||
if doCmp
|
||||
then {
|
||||
maxwidth = cfg.cmp.maxWidth;
|
||||
ellipsis_char = cfg.cmp.ellipsisChar;
|
||||
inherit (cfg.cmp) menu;
|
||||
maxWidth = helpers.mkNullOrOption types.int "Maximum number of characters to show in the popup";
|
||||
|
||||
ellipsisChar = helpers.mkNullOrOption types.str "Character to show when the popup exceeds maxwidth";
|
||||
|
||||
menu = helpers.mkNullOrOption (types.attrsOf types.str) "Show source names in the popup";
|
||||
|
||||
after = helpers.mkNullOrOption types.str "Function to run after calculating the formatting. function(entry, vim_item, kind)";
|
||||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
doCmp = cfg.cmp.enable && config.plugins.cmp.enable;
|
||||
options =
|
||||
{
|
||||
inherit (cfg) mode preset;
|
||||
symbol_map = cfg.symbolMap;
|
||||
}
|
||||
else {}
|
||||
)
|
||||
// cfg.extraOptions;
|
||||
in
|
||||
// (
|
||||
if doCmp then
|
||||
{
|
||||
maxwidth = cfg.cmp.maxWidth;
|
||||
ellipsis_char = cfg.cmp.ellipsisChar;
|
||||
inherit (cfg.cmp) menu;
|
||||
}
|
||||
else
|
||||
{ }
|
||||
)
|
||||
// cfg.extraOptions;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [cfg.package];
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua = optionalString (!doCmp) ''
|
||||
require('lspkind').init(${helpers.toLuaObject options})
|
||||
'';
|
||||
|
||||
plugins.cmp.settings.formatting.format =
|
||||
if cfg.cmp.after != null
|
||||
then ''
|
||||
function(entry, vim_item)
|
||||
local kind = require('lspkind').cmp_format(${helpers.toLuaObject options})(entry, vim_item)
|
||||
if cfg.cmp.after != null then
|
||||
''
|
||||
function(entry, vim_item)
|
||||
local kind = require('lspkind').cmp_format(${helpers.toLuaObject options})(entry, vim_item)
|
||||
|
||||
return (${cfg.cmp.after})(entry, vim_after, kind)
|
||||
end
|
||||
''
|
||||
else ''
|
||||
require('lspkind').cmp_format(${helpers.toLuaObject options})
|
||||
'';
|
||||
return (${cfg.cmp.after})(entry, vim_after, kind)
|
||||
end
|
||||
''
|
||||
else
|
||||
''
|
||||
require('lspkind').cmp_format(${helpers.toLuaObject options})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue