mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-06 02:11:33 +00:00
treewide: begin restructuring the module tree
This commit is contained in:
parent
e1835f6c46
commit
7c730a78e5
254 changed files with 749 additions and 664 deletions
13
modules/plugins/theme/config.nix
Normal file
13
modules/plugins/theme/config.nix
Normal file
|
@ -0,0 +1,13 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.modules) mkDefault;
|
||||
in {
|
||||
config = {
|
||||
vim.theme = {
|
||||
enable = mkDefault false;
|
||||
name = mkDefault "onedark";
|
||||
style = mkDefault "darker";
|
||||
transparent = mkDefault false;
|
||||
extraConfig = mkDefault "";
|
||||
};
|
||||
};
|
||||
}
|
6
modules/plugins/theme/default.nix
Normal file
6
modules/plugins/theme/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./theme.nix
|
||||
./config.nix
|
||||
];
|
||||
}
|
157
modules/plugins/theme/supported_themes.nix
Normal file
157
modules/plugins/theme/supported_themes.nix
Normal file
|
@ -0,0 +1,157 @@
|
|||
{lib}: {
|
||||
onedark = {
|
||||
setup = {
|
||||
style ? "dark",
|
||||
transparent,
|
||||
}: ''
|
||||
-- OneDark theme
|
||||
require('onedark').setup {
|
||||
style = "${style}"
|
||||
}
|
||||
require('onedark').load()
|
||||
'';
|
||||
styles = ["dark" "darker" "cool" "deep" "warm" "warmer"];
|
||||
};
|
||||
|
||||
tokyonight = {
|
||||
setup = {
|
||||
style ? "night",
|
||||
transparent,
|
||||
}: ''
|
||||
require('tokyonight').setup {
|
||||
transparent = ${lib.boolToString transparent};
|
||||
}
|
||||
vim.cmd[[colorscheme tokyonight-${style}]]
|
||||
'';
|
||||
styles = ["day" "night" "storm" "moon"];
|
||||
};
|
||||
|
||||
dracula = {
|
||||
setup = {
|
||||
style ? null,
|
||||
transparent,
|
||||
}: ''
|
||||
require('dracula').setup({
|
||||
transparent_bg = ${lib.boolToString transparent},
|
||||
});
|
||||
require('dracula').load();
|
||||
'';
|
||||
};
|
||||
|
||||
catppuccin = {
|
||||
setup = {
|
||||
style ? "mocha",
|
||||
transparent ? false,
|
||||
}: ''
|
||||
-- Catppuccin theme
|
||||
require('catppuccin').setup {
|
||||
flavour = "${style}",
|
||||
transparent_background = ${lib.boolToString transparent},
|
||||
integrations = {
|
||||
nvimtree = {
|
||||
enabled = true,
|
||||
transparent_panel = ${lib.boolToString transparent},
|
||||
show_root = true,
|
||||
},
|
||||
|
||||
hop = true,
|
||||
gitsigns = true,
|
||||
telescope = true,
|
||||
treesitter = true,
|
||||
ts_rainbow = true,
|
||||
fidget = true,
|
||||
alpha = true,
|
||||
leap = true,
|
||||
markdown = true,
|
||||
noice = true,
|
||||
notify = true, -- nvim-notify
|
||||
which_key = true,
|
||||
navic = {
|
||||
enabled = false,
|
||||
custom_bg = "NONE", -- "lualine" will set background to mantle
|
||||
},
|
||||
},
|
||||
}
|
||||
-- setup must be called before loading
|
||||
vim.cmd.colorscheme "catppuccin"
|
||||
'';
|
||||
styles = ["latte" "frappe" "macchiato" "mocha"];
|
||||
};
|
||||
|
||||
oxocarbon = {
|
||||
setup = {
|
||||
style ? "dark",
|
||||
transparent ? false,
|
||||
}: let
|
||||
style' =
|
||||
lib.warnIf (style == "light") "oxocarbon: light theme is not well-supported" style;
|
||||
in ''
|
||||
require('oxocarbon')
|
||||
vim.opt.background = "${style'}"
|
||||
vim.cmd.colorscheme = "oxocarbon"
|
||||
'';
|
||||
styles = ["dark" "light"];
|
||||
};
|
||||
|
||||
gruvbox = {
|
||||
setup = {
|
||||
style ? "dark",
|
||||
transparent ? false,
|
||||
}: ''
|
||||
-- Gruvbox theme
|
||||
require("gruvbox").setup({
|
||||
terminal_colors = true, -- add neovim terminal colors
|
||||
undercurl = true,
|
||||
underline = true,
|
||||
bold = true,
|
||||
italic = {
|
||||
strings = true,
|
||||
emphasis = true,
|
||||
comments = true,
|
||||
operators = false,
|
||||
folds = true,
|
||||
},
|
||||
strikethrough = true,
|
||||
invert_selection = false,
|
||||
invert_signs = false,
|
||||
invert_tabline = false,
|
||||
invert_intend_guides = false,
|
||||
inverse = true,
|
||||
contrast = "",
|
||||
palette_overrides = {},
|
||||
overrides = {},
|
||||
dim_inactive = false,
|
||||
transparent_mode = ${lib.boolToString transparent},
|
||||
})
|
||||
vim.o.background = "${style}"
|
||||
vim.cmd("colorscheme gruvbox")
|
||||
'';
|
||||
styles = ["dark" "light"];
|
||||
};
|
||||
rose-pine = {
|
||||
setup = {
|
||||
style ? "main",
|
||||
transparent ? false,
|
||||
}: ''
|
||||
require("rose-pine").setup({
|
||||
dark_variant = "${style}", -- main, moon, or dawn
|
||||
dim_inactive_windows = false,
|
||||
extend_background_behind_borders = true,
|
||||
|
||||
enable = {
|
||||
terminal = true,
|
||||
migrations = true,
|
||||
},
|
||||
|
||||
styles = {
|
||||
bold = false,
|
||||
italic = false, -- I would like to add more options for this
|
||||
transparency = ${lib.boolToString transparent},
|
||||
},
|
||||
})
|
||||
|
||||
vim.cmd("colorscheme rose-pine")
|
||||
'';
|
||||
styles = ["main" "moon" "dawn"];
|
||||
};
|
||||
}
|
52
modules/plugins/theme/theme.nix
Normal file
52
modules/plugins/theme/theme.nix
Normal file
|
@ -0,0 +1,52 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkOption;
|
||||
inherit (lib.attrsets) attrNames;
|
||||
inherit (lib.types) bool lines enum;
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.dag) entryBefore;
|
||||
|
||||
cfg = config.vim.theme;
|
||||
supported_themes = import ./supported_themes.nix {inherit lib;};
|
||||
in {
|
||||
options.vim.theme = {
|
||||
enable = mkOption {
|
||||
type = bool;
|
||||
description = "Enable theming";
|
||||
};
|
||||
|
||||
name = mkOption {
|
||||
type = enum (attrNames supported_themes);
|
||||
description = "Supported themes can be found in `supported_themes.nix`";
|
||||
};
|
||||
|
||||
style = mkOption {
|
||||
type = enum supported_themes.${cfg.name}.styles;
|
||||
description = "Specific style for theme if it supports it";
|
||||
};
|
||||
|
||||
transparent = mkOption {
|
||||
type = bool;
|
||||
default = false;
|
||||
description = "Whether or not transparency should be enabled. Has no effect for themes that do not support transparency";
|
||||
};
|
||||
|
||||
extraConfig = mkOption {
|
||||
type = lines;
|
||||
description = "Additional lua configuration to add before setup";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = [cfg.name];
|
||||
luaConfigRC = {
|
||||
themeSetup = entryBefore ["theme"] cfg.extraConfig;
|
||||
theme = supported_themes.${cfg.name}.setup (with cfg; {inherit style transparent;});
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue