687 current 2024-05-26 18:53:13 24.11.20240524.bfb7a88 6.9.1-zen1 *
This commit is contained in:
parent
9cc2434150
commit
3ae49b3d62
8 changed files with 178 additions and 170 deletions
|
|
@ -10,20 +10,27 @@ with lib.custom; let
|
|||
in {
|
||||
options.apps.term.kitty = with types; {
|
||||
enable = mkBoolOpt false "Enable Kitty Term";
|
||||
|
||||
fonts = {
|
||||
normal = mkStringOpt "Zed Mono Bold" "Normal Font";
|
||||
bold = mkStringOpt "Zed Mono Heavy" "Bold Font";
|
||||
italic = mkStringOpt "Zed Mono Bold Italic" "Italic Font";
|
||||
bold_italic = mkStringOpt "Zed Mono Bold Heavy Italic" "Bold Italic Font";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
programs.kitty = {
|
||||
enable = true;
|
||||
font = {
|
||||
name = "Iosevka Term SemiBold";
|
||||
name = cfg.fonts.normal;
|
||||
size = 14;
|
||||
};
|
||||
|
||||
extraConfig = ''
|
||||
bold_font Iosevk Term Heavy
|
||||
italic_font Iosevka Term SemiBold Italic
|
||||
bold_italic_font Iosevka Term Heavy Italic
|
||||
bold_font ${cfg.fonts.bold}
|
||||
italic_font ${cfg.fonts.italic}
|
||||
bold_italic_font ${cfg.fonts.bold_italic}
|
||||
'';
|
||||
|
||||
catppuccin.enable = true;
|
||||
|
|
|
|||
|
|
@ -67,28 +67,10 @@ in {
|
|||
opts = function()
|
||||
local cmp = require("cmp")
|
||||
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
||||
local lspkind = require("lspkind")
|
||||
|
||||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
||||
|
||||
local icons = {
|
||||
branch = "",
|
||||
bullet = "•",
|
||||
o_bullet = "○",
|
||||
check = "✔",
|
||||
d_chev = "∨",
|
||||
ellipses = "…",
|
||||
file = "╼",
|
||||
hamburger = "≡",
|
||||
lock = "",
|
||||
r_chev = ">",
|
||||
ballot_x = " ",
|
||||
up_tri = " ",
|
||||
info_i = " ",
|
||||
-- ballot_x = '✘',
|
||||
-- up_tri = '▲',
|
||||
-- info_i = '¡',
|
||||
}
|
||||
|
||||
local function get_lsp_completion_context(completion, source)
|
||||
local ok, source_name = pcall(function()
|
||||
return source.source.client.config.name
|
||||
|
|
@ -139,14 +121,12 @@ in {
|
|||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
|
||||
window = {
|
||||
completion = {
|
||||
winhighlight = "Normal:Pmenu,FloatBorder:Pmenu,Search:None",
|
||||
side_padding = 4,
|
||||
},
|
||||
documentation = {
|
||||
winhighlight = "Normal:Pmenu,FloatBorder:Pmenu,Search:None",
|
||||
side_padding = 4,
|
||||
col_offset = -3,
|
||||
side_padding = 0,
|
||||
},
|
||||
},
|
||||
sources = cmp.config.sources({
|
||||
|
|
@ -189,86 +169,24 @@ in {
|
|||
end
|
||||
end, { "i", "s" }),
|
||||
},
|
||||
view = {
|
||||
entries = { name = "custom", selection_order = "near_cursor" },
|
||||
},
|
||||
experimental = {
|
||||
ghost_text = true,
|
||||
},
|
||||
formatting = {
|
||||
-- format = lspkind_status_ok and lspkind.cmp_format({
|
||||
-- mode = "symbol",
|
||||
-- maxwidth = 25,
|
||||
-- ellipsis_char = "...",
|
||||
-- before = function(entry, vim_item)
|
||||
-- if vim_item.kind == "Color" and entry.completion_item.documentation then
|
||||
-- local _, _, r, g, b =
|
||||
-- string.find(entry.completion_item.documentation, "^rgb%((%d+), (%d+), (%d+)")
|
||||
-- if r then
|
||||
-- local color = string.format("%02x", r)
|
||||
-- .. string.format("%02x", g)
|
||||
-- .. string.format("%02x", b)
|
||||
-- local group = "Tw_" .. color
|
||||
-- if vim.fn.hlID(group) < 1 then
|
||||
-- vim.api.nvim_set_hl(0, group, { fg = "#" .. color })
|
||||
-- end
|
||||
-- vim_item.kind_hl_group = group
|
||||
-- return vim_item
|
||||
-- end
|
||||
-- end
|
||||
-- return vim_item
|
||||
-- end,
|
||||
-- }),
|
||||
fields = { "kind", "abbr", "menu" },
|
||||
format = function(entry, vim_item)
|
||||
if not require("cmp.utils.api").is_cmdline_mode() then
|
||||
local abbr_width_max = 25
|
||||
local menu_width_max = 20
|
||||
local kind = lspkind.cmp_format({
|
||||
mode = "symbol_text",
|
||||
maxwidth = 50,
|
||||
})(entry, vim_item)
|
||||
local strings = vim.split(kind.kind, "%s", { trimempty = true })
|
||||
kind.kind = " " .. strings[1] .. " "
|
||||
kind.menu = " (" .. strings[2] .. ")"
|
||||
|
||||
local choice = require("lspkind").cmp_format({
|
||||
ellipsis_char = icons.ellipsis,
|
||||
maxwidth = abbr_width_max,
|
||||
mode = "symbol",
|
||||
})(entry, vim_item)
|
||||
|
||||
choice.abbr = vim.trim(choice.abbr)
|
||||
|
||||
local abbr_width = string.len(choice.abbr)
|
||||
if abbr_width < abbr_width_max then
|
||||
local padding = string.rep(" ", abbr_width_max - abbr_width)
|
||||
vim_item.abbr = choice.abbr .. padding
|
||||
end
|
||||
|
||||
local cmp_ctx = get_lsp_completion_context(entry.completion_item, entry.source)
|
||||
if cmp_ctx ~= nil and cmp_ctx ~= "" then
|
||||
choice.menu = cmp_ctx
|
||||
else
|
||||
choice.menu = ""
|
||||
end
|
||||
|
||||
local menu_width = string.len(choice.menu)
|
||||
if menu_width > menu_width_max then
|
||||
choice.menu = vim.fn.strcharpart(choice.menu, 0, menu_width_max - 1)
|
||||
choice.menu = choice.menu .. icons.ellipses
|
||||
else
|
||||
local padding = string.rep(" ", menu_width_max - menu_width)
|
||||
choice.menu = padding .. choice.menu
|
||||
end
|
||||
|
||||
return choice
|
||||
else
|
||||
local abbr_width_min = 20
|
||||
local abbr_width_max = 50
|
||||
|
||||
local choice = require("lspkind").cmp_format({
|
||||
ellipsis_char = icons.ellipses,
|
||||
maxwidth = abbr_width_max,
|
||||
mode = "symbol",
|
||||
})(entry, vim_item)
|
||||
|
||||
choice.abbr = vim.trim(choice.abbr)
|
||||
|
||||
local abbr_width = string.len(choice.abbr)
|
||||
if abbr_width < abbr_width_min then
|
||||
local padding = string.rep(" ", abbr_width_min - abbr_width)
|
||||
vim_item.abbr = choice.abbr .. padding
|
||||
end
|
||||
|
||||
return choice
|
||||
end
|
||||
return kind
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,9 +6,35 @@ return {
|
|||
end,
|
||||
opts = {
|
||||
transparent_background = true,
|
||||
custom_highlights = function(colors)
|
||||
custom_highlights = function(C)
|
||||
return {
|
||||
Pmenu = { bg = colors.base },
|
||||
Pmenu = { bg = C.base },
|
||||
CmpItemKindSnippet = { fg = C.base, bg = C.mauve },
|
||||
CmpItemKindKeyword = { fg = C.base, bg = C.red },
|
||||
CmpItemKindText = { fg = C.base, bg = C.teal },
|
||||
CmpItemKindMethod = { fg = C.base, bg = C.blue },
|
||||
CmpItemKindConstructor = { fg = C.base, bg = C.blue },
|
||||
CmpItemKindFunction = { fg = C.base, bg = C.blue },
|
||||
CmpItemKindFolder = { fg = C.base, bg = C.blue },
|
||||
CmpItemKindModule = { fg = C.base, bg = C.blue },
|
||||
CmpItemKindConstant = { fg = C.base, bg = C.peach },
|
||||
CmpItemKindField = { fg = C.base, bg = C.green },
|
||||
CmpItemKindProperty = { fg = C.base, bg = C.green },
|
||||
CmpItemKindEnum = { fg = C.base, bg = C.green },
|
||||
CmpItemKindUnit = { fg = C.base, bg = C.green },
|
||||
CmpItemKindClass = { fg = C.base, bg = C.yellow },
|
||||
CmpItemKindVariable = { fg = C.base, bg = C.flamingo },
|
||||
CmpItemKindFile = { fg = C.base, bg = C.blue },
|
||||
CmpItemKindInterface = { fg = C.base, bg = C.yellow },
|
||||
CmpItemKindColor = { fg = C.base, bg = C.red },
|
||||
CmpItemKindReference = { fg = C.base, bg = C.red },
|
||||
CmpItemKindEnumMember = { fg = C.base, bg = C.red },
|
||||
CmpItemKindStruct = { fg = C.base, bg = C.blue },
|
||||
CmpItemKindValue = { fg = C.base, bg = C.peach },
|
||||
CmpItemKindEvent = { fg = C.base, bg = C.blue },
|
||||
CmpItemKindOperator = { fg = C.base, bg = C.blue },
|
||||
CmpItemKindTypeParameter = { fg = C.base, bg = C.blue },
|
||||
CmpItemKindCopilot = { fg = C.base, bg = C.teal },
|
||||
}
|
||||
end,
|
||||
flavor = "mocha",
|
||||
|
|
|
|||
|
|
@ -35,8 +35,8 @@ M.mode = {
|
|||
S = colors.sky,
|
||||
}
|
||||
return {
|
||||
fg = map[mode] or colors.lavender,
|
||||
bg = colors.base,
|
||||
fg = colors.base,
|
||||
bg = map[mode] or colors.blue,
|
||||
}
|
||||
end,
|
||||
}
|
||||
|
|
@ -46,6 +46,7 @@ M.branch = {
|
|||
icon = icons.GitBranch,
|
||||
color = function()
|
||||
local colors = require("catppuccin.palettes").get_palette()
|
||||
|
||||
return { bg = colors.base }
|
||||
end,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue