mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-22 13:20:44 +00:00
Compare commits
13 commits
12b650fea7
...
013a6ddd9f
Author | SHA1 | Date | |
---|---|---|---|
|
013a6ddd9f | ||
|
67fb3e00a4 | ||
|
e9f9353c45 | ||
|
7c01a7c875 | ||
|
8f10028449 | ||
|
2c3350eb15 | ||
|
0fa8fbdf6f | ||
|
c177916790 | ||
|
59b8335a26 | ||
|
b66ee19ff3 | ||
|
ba1c3645ee | ||
|
b2ba2c0ab5 | ||
|
b41163959b |
11 changed files with 315 additions and 139 deletions
|
@ -5,7 +5,7 @@ in {
|
|||
vim.theme = {
|
||||
enable = mkDefault false;
|
||||
name = mkDefault "onedark";
|
||||
style = mkDefault "darker";
|
||||
# style = mkDefault "darker";
|
||||
transparent = mkDefault false;
|
||||
extraConfig = mkDefault "";
|
||||
};
|
||||
|
|
|
@ -2,105 +2,139 @@
|
|||
config,
|
||||
lib,
|
||||
}: let
|
||||
inherit (lib.strings) optionalString;
|
||||
inherit (lib.trivial) boolToString warnIf;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
inherit (lib.strings) hasPrefix optionalString;
|
||||
inherit (lib.attrsets) genAttrs listToAttrs mergeAttrsList;
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.types) bool str;
|
||||
inherit (lib.nvim.types) hexColor mkPluginSetupOption;
|
||||
cfg = config.vim.theme;
|
||||
|
||||
mkEnableOption' = name: mkEnableOption name // {default = true;};
|
||||
numbers = ["0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "A" "B" "C" "D" "E" "F"];
|
||||
base16Options = listToAttrs (map (n: {
|
||||
name = "base0${n}";
|
||||
value = mkOption {
|
||||
description = "The base0${n} color to use";
|
||||
type = hexColor;
|
||||
apply = v:
|
||||
if hasPrefix "#" v
|
||||
then v
|
||||
else "#${v}";
|
||||
};
|
||||
})
|
||||
numbers);
|
||||
in {
|
||||
base16 = {
|
||||
setup = {base16-colors, ...}: ''
|
||||
-- Base16 theme
|
||||
require('base16-colorscheme').setup(${toLuaObject base16-colors})
|
||||
'';
|
||||
setupOpts = mkPluginSetupOption "base16" base16Options;
|
||||
setup = "";
|
||||
};
|
||||
|
||||
onedark = {
|
||||
setup = {style ? "dark", ...}: ''
|
||||
setupOpts = mkPluginSetupOption "onedark" {
|
||||
style = mkOption {
|
||||
type = str;
|
||||
default = cfg.style;
|
||||
internal = true;
|
||||
};
|
||||
};
|
||||
setup = ''
|
||||
-- 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 = ${boolToString transparent};
|
||||
}
|
||||
vim.cmd[[colorscheme tokyonight-${style}]]
|
||||
setupOpts = mkPluginSetupOption "tokyonight" {
|
||||
transparent = mkOption {
|
||||
type = bool;
|
||||
default = cfg.transparent;
|
||||
internal = true;
|
||||
};
|
||||
};
|
||||
setup = ''
|
||||
vim.cmd[[colorscheme tokyonight-${cfg.style}]]
|
||||
'';
|
||||
styles = ["day" "night" "storm" "moon"];
|
||||
styles = ["night" "day" "storm" "moon"];
|
||||
};
|
||||
|
||||
dracula = {
|
||||
setup = {transparent, ...}: ''
|
||||
require('dracula').setup({
|
||||
transparent_bg = ${boolToString transparent},
|
||||
});
|
||||
setupOpts = mkPluginSetupOption "dracula" {
|
||||
transparent_bg = mkOption {
|
||||
type = bool;
|
||||
default = cfg.transparent;
|
||||
internal = true;
|
||||
};
|
||||
};
|
||||
setup = ''
|
||||
require('dracula').load();
|
||||
'';
|
||||
};
|
||||
|
||||
catppuccin = {
|
||||
setup = {
|
||||
style ? "mocha",
|
||||
transparent ? false,
|
||||
...
|
||||
}: ''
|
||||
-- Catppuccin theme
|
||||
require('catppuccin').setup {
|
||||
flavour = "${style}",
|
||||
transparent_background = ${boolToString transparent},
|
||||
term_colors = true,
|
||||
integrations = {
|
||||
setupOpts = mkPluginSetupOption "catppuccin" {
|
||||
flavour = mkOption {
|
||||
type = str;
|
||||
default = cfg.style;
|
||||
# internal = true;
|
||||
};
|
||||
transparent_background = mkOption {
|
||||
type = bool;
|
||||
default = cfg.transparent;
|
||||
internal = true;
|
||||
};
|
||||
term_colors = mkEnableOption' "term_colors";
|
||||
integrations =
|
||||
{
|
||||
nvimtree = {
|
||||
enabled = true,
|
||||
transparent_panel = ${boolToString transparent},
|
||||
show_root = true,
|
||||
},
|
||||
enabled = mkEnableOption' "enabled";
|
||||
transparent_panel = mkOption {
|
||||
type = bool;
|
||||
default = cfg.transparent;
|
||||
};
|
||||
show_root = mkEnableOption' "show_root";
|
||||
};
|
||||
|
||||
hop = true,
|
||||
gitsigns = true,
|
||||
telescope = true,
|
||||
treesitter = true,
|
||||
treesitter_context = true,
|
||||
ts_rainbow = true,
|
||||
fidget = true,
|
||||
alpha = true,
|
||||
leap = true,
|
||||
markdown = true,
|
||||
noice = true,
|
||||
notify = true, -- nvim-notify
|
||||
which_key = true,
|
||||
navic = {
|
||||
enabled = true,
|
||||
custom_bg = "NONE", -- "lualine" will set background to mantle
|
||||
},
|
||||
},
|
||||
enabled = mkEnableOption' "enabled";
|
||||
# lualine will set backgound to mantle
|
||||
custom_bg = mkOption {
|
||||
type = str;
|
||||
default = "NONE";
|
||||
};
|
||||
};
|
||||
}
|
||||
// genAttrs [
|
||||
"hop"
|
||||
"gitsigns"
|
||||
"telescope"
|
||||
"treesitter"
|
||||
"treesitter_context"
|
||||
"ts_rainbow"
|
||||
"fidget"
|
||||
"alpha"
|
||||
"leap"
|
||||
"markdown"
|
||||
"noice"
|
||||
"notify"
|
||||
"which_key"
|
||||
] (name: mkEnableOption' name);
|
||||
};
|
||||
setup = ''
|
||||
-- Catppuccin theme
|
||||
-- setup must be called before loading
|
||||
vim.cmd.colorscheme "catppuccin"
|
||||
'';
|
||||
styles = ["latte" "frappe" "macchiato" "mocha"];
|
||||
styles = ["mocha" "latte" "frappe" "macchiato"];
|
||||
};
|
||||
|
||||
oxocarbon = {
|
||||
setup = {
|
||||
style ? "dark",
|
||||
transparent ? false,
|
||||
}: let
|
||||
style' =
|
||||
warnIf (style == "light") "oxocarbon: light theme is not well-supported" style;
|
||||
in ''
|
||||
setupOpts = {};
|
||||
setup = ''
|
||||
require('oxocarbon')
|
||||
vim.opt.background = "${style'}"
|
||||
vim.opt.background = "${cfg.style}"
|
||||
vim.cmd.colorscheme = "oxocarbon"
|
||||
${optionalString transparent ''
|
||||
${optionalString cfg.transparent ''
|
||||
vim.api.nvim_set_hl(0, "Normal", { bg = "none" })
|
||||
vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" })
|
||||
vim.api.nvim_set_hl(0, "LineNr", { bg = "none" })
|
||||
|
@ -114,62 +148,84 @@ in {
|
|||
};
|
||||
|
||||
gruvbox = {
|
||||
setup = {
|
||||
style ? "dark",
|
||||
transparent ? false,
|
||||
}: ''
|
||||
setupOpts =
|
||||
mkPluginSetupOption "gruvbox" {
|
||||
transparent_mode = mkOption {
|
||||
type = bool;
|
||||
default = cfg.transparent;
|
||||
internal = true;
|
||||
};
|
||||
italic =
|
||||
{
|
||||
operators = mkEnableOption "operators";
|
||||
}
|
||||
// genAttrs [
|
||||
"strings"
|
||||
"emphasis"
|
||||
"comments"
|
||||
"folds"
|
||||
] (name: mkEnableOption' name);
|
||||
|
||||
contrast = mkOption {
|
||||
type = str;
|
||||
default = "";
|
||||
};
|
||||
# TODO: fix these
|
||||
# palette_overrides = mkLuaInline "{}";
|
||||
# overrides = mkLuaInline "{}";
|
||||
}
|
||||
// mergeAttrsList [
|
||||
(genAttrs [
|
||||
"terminal_colors"
|
||||
"undercurls"
|
||||
"underline"
|
||||
"bold"
|
||||
"strikethrough"
|
||||
"inverse"
|
||||
] (name: mkEnableOption' name))
|
||||
(genAttrs [
|
||||
"invert_selection"
|
||||
"invert_signs"
|
||||
"invert_tabline"
|
||||
"invert_intend_guides"
|
||||
"dim_inactive"
|
||||
] (name: mkEnableOption name))
|
||||
];
|
||||
setup = ''
|
||||
-- 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 = ${boolToString transparent},
|
||||
})
|
||||
vim.o.background = "${style}"
|
||||
vim.o.background = "${cfg.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,
|
||||
setupOpts = mkPluginSetupOption "rose-pine" {
|
||||
dark_variant = mkOption {
|
||||
type = str;
|
||||
default = cfg.style;
|
||||
internal = true;
|
||||
};
|
||||
dim_inactive_windows = mkEnableOption "dim_inactive_windows";
|
||||
extend_background_behind_borders = mkEnableOption' "extend_background_behind_borders";
|
||||
|
||||
enable = {
|
||||
terminal = true,
|
||||
migrations = true,
|
||||
},
|
||||
terminal = mkEnableOption' "terminal";
|
||||
migrations = mkEnableOption' "migrations";
|
||||
};
|
||||
|
||||
styles = {
|
||||
bold = false,
|
||||
italic = false, -- I would like to add more options for this
|
||||
transparency = ${boolToString transparent},
|
||||
},
|
||||
})
|
||||
bold = mkEnableOption "bold";
|
||||
# I would like to add more options for this
|
||||
italic = mkEnableOption "italic";
|
||||
transparency = mkOption {
|
||||
type = bool;
|
||||
default = cfg.transparent;
|
||||
internal = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
setup = ''
|
||||
vim.cmd("colorscheme rose-pine")
|
||||
'';
|
||||
styles = ["main" "moon" "dawn"];
|
||||
|
|
43
modules/plugins/theme/supported-themes/base16.nix
Normal file
43
modules/plugins/theme/supported-themes/base16.nix
Normal file
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
cfg = config.vim.theme;
|
||||
inherit (lib.strings) hasPrefix;
|
||||
inherit (lib.attrsets) listToAttrs;
|
||||
inherit (lib.options) mkOption;
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.types) hexColor mkPluginSetupOption;
|
||||
inherit (lib.nvim.dag) entryBefore;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
|
||||
numbers = ["0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "A" "B" "C" "D" "E" "F"];
|
||||
base16Options = listToAttrs (map (n: {
|
||||
name = "base0${n}";
|
||||
value = mkOption {
|
||||
description = "The base0${n} color to use";
|
||||
type = hexColor;
|
||||
apply = v:
|
||||
if hasPrefix "#" v
|
||||
then v
|
||||
else "#${v}";
|
||||
};
|
||||
})
|
||||
numbers);
|
||||
in {
|
||||
base16 = {
|
||||
setupOpts = mkPluginSetupOption "base16" base16Options;
|
||||
setup = "";
|
||||
};
|
||||
config =
|
||||
mkIf cfg.name
|
||||
== "base16" {
|
||||
vim = {
|
||||
startPlugins = ["base16"];
|
||||
luaConfigRC.theme = entryBefore ["pluginConfigs"] ''
|
||||
require('base16-colorscheme').setup(${toLuaObject cfg.setupOpts})
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
78
modules/plugins/theme/supported-themes/catppuccin.nix
Normal file
78
modules/plugins/theme/supported-themes/catppuccin.nix
Normal file
|
@ -0,0 +1,78 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
cfg = config.vim.theme;
|
||||
inherit (lib.strings) hasPrefix optionalString;
|
||||
inherit (lib.attrsets) genAttrs listToAttrs mergeAttrsList;
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.types) bool str;
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.types) hexColor mkPluginSetupOption;
|
||||
inherit (lib.nvim.dag) entryBefore;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
mkEnableOption' = name: mkEnableOption name // {default = true;};
|
||||
in {
|
||||
catppuccin = {
|
||||
setupOpts = mkPluginSetupOption "catppuccin" {
|
||||
flavour = mkOption {
|
||||
type = str;
|
||||
default = cfg.style;
|
||||
# internal = true;
|
||||
};
|
||||
transparent_background = mkOption {
|
||||
type = bool;
|
||||
default = cfg.transparent;
|
||||
internal = true;
|
||||
};
|
||||
term_colors = mkEnableOption' "term_colors";
|
||||
integrations =
|
||||
{
|
||||
nvimtree = {
|
||||
enabled = mkEnableOption' "enabled";
|
||||
transparent_panel = mkOption {
|
||||
type = bool;
|
||||
default = cfg.transparent;
|
||||
};
|
||||
show_root = mkEnableOption' "show_root";
|
||||
};
|
||||
|
||||
navic = {
|
||||
enabled = mkEnableOption' "enabled";
|
||||
# lualine will set backgound to mantle
|
||||
custom_bg = mkOption {
|
||||
type = str;
|
||||
default = "NONE";
|
||||
};
|
||||
};
|
||||
}
|
||||
// genAttrs [
|
||||
"hop"
|
||||
"gitsigns"
|
||||
"telescope"
|
||||
"treesitter"
|
||||
"treesitter_context"
|
||||
"ts_rainbow"
|
||||
"fidget"
|
||||
"alpha"
|
||||
"leap"
|
||||
"markdown"
|
||||
"noice"
|
||||
"notify"
|
||||
"which_key"
|
||||
] (name: mkEnableOption' name);
|
||||
};
|
||||
};
|
||||
config =
|
||||
mkIf cfg.name
|
||||
== "catppuccin" {
|
||||
vim = {
|
||||
startPlugins = ["catppuccin"];
|
||||
luaConfigRC.theme = entryBefore ["pluginConfigs"] ''
|
||||
then "require('catppuccin').setup(${toLuaObject cfg.setupOpts})"
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
0
modules/plugins/theme/supported-themes/default.nix
Normal file
0
modules/plugins/theme/supported-themes/default.nix
Normal file
0
modules/plugins/theme/supported-themes/dracula.nix
Normal file
0
modules/plugins/theme/supported-themes/dracula.nix
Normal file
0
modules/plugins/theme/supported-themes/gruvbox.nix
Normal file
0
modules/plugins/theme/supported-themes/gruvbox.nix
Normal file
0
modules/plugins/theme/supported-themes/onedark.nix
Normal file
0
modules/plugins/theme/supported-themes/onedark.nix
Normal file
0
modules/plugins/theme/supported-themes/oxocarbon.nix
Normal file
0
modules/plugins/theme/supported-themes/oxocarbon.nix
Normal file
0
modules/plugins/theme/supported-themes/rose-pine.nix
Normal file
0
modules/plugins/theme/supported-themes/rose-pine.nix
Normal file
|
@ -4,33 +4,21 @@
|
|||
...
|
||||
}: let
|
||||
inherit (lib.options) mkOption;
|
||||
inherit (lib.attrsets) attrNames listToAttrs;
|
||||
inherit (lib.strings) hasPrefix;
|
||||
inherit (lib.attrsets) attrNames;
|
||||
inherit (lib.strings) elemAt;
|
||||
inherit (lib.types) bool lines enum;
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.dag) entryBefore;
|
||||
inherit (lib.nvim.types) hexColor;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
|
||||
cfg = config.vim.theme;
|
||||
supportedThemes = import ./supported-themes.nix {
|
||||
inherit lib config;
|
||||
};
|
||||
|
||||
numbers = ["0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "A" "B" "C" "D" "E" "F"];
|
||||
base16Options = listToAttrs (map (n: {
|
||||
name = "base0${n}";
|
||||
value = mkOption {
|
||||
description = "The base0${n} color to use";
|
||||
type = hexColor;
|
||||
apply = v:
|
||||
if hasPrefix "#" v
|
||||
then v
|
||||
else "#${v}";
|
||||
};
|
||||
})
|
||||
numbers);
|
||||
in {
|
||||
options.vim.theme = {
|
||||
inherit (supportedThemes.${cfg.name}) setupOpts;
|
||||
|
||||
enable = mkOption {
|
||||
type = bool;
|
||||
description = "Enable theming";
|
||||
|
@ -43,10 +31,9 @@ in {
|
|||
requires all of the colors in {option}`vim.theme.base16-colors` to be set.
|
||||
'';
|
||||
};
|
||||
base16-colors = base16Options;
|
||||
|
||||
style = mkOption {
|
||||
type = enum supportedThemes.${cfg.name}.styles;
|
||||
default = elemAt supportedThemes.${cfg.name}.styles 0;
|
||||
description = "Specific style for theme if it supports it";
|
||||
};
|
||||
transparent = mkOption {
|
||||
|
@ -62,11 +49,23 @@ in {
|
|||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
vim = let
|
||||
name' =
|
||||
if cfg.name == "base16"
|
||||
then "base16-colorscheme"
|
||||
else cfg.name;
|
||||
in {
|
||||
startPlugins = [cfg.name];
|
||||
luaConfigRC.theme = entryBefore ["pluginConfigs"] ''
|
||||
${cfg.extraConfig}
|
||||
${supportedThemes.${cfg.name}.setup {inherit (cfg) style transparent base16-colors;}}
|
||||
|
||||
${
|
||||
if name' != "oxocarbon"
|
||||
then "require('${name'}').setup(${toLuaObject cfg.setupOpts})"
|
||||
else ""
|
||||
}
|
||||
|
||||
${supportedThemes.${cfg.name}.setup}
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue