From 52abd8f31116281920f9b7ea2f7f17469b3236cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thea=20Sch=C3=B6bl?= Date: Sun, 7 Apr 2024 19:10:17 +0200 Subject: [PATCH] feat: nvim integration --- .../home-manager/programs/nixvim/default.nix | 36 ------------------- .../programs/nixvim/extra-config.lua | 10 ------ modules/home-manager/theme/default.nix | 5 ++- .../integrations/neovim/default.mustache | 21 +++++++++++ .../theme/integrations/neovim/default.nix | 33 +++++++++++++++++ 5 files changed, 58 insertions(+), 47 deletions(-) create mode 100644 modules/home-manager/theme/integrations/neovim/default.mustache create mode 100644 modules/home-manager/theme/integrations/neovim/default.nix diff --git a/modules/home-manager/programs/nixvim/default.nix b/modules/home-manager/programs/nixvim/default.nix index b31fc29..13e8749 100644 --- a/modules/home-manager/programs/nixvim/default.nix +++ b/modules/home-manager/programs/nixvim/default.nix @@ -1,23 +1,4 @@ { pkgs }: -let - darkman = pkgs.vimUtils.buildVimPlugin { - name = "darkman"; - src = pkgs.buildGoModule rec { - pname = "darkman.nvim"; - version = "0.0.1"; - vendorHash = "sha256-HpyKzvKVN9hVRxxca4sdWRo91H32Ha9gxitr7Qg5MY8="; - src = pkgs.fetchFromGitHub { - owner = "4e554c4c"; - repo = "darkman.nvim"; - rev = "150aa63a13837c44abd87ff20d3a806321a17b2d"; - sha256 = "sha256-ssEYdM460I1rufjgh63CEkLi4K+bEWbwku/6gQbytno="; - }; - postInstall = '' - cp -r lua $out - ''; - }; - }; -in { enable = true; defaultEditor = true; @@ -90,25 +71,9 @@ in extraConfigLua = builtins.readFile ./extra-config.lua; - colorschemes.catppuccin = { - enable = true; - terminalColors = true; - transparentBackground = true; - background = { - dark = "frappe"; - light = "latte"; - }; - integrations.native_lsp.underlines = { - errors = [ "undercurl" ]; - warnings = [ "undercurl" ]; - }; - customHighlights = builtins.readFile ./custom-highlights.lua; - }; - plugins = { lualine = { enable = true; - theme = "catppuccin"; globalstatus = true; sectionSeparators = { left = ""; @@ -470,7 +435,6 @@ in ]; extraPlugins = with pkgs.vimPlugins; [ vim-mergetool - darkman rest-nvim plenary-nvim actions-preview-nvim diff --git a/modules/home-manager/programs/nixvim/extra-config.lua b/modules/home-manager/programs/nixvim/extra-config.lua index ff7da83..4b2cd41 100644 --- a/modules/home-manager/programs/nixvim/extra-config.lua +++ b/modules/home-manager/programs/nixvim/extra-config.lua @@ -1,18 +1,8 @@ -require("darkman").setup() require("cmp-npm").setup({}) require("rest-nvim").setup({}) require("actions-preview").setup({}) if vim.g.neovide then - vim.api.nvim_create_autocmd("ColorScheme", { - pattern = "*", - callback = function() - local flavour = require("catppuccin").options.background[vim.o.background] - local palette = require("catppuccin.palettes").get_palette(flavour) - vim.cmd("hi Normal guibg=" .. palette.base) - vim.cmd("set pumblend=100") - end, - }) -- no idea why this is needed vim.opt.linespace = -1 end diff --git a/modules/home-manager/theme/default.nix b/modules/home-manager/theme/default.nix index 5e32a42..b02a82b 100644 --- a/modules/home-manager/theme/default.nix +++ b/modules/home-manager/theme/default.nix @@ -11,7 +11,10 @@ let cfg = config.theme.base16; in { - imports = [ ./integrations/kitty ]; + imports = [ + ./integrations/kitty + ./integrations/neovim + ]; options.theme.base16 = { enable = mkEnableOption "Enable a global base16 theme"; diff --git a/modules/home-manager/theme/integrations/neovim/default.mustache b/modules/home-manager/theme/integrations/neovim/default.mustache new file mode 100644 index 0000000..d1b0654 --- /dev/null +++ b/modules/home-manager/theme/integrations/neovim/default.mustache @@ -0,0 +1,21 @@ +-- Base16 {{scheme-name}} - nvim color config +-- Scheme by {{scheme-author}} + +require('base16-colorscheme').setup({ + base00 = '#{{base00-hex}}', + base01 = '#{{base01-hex}}', + base02 = '#{{base02-hex}}', + base03 = '#{{base03-hex}}', + base04 = '#{{base04-hex}}', + base05 = '#{{base05-hex}}', + base06 = '#{{base06-hex}}', + base07 = '#{{base07-hex}}', + base08 = '#{{base08-hex}}', + base09 = '#{{base09-hex}}', + base0A = '#{{base0A-hex}}', + base0B = '#{{base0B-hex}}', + base0C = '#{{base0C-hex}}', + base0D = '#{{base0D-hex}}', + base0E = '#{{base0E-hex}}', + base0F = '#{{base0F-hex}}' +}) diff --git a/modules/home-manager/theme/integrations/neovim/default.nix b/modules/home-manager/theme/integrations/neovim/default.nix new file mode 100644 index 0000000..08f8b1b --- /dev/null +++ b/modules/home-manager/theme/integrations/neovim/default.nix @@ -0,0 +1,33 @@ +{ + config, + lib, + pkgs, + ... +}: + +with lib; + +let + cfg = config.theme.base16; +in +{ + config = mkIf cfg.enable { + programs.nixvim = { + extraConfigLuaPre = '' + require('flavours-colors') + ''; + extraPlugins = [ pkgs.vimPlugins.base16-nvim ]; + }; + + xdg.configFile."flavours/templates/nvim/templates/default.mustache".source = ./default.mustache; + + theme.base16.options.items = [ + { + file = "${config.xdg.configHome}/nvim/lua/flavours-colors.lua"; + template = "nvim"; + #hook = "kill -SIGUSR1 $(pgrep kitty)"; + rewrite = true; + } + ]; + }; +}