From 9c9dd1d670a54bf0d7db9a00048ccae61eae84a5 Mon Sep 17 00:00:00 2001 From: Charlie Root Date: Sun, 29 Sep 2024 23:22:26 +0200 Subject: [PATCH 1/7] modules: add base16 Theming support --- flake.lock | 17 +++++ flake.nix | 5 ++ lib/types/default.nix | 2 + lib/types/theme.nix | 13 ++++ modules/plugins/theme/base16-colors.nix | 72 ++++++++++++++++++++++ modules/plugins/theme/supported-themes.nix | 11 ++++ modules/plugins/theme/theme.nix | 20 +++--- 7 files changed, 133 insertions(+), 7 deletions(-) create mode 100644 lib/types/theme.nix create mode 100644 modules/plugins/theme/base16-colors.nix diff --git a/flake.lock b/flake.lock index ecc02f27..5118312a 100644 --- a/flake.lock +++ b/flake.lock @@ -172,6 +172,22 @@ "type": "github" } }, + "plugin-base16-nvim": { + "flake": false, + "locked": { + "lastModified": 1716483968, + "narHash": "sha256-GRF/6AobXHamw8TZ3FjL7SI6ulcpwpcohsIuZeCSh2A=", + "owner": "rrethy", + "repo": "base16-nvim", + "rev": "6ac181b5733518040a33017dde654059cd771b7c", + "type": "github" + }, + "original": { + "owner": "rrethy", + "repo": "base16-nvim", + "type": "github" + } + }, "plugin-bufdelete-nvim": { "flake": false, "locked": { @@ -1802,6 +1818,7 @@ "nixpkgs": "nixpkgs", "nmd": "nmd", "plugin-alpha-nvim": "plugin-alpha-nvim", + "plugin-base16-nvim": "plugin-base16-nvim", "plugin-bufdelete-nvim": "plugin-bufdelete-nvim", "plugin-catppuccin": "plugin-catppuccin", "plugin-ccc": "plugin-ccc", diff --git a/flake.nix b/flake.nix index 987e3e59..cdb1cda7 100644 --- a/flake.nix +++ b/flake.nix @@ -349,6 +349,11 @@ }; # Themes + plugin-base16-nvim = { + url = "github:rrethy/base16-nvim"; + flake = false; + }; + plugin-tokyonight = { url = "github:folke/tokyonight.nvim"; flake = false; diff --git a/lib/types/default.nix b/lib/types/default.nix index 6751229c..d7ddd240 100644 --- a/lib/types/default.nix +++ b/lib/types/default.nix @@ -7,9 +7,11 @@ typesPlugin = import ./plugins.nix {inherit inputs lib;}; typesLanguage = import ./languages.nix {inherit lib;}; typesCustom = import ./custom.nix {inherit lib;}; + typesTheme = import ./theme.nix {inherit lib;}; in { inherit (typesDag) dagOf; inherit (typesPlugin) pluginsOpt extraPluginType mkPluginSetupOption luaInline pluginType borderType; inherit (typesLanguage) diagnostics mkGrammarOption; inherit (typesCustom) anythingConcatLists char; + inherit (typesTheme) hexColorType; } diff --git a/lib/types/theme.nix b/lib/types/theme.nix new file mode 100644 index 00000000..98c0f0fd --- /dev/null +++ b/lib/types/theme.nix @@ -0,0 +1,13 @@ +{lib}: let + inherit (lib.strings) isString hasPrefix; + inherit (lib.types) mkOptionType; + inherit (builtins) stringLength; + # This was almost entirely taken from raf himself. +in { + hexColorType = mkOptionType { + name = "hex-color"; + descriptionClass = "noun"; + description = "RGB color in hex format"; + check = x: isString x && hasPrefix "#" x && stringLength x == 7; + }; +} diff --git a/modules/plugins/theme/base16-colors.nix b/modules/plugins/theme/base16-colors.nix new file mode 100644 index 00000000..9e8de6f5 --- /dev/null +++ b/modules/plugins/theme/base16-colors.nix @@ -0,0 +1,72 @@ +{ + config, + 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"; + }; +} diff --git a/modules/plugins/theme/supported-themes.nix b/modules/plugins/theme/supported-themes.nix index 63335e41..81fb26eb 100644 --- a/modules/plugins/theme/supported-themes.nix +++ b/modules/plugins/theme/supported-themes.nix @@ -1,10 +1,19 @@ + { config, lib, }: let inherit (lib.strings) optionalString; inherit (lib.trivial) boolToString warnIf; + inherit (lib.nvim.lua) toLuaObject; + cfg = config.vim.theme; in { + base16-nvim = { + setup = {base16-colors, ...}: '' + -- Base-16 theme + require('base16-colorscheme').setup(${toLuaObject cfg.base16-colors}) + ''; + }; onedark = { setup = {style ? "dark", ...}: '' -- OneDark theme @@ -20,6 +29,7 @@ in { setup = { style ? "night", transparent, + ... }: '' require('tokyonight').setup { transparent = ${boolToString transparent}; @@ -42,6 +52,7 @@ in { setup = { style ? "mocha", transparent ? false, + ... }: '' -- Catppuccin theme require('catppuccin').setup { diff --git a/modules/plugins/theme/theme.nix b/modules/plugins/theme/theme.nix index 85f8430f..e5ff44c4 100644 --- a/modules/plugins/theme/theme.nix +++ b/modules/plugins/theme/theme.nix @@ -13,13 +13,16 @@ supportedThemes = import ./supported-themes.nix { inherit lib config; }; + base16-colors = import ./base16-colors.nix { + inherit lib config; + }; in { options.vim.theme = { enable = mkOption { type = bool; description = "Enable theming"; }; - + inherit base16-colors; name = mkOption { type = enum (attrNames supportedThemes); description = "Supported themes can be found in `supportedThemes.nix`"; @@ -29,7 +32,6 @@ in { type = enum supportedThemes.${cfg.name}.styles; description = "Specific style for theme if it supports it"; }; - transparent = mkOption { type = bool; default = false; @@ -44,11 +46,15 @@ in { config = mkIf cfg.enable { vim = { - startPlugins = [cfg.name]; - luaConfigRC.theme = entryBefore ["pluginConfigs"] '' - ${cfg.extraConfig} - ${supportedThemes.${cfg.name}.setup {inherit (cfg) style transparent;}} - ''; + startPlugins = [ + cfg.name + ]; + luaConfigRC = { + theme = entryBefore ["pluginConfigs"] '' + ${cfg.extraConfig} + ${supportedThemes.${cfg.name}.setup {inherit (cfg) style transparent base16-colors;}} + ''; + }; }; }; } From 42e122ac6ca0d2d6f49ce175381eb62ea1eaa2f9 Mon Sep 17 00:00:00 2001 From: Charlie Root Date: Sun, 29 Sep 2024 23:23:20 +0200 Subject: [PATCH 2/7] theme/theme.nix: fix formatting --- modules/plugins/theme/theme.nix | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/modules/plugins/theme/theme.nix b/modules/plugins/theme/theme.nix index e5ff44c4..9850521c 100644 --- a/modules/plugins/theme/theme.nix +++ b/modules/plugins/theme/theme.nix @@ -46,9 +46,7 @@ in { config = mkIf cfg.enable { vim = { - startPlugins = [ - cfg.name - ]; + startPlugins = [cfg.name]; luaConfigRC = { theme = entryBefore ["pluginConfigs"] '' ${cfg.extraConfig} From 77bd81b3c9cb7aa006780fc8a8f9c4fda576c2a0 Mon Sep 17 00:00:00 2001 From: Charlie Root Date: Sun, 29 Sep 2024 23:26:53 +0200 Subject: [PATCH 3/7] supported-themes.nix: formatting --- modules/plugins/theme/supported-themes.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/plugins/theme/supported-themes.nix b/modules/plugins/theme/supported-themes.nix index 81fb26eb..34becdfa 100644 --- a/modules/plugins/theme/supported-themes.nix +++ b/modules/plugins/theme/supported-themes.nix @@ -1,4 +1,3 @@ - { config, lib, From 3cba3ca30c167d484dbf85f25685ed6cf4f87014 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Mon, 30 Sep 2024 01:10:33 +0300 Subject: [PATCH 4/7] statusline/lualine: disable LSP indicator on neo-tree --- modules/plugins/statusline/lualine/lualine.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/plugins/statusline/lualine/lualine.nix b/modules/plugins/statusline/lualine/lualine.nix index 51357941..20b78af9 100644 --- a/modules/plugins/statusline/lualine/lualine.nix +++ b/modules/plugins/statusline/lualine/lualine.nix @@ -224,7 +224,7 @@ in { local buf_ft = vim.api.nvim_get_option_value('filetype', {}) -- List of buffer types to exclude - local excluded_buf_ft = {"toggleterm", "NvimTree", "TelescopePrompt"} + local excluded_buf_ft = {"toggleterm", "NvimTree", "neo-tree", "TelescopePrompt"} -- Check if the current buffer type is in the excluded list for _, excluded_type in ipairs(excluded_buf_ft) do From 7417c6e4f382f847f841db84c6cb26bcb82716de Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 1 Oct 2024 08:12:06 +0300 Subject: [PATCH 5/7] docs: fix missing documentation link in README --- .github/README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/README.md b/.github/README.md index 1c3e22c3..531d062b 100644 --- a/.github/README.md +++ b/.github/README.md @@ -124,10 +124,16 @@ The _recommended_ way of installing **nvf** is using either the NixOS or the Home-Manager module, though it is completely possible and no less supported to install **nvf** as a standalone package, or a flake output. -See the [**nvf** manual] for detailed and up-to-date installation guides, +See the rendered [nvf manual] for detailed and up-to-date installation guides, configurations, available options, release notes and more. Tips for installing userspace plugins is also contained in the documentation. +> [!TIP] +> While using NixOS or Home-Manager modules, +> `programs.nvf.enableManpages = true;` will allow you to view option +> documentation from the comfort of your terminal via `man 5 nvf`. The more you +> know. + Please create an issue on the [issue tracker] if you find the documentation lacking or confusing. Any improvements to the documentation through pull requests are also welcome, and appreciated. From 9ea9995b928087e60d4029c370707f998f575179 Mon Sep 17 00:00:00 2001 From: raf Date: Tue, 1 Oct 2024 05:18:29 +0000 Subject: [PATCH 6/7] statusline/lualine: update & add missing themes (#393) * statusline/lualine: update & add missing themes * docs: document lualine update --- docs/release-notes/rl-0.7.md | 4 ++++ flake.lock | 6 +++--- modules/plugins/statusline/lualine/lualine.nix | 7 +++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/docs/release-notes/rl-0.7.md b/docs/release-notes/rl-0.7.md index 55746f2b..817c8290 100644 --- a/docs/release-notes/rl-0.7.md +++ b/docs/release-notes/rl-0.7.md @@ -193,6 +193,10 @@ everyone. - Add [](#opt-vim.dashboard.dashboard-nvim.setupOpts) to allow user configuration for [dashboard.nvim](https://github.com/nvimdev/dashboard-nvim) +- Update `lualine.nvim` input and add missing themes: + - Adds `ayu`, `gruvbox_dark`, `iceberg`, `moonfly`, `onedark`, + `powerline_dark` and `solarized_light` themes. + [ppenguin](https://github.com/ppenguin): - Telescope: diff --git a/flake.lock b/flake.lock index ecc02f27..7775fb1f 100644 --- a/flake.lock +++ b/flake.lock @@ -799,11 +799,11 @@ "plugin-lualine": { "flake": false, "locked": { - "lastModified": 1712310396, - "narHash": "sha256-WcH2dWdRDgMkwBQhcgT+Z/ArMdm+VbRhmQftx4t2kNI=", + "lastModified": 1723473562, + "narHash": "sha256-gCm7m96PkZyrgjmt7Efc+NMZKStAq1zr7JRCYOgGDuE=", "owner": "hoob3rt", "repo": "lualine.nvim", - "rev": "0a5a66803c7407767b799067986b4dc3036e1983", + "rev": "b431d228b7bbcdaea818bdc3e25b8cdbe861f056", "type": "github" }, "original": { diff --git a/modules/plugins/statusline/lualine/lualine.nix b/modules/plugins/statusline/lualine/lualine.nix index 20b78af9..1f694eaf 100644 --- a/modules/plugins/statusline/lualine/lualine.nix +++ b/modules/plugins/statusline/lualine/lualine.nix @@ -17,29 +17,36 @@ "ayu_dark" "ayu_light" "ayu_mirage" + "ayu" "codedark" "dracula" "everforest" "gruvbox" + "gruvbox_dark" "gruvbox_light" "gruvbox_material" "horizon" "iceberg_dark" "iceberg_light" + "iceberg" "jellybeans" "material" "modus_vivendi" "molokai" + "moonfly" "nightfly" "nord" "oceanicnext" + "onedark" "onelight" "palenight" "papercolor_dark" "papercolor_light" + "powerline_dark" "powerline" "seoul256" "solarized_dark" + "solarized_light" "tomorrow" "wombat" ]; From 108cfd8383b0cfbdfd6266f88f307e80f9ef7ddc Mon Sep 17 00:00:00 2001 From: diniamo <55629891+diniamo@users.noreply.github.com> Date: Wed, 2 Oct 2024 18:21:45 +0200 Subject: [PATCH 7/7] themes/catppuccin: enable navic integration (#395) --- modules/plugins/theme/supported-themes.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/plugins/theme/supported-themes.nix b/modules/plugins/theme/supported-themes.nix index 63335e41..17208ea2 100644 --- a/modules/plugins/theme/supported-themes.nix +++ b/modules/plugins/theme/supported-themes.nix @@ -69,7 +69,7 @@ in { notify = true, -- nvim-notify which_key = true, navic = { - enabled = false, + enabled = true, custom_bg = "NONE", -- "lualine" will set background to mantle }, },