From cc801b4981b30c28a0eef97c8e14aeae09ccd908 Mon Sep 17 00:00:00 2001 From: Noah Masur <7386960+nmasur@users.noreply.github.com> Date: Sat, 9 Jul 2022 21:57:56 +0000 Subject: [PATCH] neovim colors.lua based on colorscheme --- hosts/wsl/default.nix | 1 + modules/colorscheme/gruvbox/default.nix | 22 +++++++++++++++++++++ modules/editor/neovim/default.nix | 6 +++++- modules/editor/neovim/lua/packer/colors.lua | 17 ---------------- 4 files changed, 28 insertions(+), 18 deletions(-) delete mode 100644 modules/editor/neovim/lua/packer/colors.lua diff --git a/hosts/wsl/default.nix b/hosts/wsl/default.nix index add539d..f2ba0ab 100644 --- a/hosts/wsl/default.nix +++ b/hosts/wsl/default.nix @@ -12,6 +12,7 @@ nixpkgs.lib.nixosSystem { { networking.hostName = "wsl"; gui.enable = false; + gui.colorscheme = (import ../../modules/colorscheme/gruvbox); passwordHash = "$6$PZYiMGmJIIHAepTM$Wx5EqTQ5GApzXx58nvi8azh16pdxrN6Qrv1wunDlzveOgawitWzcIxuj76X9V868fsPi/NOIEO8yVXqwzS9UF."; wsl = { diff --git a/modules/colorscheme/gruvbox/default.nix b/modules/colorscheme/gruvbox/default.nix index 45ffb32..cd877c8 100644 --- a/modules/colorscheme/gruvbox/default.nix +++ b/modules/colorscheme/gruvbox/default.nix @@ -18,4 +18,26 @@ base0D = "#83a598"; # blue base0E = "#d3869b"; # purple base0F = "#d65d0e"; # brown + neovimConfig = '' + local M = {} + + M.packer = function(use) + use({ + "morhetz/gruvbox", + config = function() + vim.g.gruvbox_italic = 1 + -- vim.api.nvim_create_autocmd("ColorScheme", { + -- pattern = "*", + -- command = "colorscheme gruvbox", + -- }) + vim.cmd([[ + autocmd ColorScheme * highlight Normal ctermbg=NONE guibg=NONE + colorscheme gruvbox + ]]) + end, + }) + end + + return M + ''; } diff --git a/modules/editor/neovim/default.nix b/modules/editor/neovim/default.nix index 8e3b459..628c1b0 100644 --- a/modules/editor/neovim/default.nix +++ b/modules/editor/neovim/default.nix @@ -11,7 +11,11 @@ xdg.configFile = { "nvim/init.lua".source = ./init.lua; - "nvim/lua".source = ./lua; + "nvim/lua" = { + source = ./lua; + recursive = true; # Allows adding more files + }; + "nvim/lua/packer/colors.lua".text = config.gui.colorscheme.neovimConfig; }; programs.git.extraConfig.core.editor = "nvim"; diff --git a/modules/editor/neovim/lua/packer/colors.lua b/modules/editor/neovim/lua/packer/colors.lua deleted file mode 100644 index e3cba72..0000000 --- a/modules/editor/neovim/lua/packer/colors.lua +++ /dev/null @@ -1,17 +0,0 @@ -local M = {} - -M.packer = function(use) - -- Colorscheme - use({ - "morhetz/gruvbox", - config = function() - vim.g.gruvbox_italic = 1 - vim.cmd([[ - autocmd ColorScheme * highlight Normal ctermbg=NONE guibg=NONE - colorscheme gruvbox - ]]) - end, - }) -end - -return M