mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-01-17 15:49:07 +00:00
Compare commits
No commits in common. "a75da31d953187079b598fff0600d27f944844a6" and "b2f694c78e95a6689e62ad3784d569dee48bff51" have entirely different histories.
a75da31d95
...
b2f694c78e
7 changed files with 97 additions and 41 deletions
|
|
@ -204,8 +204,3 @@ everyone.
|
||||||
- Add LSP and Treesitter support for R under `vim.languages.R`.
|
- Add LSP and Treesitter support for R under `vim.languages.R`.
|
||||||
- Add Otter support under `vim.lsp.otter` and an assert to prevent conflict with
|
- Add Otter support under `vim.lsp.otter` and an assert to prevent conflict with
|
||||||
ccc
|
ccc
|
||||||
|
|
||||||
[Bloxx12](https://github.com/Bloxx12)
|
|
||||||
|
|
||||||
- Add support for [base16 theming](https://github.com/RRethy/base16-nvim) under
|
|
||||||
`vim.theme`
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,8 @@
|
||||||
{lib}: let
|
{lib}: let
|
||||||
inherit (lib) isStringLike showOption showFiles getFiles mergeOneOption mergeEqualOption mkOptionType;
|
inherit (lib) isStringLike showOption showFiles getFiles mergeOneOption mergeEqualOption mkOptionType;
|
||||||
inherit (lib.strings) isString;
|
|
||||||
inherit (lib.types) anything attrsOf;
|
inherit (lib.types) anything attrsOf;
|
||||||
inherit (lib.nvim.types) anythingConcatLists;
|
inherit (lib.nvim.types) anythingConcatLists;
|
||||||
inherit (builtins) typeOf isAttrs any head concatLists stringLength match;
|
inherit (builtins) typeOf isAttrs any head concatLists stringLength;
|
||||||
in {
|
in {
|
||||||
# HACK: Does this break anything in our case?
|
# HACK: Does this break anything in our case?
|
||||||
# A modified version of the nixpkgs anything type that concatenates lists
|
# A modified version of the nixpkgs anything type that concatenates lists
|
||||||
|
|
@ -59,11 +58,4 @@ in {
|
||||||
check = value: stringLength value < 2;
|
check = value: stringLength value < 2;
|
||||||
merge = mergeEqualOption;
|
merge = mergeEqualOption;
|
||||||
};
|
};
|
||||||
|
|
||||||
hexColor = mkOptionType {
|
|
||||||
name = "hex-color";
|
|
||||||
descriptionClass = "noun";
|
|
||||||
description = "RGB color in hex format";
|
|
||||||
check = v: isString v && (match "#?[0-9a-fA-F]{6}" v) != null;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
@ -6,10 +6,12 @@
|
||||||
typesDag = import ./dag.nix {inherit lib;};
|
typesDag = import ./dag.nix {inherit lib;};
|
||||||
typesPlugin = import ./plugins.nix {inherit inputs lib;};
|
typesPlugin = import ./plugins.nix {inherit inputs lib;};
|
||||||
typesLanguage = import ./languages.nix {inherit lib;};
|
typesLanguage = import ./languages.nix {inherit lib;};
|
||||||
typesTypes = import ./types.nix {inherit lib;};
|
typesCustom = import ./custom.nix {inherit lib;};
|
||||||
|
typesTheme = import ./theme.nix {inherit lib;};
|
||||||
in {
|
in {
|
||||||
inherit (typesDag) dagOf;
|
inherit (typesDag) dagOf;
|
||||||
inherit (typesPlugin) pluginsOpt extraPluginType mkPluginSetupOption luaInline pluginType borderType;
|
inherit (typesPlugin) pluginsOpt extraPluginType mkPluginSetupOption luaInline pluginType borderType;
|
||||||
inherit (typesLanguage) diagnostics mkGrammarOption;
|
inherit (typesLanguage) diagnostics mkGrammarOption;
|
||||||
inherit (typesTypes) anythingConcatLists char hexColor;
|
inherit (typesCustom) anythingConcatLists char;
|
||||||
|
inherit (typesTheme) hexColorType;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
14
lib/types/theme.nix
Normal file
14
lib/types/theme.nix
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
{lib}: let
|
||||||
|
inherit (lib.strings) isString;
|
||||||
|
inherit (lib.types) mkOptionType;
|
||||||
|
inherit (builtins) match;
|
||||||
|
# This was almost entirely taken from raf himself.
|
||||||
|
in {
|
||||||
|
hexColorType = mkOptionType {
|
||||||
|
name = "hex-color";
|
||||||
|
descriptionClass = "noun";
|
||||||
|
description = "RGB color in hex format";
|
||||||
|
# Check to determine wether the provided color is base16-valid
|
||||||
|
check = x: isString x && (match "#[0-9a-fA-F]{6}" x) != null;
|
||||||
|
};
|
||||||
|
}
|
||||||
69
modules/plugins/theme/base16-colors.nix
Normal file
69
modules/plugins/theme/base16-colors.nix
Normal file
|
|
@ -0,0 +1,69 @@
|
||||||
|
{lib}: let
|
||||||
|
inherit (lib.options) mkOption;
|
||||||
|
inherit (lib.nvim.types) hexColorType;
|
||||||
|
in {
|
||||||
|
base00 = mkOption {
|
||||||
|
type = hexColorType;
|
||||||
|
default = "#1e1e2e";
|
||||||
|
};
|
||||||
|
base01 = mkOption {
|
||||||
|
type = hexColorType;
|
||||||
|
default = "#181825";
|
||||||
|
};
|
||||||
|
base02 = mkOption {
|
||||||
|
type = hexColorType;
|
||||||
|
default = "#313244";
|
||||||
|
};
|
||||||
|
base03 = mkOption {
|
||||||
|
type = hexColorType;
|
||||||
|
default = "#45475a";
|
||||||
|
};
|
||||||
|
base04 = mkOption {
|
||||||
|
type = hexColorType;
|
||||||
|
default = "#585b70";
|
||||||
|
};
|
||||||
|
base05 = mkOption {
|
||||||
|
type = hexColorType;
|
||||||
|
default = "#cdd6f4";
|
||||||
|
};
|
||||||
|
base06 = mkOption {
|
||||||
|
type = hexColorType;
|
||||||
|
default = "#f5e0dc";
|
||||||
|
};
|
||||||
|
base07 = mkOption {
|
||||||
|
type = hexColorType;
|
||||||
|
default = "#b4befe";
|
||||||
|
};
|
||||||
|
base08 = mkOption {
|
||||||
|
type = hexColorType;
|
||||||
|
default = "#f38ba8";
|
||||||
|
};
|
||||||
|
base09 = mkOption {
|
||||||
|
type = hexColorType;
|
||||||
|
default = "#fab387";
|
||||||
|
};
|
||||||
|
base0A = mkOption {
|
||||||
|
type = hexColorType;
|
||||||
|
default = "#a6e3a1";
|
||||||
|
};
|
||||||
|
base0B = mkOption {
|
||||||
|
type = hexColorType;
|
||||||
|
default = "#94e2d5";
|
||||||
|
};
|
||||||
|
base0C = mkOption {
|
||||||
|
type = hexColorType;
|
||||||
|
default = "#a6e3a1";
|
||||||
|
};
|
||||||
|
base0D = mkOption {
|
||||||
|
type = hexColorType;
|
||||||
|
default = "#89b4fa";
|
||||||
|
};
|
||||||
|
base0E = mkOption {
|
||||||
|
type = hexColorType;
|
||||||
|
default = "#cba6f4";
|
||||||
|
};
|
||||||
|
base0F = mkOption {
|
||||||
|
type = hexColorType;
|
||||||
|
default = "#f2cdcd";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -5,11 +5,12 @@
|
||||||
inherit (lib.strings) optionalString;
|
inherit (lib.strings) optionalString;
|
||||||
inherit (lib.trivial) boolToString warnIf;
|
inherit (lib.trivial) boolToString warnIf;
|
||||||
inherit (lib.nvim.lua) toLuaObject;
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
cfg = config.vim.theme;
|
||||||
in {
|
in {
|
||||||
base16 = {
|
base16 = {
|
||||||
setup = {base16-colors, ...}: ''
|
setup = {base16-colors, ...}: ''
|
||||||
-- Base16 theme
|
-- Base-16 theme
|
||||||
require('base16-colorscheme').setup(${toLuaObject base16-colors})
|
require('base16-colorscheme').setup(${toLuaObject cfg.base16-colors})
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
onedark = {
|
onedark = {
|
||||||
|
|
|
||||||
|
|
@ -4,46 +4,29 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.options) mkOption;
|
inherit (lib.options) mkOption;
|
||||||
inherit (lib.attrsets) attrNames listToAttrs;
|
inherit (lib.attrsets) attrNames;
|
||||||
inherit (lib.strings) hasPrefix;
|
|
||||||
inherit (lib.types) bool lines enum;
|
inherit (lib.types) bool lines enum;
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.nvim.dag) entryBefore;
|
inherit (lib.nvim.dag) entryBefore;
|
||||||
inherit (lib.nvim.types) hexColor;
|
|
||||||
|
|
||||||
cfg = config.vim.theme;
|
cfg = config.vim.theme;
|
||||||
supportedThemes = import ./supported-themes.nix {
|
supportedThemes = import ./supported-themes.nix {
|
||||||
inherit lib config;
|
inherit lib config;
|
||||||
};
|
};
|
||||||
|
base16-colors = import ./base16-colors.nix {
|
||||||
numbers = ["0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "A" "B" "C" "D" "E" "F"];
|
inherit lib;
|
||||||
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 {
|
in {
|
||||||
options.vim.theme = {
|
options.vim.theme = {
|
||||||
enable = mkOption {
|
enable = mkOption {
|
||||||
type = bool;
|
type = bool;
|
||||||
description = "Enable theming";
|
description = "Enable theming";
|
||||||
};
|
};
|
||||||
|
inherit base16-colors;
|
||||||
name = mkOption {
|
name = mkOption {
|
||||||
type = enum (attrNames supportedThemes);
|
type = enum (attrNames supportedThemes);
|
||||||
description = ''
|
description = "Supported themes can be found in `supportedThemes.nix`";
|
||||||
Supported themes can be found in {file}`supportedThemes.nix`.
|
|
||||||
Setting the theme to "base16" enables base16 theming and
|
|
||||||
requires all of the colors in {option}`vim.theme.base16-colors` to be set.
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
base16-colors = base16Options;
|
|
||||||
|
|
||||||
style = mkOption {
|
style = mkOption {
|
||||||
type = enum supportedThemes.${cfg.name}.styles;
|
type = enum supportedThemes.${cfg.name}.styles;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue