nvf: add custom theme module \
This commit is contained in:
parent
e2a4f1c4bb
commit
1c29de52d3
7 changed files with 166 additions and 1 deletions
|
|
@ -122,6 +122,8 @@
|
|||
header = args.neutrals."800";
|
||||
footer = args.neutrals."800";
|
||||
menu = args.neutrals."800";
|
||||
selection = args.neutrals."650";
|
||||
dimmed = args.neutrals."850";
|
||||
};
|
||||
border = {
|
||||
base = args.neutrals."650";
|
||||
|
|
@ -164,6 +166,8 @@
|
|||
header = args.neutrals."150";
|
||||
footer = args.neutrals."150";
|
||||
menu = args.neutrals."150";
|
||||
selection = args.neutrals."300";
|
||||
dimmed = args.neutrals."200";
|
||||
};
|
||||
border = {
|
||||
base = args.neutrals."800";
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
vim.statusline.lualine = {
|
||||
enable = true;
|
||||
activeSection = {
|
||||
# most of this are the default values provided by nvf
|
||||
a = [
|
||||
#lua
|
||||
''
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
{
|
||||
inputs,
|
||||
pkgs,
|
||||
hozen,
|
||||
...
|
||||
}: let
|
||||
ooks-vim = inputs.nvf.lib.neovimConfiguration {
|
||||
inherit pkgs;
|
||||
extraSpecialArgs = {inherit inputs;};
|
||||
extraSpecialArgs = {inherit inputs hozen;};
|
||||
modules = [
|
||||
./config
|
||||
./modules
|
||||
|
|
|
|||
|
|
@ -3,5 +3,6 @@
|
|||
./gruvbox-material
|
||||
./telescope
|
||||
./obsidian
|
||||
./theme
|
||||
];
|
||||
}
|
||||
|
|
|
|||
49
outputs/pkgs/ook-vim/modules/plugins/theme/config.nix
Normal file
49
outputs/pkgs/ook-vim/modules/plugins/theme/config.nix
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf;
|
||||
inherit (lib.nvim.dag) entryBefore;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
|
||||
cfg = config.vim.theme.custom;
|
||||
|
||||
themePlugin = pkgs.vimUtils.buildVimPlugin {
|
||||
inherit (cfg) name;
|
||||
src = pkgs.writeTextDir "colors/${cfg.name}.lua" ''
|
||||
local M = {}
|
||||
M.highlights = ${toLuaObject cfg.highlights}
|
||||
|
||||
local function set_groups()
|
||||
for group, settings in pairs(M.highlights) do
|
||||
vim.api.nvim_set_hl(0, group, settings)
|
||||
end
|
||||
end
|
||||
|
||||
function M.colorscheme()
|
||||
vim.api.nvim_command("hi clear")
|
||||
if vim.fn.exists("syntax_on") then
|
||||
vim.api.nvim_command("syntax reset")
|
||||
end
|
||||
|
||||
vim.o.termguicolors = true
|
||||
vim.g.colors_name = "${cfg.name}"
|
||||
|
||||
set_groups()
|
||||
end
|
||||
|
||||
return M.colorscheme()
|
||||
'';
|
||||
};
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = [themePlugin];
|
||||
luaConfigRC.customTheme = ''
|
||||
vim.cmd.colorscheme("${cfg.name}")
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
103
outputs/pkgs/ook-vim/modules/plugins/theme/custom-theme.nix
Normal file
103
outputs/pkgs/ook-vim/modules/plugins/theme/custom-theme.nix
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib) mkOption mkEnableOption;
|
||||
inherit (lib.types) nullOr str bool attrsOf submodule;
|
||||
|
||||
highlightOpts = submodule {
|
||||
options = {
|
||||
# https://neovim.io/doc/user/api.html#nvim_set_hl()
|
||||
fg = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
description = "Foreground color";
|
||||
};
|
||||
bg = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
description = "Background color";
|
||||
};
|
||||
sp = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
description = "SP color";
|
||||
};
|
||||
blend = mkOption {
|
||||
type = nullOr bool;
|
||||
default = null;
|
||||
description = "Blend attribute";
|
||||
};
|
||||
bold = mkOption {
|
||||
type = nullOr bool;
|
||||
default = null;
|
||||
description = "Italic attribute";
|
||||
};
|
||||
standout = mkOption {
|
||||
type = nullOr bool;
|
||||
default = null;
|
||||
description = "Standout attribute";
|
||||
};
|
||||
underline = mkOption {
|
||||
type = nullOr bool;
|
||||
default = null;
|
||||
description = "underline attribute";
|
||||
};
|
||||
undercurl = mkOption {
|
||||
type = nullOr bool;
|
||||
default = null;
|
||||
description = "Undercurl attribute";
|
||||
};
|
||||
underdouble = mkOption {
|
||||
type = nullOr bool;
|
||||
default = null;
|
||||
description = "Underdouble attribute";
|
||||
};
|
||||
underdotted = mkOption {
|
||||
type = nullOr bool;
|
||||
default = null;
|
||||
description = "Underdotted attribute";
|
||||
};
|
||||
underdashed = mkOption {
|
||||
type = nullOr bool;
|
||||
default = null;
|
||||
description = "Underdashed attribute";
|
||||
};
|
||||
strikethrough = mkOption {
|
||||
type = nullOr bool;
|
||||
default = null;
|
||||
description = "Strikethrough attribute";
|
||||
};
|
||||
italic = mkOption {
|
||||
type = nullOr bool;
|
||||
default = null;
|
||||
description = "Bold attribute";
|
||||
};
|
||||
reverse = mkOption {
|
||||
type = nullOr bool;
|
||||
default = null;
|
||||
description = "Reverse attribute";
|
||||
};
|
||||
nocombine = mkOption {
|
||||
type = nullOr bool;
|
||||
default = null;
|
||||
description = "Nocombine attribute";
|
||||
};
|
||||
link = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
description = "Link attribute";
|
||||
};
|
||||
};
|
||||
};
|
||||
in {
|
||||
options.vim.theme.custom = {
|
||||
enable = mkEnableOption "Enable custom theme";
|
||||
name = mkOption {
|
||||
type = str;
|
||||
default = "my-custom-theme";
|
||||
description = "Name of custom theme";
|
||||
};
|
||||
highlights = mkOption {
|
||||
type = attrsOf highlightOpts;
|
||||
default = {};
|
||||
};
|
||||
};
|
||||
}
|
||||
6
outputs/pkgs/ook-vim/modules/plugins/theme/default.nix
Normal file
6
outputs/pkgs/ook-vim/modules/plugins/theme/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./config.nix
|
||||
./custom-theme.nix
|
||||
];
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue