nvim-cmp: fix use of mkDefault for borders

This commit is contained in:
diniamo 2024-11-13 18:41:32 +01:00 committed by raf
parent 1df720f86c
commit 7a5c75b865

View file

@ -3,7 +3,7 @@
config, config,
... ...
}: let }: let
inherit (lib.modules) mkIf mkMerge mkDefault; inherit (lib.modules) mkIf mkMerge;
inherit (lib.strings) optionalString; inherit (lib.strings) optionalString;
inherit (lib.generators) mkLuaInline; inherit (lib.generators) mkLuaInline;
inherit (lib.nvim.lua) toLuaObject; inherit (lib.nvim.lua) toLuaObject;
@ -11,17 +11,6 @@
inherit (builtins) attrNames typeOf tryEval concatStringsSep; inherit (builtins) attrNames typeOf tryEval concatStringsSep;
borders = config.vim.ui.borders.plugins.nvim-cmp; borders = config.vim.ui.borders.plugins.nvim-cmp;
# From https://github.com/hrsh7th/nvim-cmp/blob/main/lua/cmp/config/window.lua
# This way users can still override the options
windowOpts = {
border = borders.style;
winhighlight = "Normal:Normal,FloatBorder:FloatBorder,CursorLine:Visual,Search:None";
zindex = 1001;
scrolloff = 0;
col_offset = 0;
side_padding = 1;
scrollbar = true;
};
cfg = config.vim.autocomplete.nvim-cmp; cfg = config.vim.autocomplete.nvim-cmp;
luasnipEnable = config.vim.snippets.luasnip.enable; luasnipEnable = config.vim.snippets.luasnip.enable;
@ -95,8 +84,8 @@ in {
sources = map (s: {name = s;}) (attrNames cfg.sources); sources = map (s: {name = s;}) (attrNames cfg.sources);
window = mkIf borders.enable { window = mkIf borders.enable {
completion = mkDefault windowOpts; completion.border = borders.style;
documentation = mkDefault windowOpts; documentation.border = borders.style;
}; };
formatting.format = cfg.format; formatting.format = cfg.format;