From 42130edad630d1e644dda89340a113192704651e Mon Sep 17 00:00:00 2001 From: Sojus07 Date: Tue, 18 Feb 2025 23:30:47 +0100 Subject: [PATCH] kekl --- hosts/default/editors/nvim/lsp.nix | 1 + hosts/default/editors/nvim/raw/cmp.lua | 124 ++++++++++++++----------- hosts/default/home/nix/tmux.nix | 2 +- hosts/default/system/pkgs.nix | 7 +- hosts/meteor/configuration.nix | 3 +- hosts/sputnik/configuration.nix | 3 +- 6 files changed, 78 insertions(+), 62 deletions(-) diff --git a/hosts/default/editors/nvim/lsp.nix b/hosts/default/editors/nvim/lsp.nix index a8c2dbd..8bc4e23 100644 --- a/hosts/default/editors/nvim/lsp.nix +++ b/hosts/default/editors/nvim/lsp.nix @@ -72,6 +72,7 @@ }; }; lsp = { + lspkind.enable = true; trouble = { enable = true; }; diff --git a/hosts/default/editors/nvim/raw/cmp.lua b/hosts/default/editors/nvim/raw/cmp.lua index 187207c..f57c9d8 100644 --- a/hosts/default/editors/nvim/raw/cmp.lua +++ b/hosts/default/editors/nvim/raw/cmp.lua @@ -1,59 +1,77 @@ local cmp = require("cmp") +local lspkind = require("lspkind") + vim.opt.completeopt = { "menu", "menuone", "noinsert", "noselect" } + cmp.setup({ - snippet = { - expand = function(args) - require('luasnip').lsp_expand(args.body) - end, - }, - sorting = { - comparators = { - cmp.config.compare.offset, - cmp.config.compare.exact, - cmp.config.compare.recently_used, - cmp.config.compare.kind, - cmp.config.compare.sort_text, - cmp.config.compare.length, - cmp.config.compare.order, - }, - }, - window = { - completion = cmp.config.window.bordered(), - documentation = cmp.config.window.bordered(), - }, - mapping = cmp.mapping.preset.insert({ - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - else - fallback() - end - end, { "i", "s" }), +formatting = { + format = function(entry, vim_item) + vim_item.menu = ({ + nvim_lsp = "[LSP]", + buffer = "[BUF]", + path = "[PATH]", + luasnip = "[SNIP]", + nvim_lua = "[LUA]", + })[entry.source.name] - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - else - fallback() - end - end, { "i", "s" }), - - [""] = cmp.mapping.scroll_docs(-4), - [""] = cmp.mapping.scroll_docs(4), - [""] = cmp.mapping.complete(), - [""] = cmp.mapping.abort(), - [""] = cmp.mapping.abort(), - [""] = cmp.mapping.confirm({ select = false }), - }), - sources = cmp.config.sources({ - { name = 'nvim_lsp' }, - { name = 'luasnip' }, - { name = 'buffer' }, - { name = 'path' }, - { name = 'nvim_lua' }, - { name = 'emoji' }, - }), - highlight = { - default = "Subtle" + vim_item.kind = lspkind.symbolic(vim_item.kind, { mode = "symbol" }) + return vim_item + end, +}, +sorting = { + comparators = { + cmp.config.compare.offset, + cmp.config.compare.exact, + cmp.config.compare.recently_used, + cmp.config.compare.kind, + cmp.config.compare.sort_text, + cmp.config.compare.length, + cmp.config.compare.order, }, +}, +window = { + completion = { + autocomplete = true, + col_offset = -3, + side_padding = 0, + }, + completion = cmp.config.window.bordered({ + winhighlight = "Normal:Pmenu,FloatBorder:Pmenu,CursorLine:PmenuSel,Search:None", + }), + documentation = cmp.config.window.bordered({ + winhighlight = "Normal:Pmenu,FloatBorder:Pmenu,CursorLine:PmenuSel,Search:None", + }), +}, +mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + else + fallback() + end + end, { "i", "s" }), + + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + else + fallback() + end + end, { "i", "s" }), + + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.abort(), + [""] = cmp.mapping.abort(), + [""] = cmp.mapping.confirm({ select = false }), +}), +sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'luasnip' }, + { name = 'buffer' }, + { name = 'path' }, + { name = 'nvim_lua' }, +}), }) + diff --git a/hosts/default/home/nix/tmux.nix b/hosts/default/home/nix/tmux.nix index be99b23..5296f14 100644 --- a/hosts/default/home/nix/tmux.nix +++ b/hosts/default/home/nix/tmux.nix @@ -21,7 +21,7 @@ bind t new-window bind -n M-w previous-window bind -n M-e next-window - bind r source-file ~/.tmux.conf + bind r source-file ~/.config/tmux/tmux.conf bind -n M-Left select-pane -L bind -n M-Right select-pane -R bind -n M-Up select-pane -U diff --git a/hosts/default/system/pkgs.nix b/hosts/default/system/pkgs.nix index 7b0df4a..071c5a8 100644 --- a/hosts/default/system/pkgs.nix +++ b/hosts/default/system/pkgs.nix @@ -67,7 +67,6 @@ binwalk chirp picocom - pwndbg minipro ethtool @@ -105,7 +104,6 @@ fonts = { fontconfig.enable = true; packages = with pkgs; [ - terminus-nerdfont noto-fonts noto-fonts-emoji liberation_ttf @@ -115,8 +113,9 @@ mplus-outline-fonts.githubRelease dina-font proggyfonts - pkgs.nerd-fonts._0xproto - pkgs.nerd-fonts.droid-sans-mono + nerd-fonts._0xproto + nerd-fonts.droid-sans-mono + nerd-fonts.terminess-ttf ]; }; diff --git a/hosts/meteor/configuration.nix b/hosts/meteor/configuration.nix index 3b6c7d1..dcbf434 100644 --- a/hosts/meteor/configuration.nix +++ b/hosts/meteor/configuration.nix @@ -9,7 +9,6 @@ imports = [ ./hardware-configuration.nix - ./modules/default.nix ../default/default.nix ]; @@ -64,6 +63,6 @@ "pacman.conf".source = ../default/raw/pacman.conf; }; - system.stateVersion = "unstable"; + system.stateVersion = "25.05"; } diff --git a/hosts/sputnik/configuration.nix b/hosts/sputnik/configuration.nix index f458527..4087373 100644 --- a/hosts/sputnik/configuration.nix +++ b/hosts/sputnik/configuration.nix @@ -9,7 +9,6 @@ imports = [ ./hardware-configuration.nix - ./modules/default.nix ../default/default.nix ]; @@ -58,6 +57,6 @@ "pacman.conf".source = ../default/raw/pacman.conf; }; - system.stateVersion = "unstable"; + system.stateVersion = "25.05"; }