diff --git a/docs/release-notes/rl-0.8.md b/docs/release-notes/rl-0.8.md index d2a1a098..74a94b9c 100644 --- a/docs/release-notes/rl-0.8.md +++ b/docs/release-notes/rl-0.8.md @@ -492,3 +492,10 @@ - Fix default [blink.cmp] sources "path" and "buffer" not working when `autocomplete.nvim-cmp.enable` was disabled and `autocomplete.nvim-cmp.sources` had not been modified. + +[Jules](https://github.com/jules-sommer): + +[nvim-highlight-colors]: https://github.com/brenoprata10/nvim-highlight-colors + +- Add [nvim-highlight-colors] plugin in `vim.ui.nvim-highlight-colors` with + `enable` and `setupOpts` diff --git a/modules/plugins/tabline/nvim-bufferline/config.nix b/modules/plugins/tabline/nvim-bufferline/config.nix index 965f81f0..250425d3 100644 --- a/modules/plugins/tabline/nvim-bufferline/config.nix +++ b/modules/plugins/tabline/nvim-bufferline/config.nix @@ -15,7 +15,7 @@ in { config = mkIf cfg.enable { vim = { startPlugins = [ - "nvim-bufferline-lua" + "bufferline-nvim" "bufdelete-nvim" ]; diff --git a/modules/plugins/tabline/nvim-bufferline/nvim-bufferline.nix b/modules/plugins/tabline/nvim-bufferline/nvim-bufferline.nix index ff255c6c..c7490eb6 100644 --- a/modules/plugins/tabline/nvim-bufferline/nvim-bufferline.nix +++ b/modules/plugins/tabline/nvim-bufferline/nvim-bufferline.nix @@ -3,7 +3,7 @@ lib, ... }: let - inherit (lib.options) mkOption mkEnableOption literalExpression; + inherit (lib.options) mkOption mkEnableOption literalExpression literalMD; inherit (lib.types) enum bool either nullOr str int listOf attrs; inherit (lib.generators) mkLuaInline; inherit (lib.nvim.binds) mkMappingOption; @@ -24,17 +24,28 @@ in { movePrevious = mkMappingOption "Move previous buffer" "bmp"; }; - setupOpts = mkPluginSetupOption "Bufferline-nvim" { + setupOpts = mkPluginSetupOption "bufferline-nvim" { highlights = mkOption { type = either attrs luaInline; default = if config.vim.theme.enable && config.vim.theme.name == "catppuccin" then - mkLuaInline - '' - require("catppuccin.groups.integrations.bufferline").get() + mkLuaInline '' + (function() + local integration = require("catppuccin.groups.integrations.bufferline") + return (integration.get_theme or integration.get)() + end)() '' else {}; + defaultText = literalMD '' + ```lua + (function() + local integration = require("catppuccin.groups.integrations.bufferline") + return (integration.get_theme or integration.get)() + end)() + ``` + if the active theme is Catppuccin, `{}` otherwise. + ''; description = '' Overrides the highlight groups of bufferline. @@ -59,10 +70,11 @@ in { themable = mkOption { type = bool; default = true; + example = false; description = '' Whether or not to allow highlight groups to be overridden. - While false, bufferline.nvim sets highlights as default. + While `false`, bufferline.nvim sets highlights as default. ''; }; diff --git a/modules/plugins/ui/default.nix b/modules/plugins/ui/default.nix index 50112650..d7d7592f 100644 --- a/modules/plugins/ui/default.nix +++ b/modules/plugins/ui/default.nix @@ -3,6 +3,7 @@ ./borders ./breadcrumbs ./colorful-menu-nvim + ./nvim-highlight-colors ./colorizer ./fastaction ./illuminate diff --git a/modules/plugins/ui/nvim-highlight-colors/config.nix b/modules/plugins/ui/nvim-highlight-colors/config.nix new file mode 100644 index 00000000..117c6922 --- /dev/null +++ b/modules/plugins/ui/nvim-highlight-colors/config.nix @@ -0,0 +1,28 @@ +{ + config, + lib, + ... +}: let + inherit (lib.modules) mkIf; + inherit (lib.nvim.dag) entryAnywhere; + inherit (lib.nvim.lua) toLuaObject; + + cfg = config.vim.ui.nvim-highlight-colors; +in { + config = mkIf cfg.enable { + vim = { + startPlugins = [ + "nvim-highlight-colors" + ]; + + # enable display of 24-bit RGB colors in neovim + # via the terminal. This is required for nvim-highlight-colors + # to display arbitrary RGB highlights. + options.termguicolors = true; + + pluginRC.nvim-highlight-colors = entryAnywhere '' + require('nvim-highlight-colors').setup(${toLuaObject cfg.setupOpts}) + ''; + }; + }; +} diff --git a/modules/plugins/ui/nvim-highlight-colors/default.nix b/modules/plugins/ui/nvim-highlight-colors/default.nix new file mode 100644 index 00000000..85e03a89 --- /dev/null +++ b/modules/plugins/ui/nvim-highlight-colors/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ./nvim-highlight-colors.nix + ./config.nix + ]; +} diff --git a/modules/plugins/ui/nvim-highlight-colors/nvim-highlight-colors.nix b/modules/plugins/ui/nvim-highlight-colors/nvim-highlight-colors.nix new file mode 100644 index 00000000..c5ccc854 --- /dev/null +++ b/modules/plugins/ui/nvim-highlight-colors/nvim-highlight-colors.nix @@ -0,0 +1,71 @@ +{lib, ...}: let + inherit (lib.options) mkOption mkEnableOption; + inherit (lib.types) attrsOf enum nullOr submodule bool str; + inherit (lib.modules) mkRenamedOptionModule; + inherit (lib.nvim.types) mkPluginSetupOption; + inherit (lib.nvim.config) mkBool; +in { + options.vim.ui.nvim-highlight-colors = { + enable = mkEnableOption "color highlighting [nvim-highlight-colors.lua]"; + + setupOpts = mkPluginSetupOption "nvim-highlight-colors" { + render = mkOption { + type = enum ["background" "foreground" "virtual"]; + default = "background"; + example = "virtual"; + description = '' + Style to render color highlighting with. + + ::: {.note} + Each render style works as follows: + - 'background' sets the background + highlight of the matched color string + to the RGB color it describes. + + - 'foreground' sets the foreground + highlight of the matched color string + to the RGB color it describes. + + - 'virtual' displays the matched color + with virtual text alongside the color + string in the buffer. Virtual text can + be configured to display the color in + various ways, i.e custom virtual symbol + (via `virtual_symbol`) positioning + relative to string, suffix/prefix, etc. + ::: + ''; + }; + + virtual_symbol_position = mkOption { + type = enum ["inline" "eol" "eow"]; + default = "inline"; + example = "eol"; + description = '' + Where to render the virtual symbol in + relation to the color string. + + ::: {.note} + Each render style works as follows: + - 'inline' render virtual text inline, + similar to the style of VSCode color + hinting. + + - 'eol' render virtual text at the end + of the line which the color string + occurs (last column). Recommended to + set `virtual_symbol_suffix` to an + empty string when used. + + - 'eow' render virtual text at the end + of the word where the color string + occurs. Recommended to set + `virtual_symbol_prefix` to a single + space for padding and the suffix to + an empty string for no padding. + ::: + ''; + }; + }; + }; +} diff --git a/npins/sources.json b/npins/sources.json index d8bc91a7..a33129d5 100644 --- a/npins/sources.json +++ b/npins/sources.json @@ -35,9 +35,9 @@ }, "branch": "main", "submodules": false, - "revision": "ff116a567346003d37e19d05aa514972b53b574e", - "url": "https://github.com/yetone/avante.nvim/archive/ff116a567346003d37e19d05aa514972b53b574e.tar.gz", - "hash": "1fipz3c5gdbjnih366h20ppg7q6x7xqj5jlnadsqm5z28vj3kfr1" + "revision": "bcbe0347d8b5542b8a3361af8506f6dcf5bca02e", + "url": "https://github.com/yetone/avante.nvim/archive/bcbe0347d8b5542b8a3361af8506f6dcf5bca02e.tar.gz", + "hash": "1h7v40i3a7471ss5115my3n62gr4ldicmdc6vr4aaahjbghrri4v" }, "base16": { "type": "Git", @@ -117,6 +117,22 @@ "url": "https://github.com/famiu/bufdelete.nvim/archive/f6bcea78afb3060b198125256f897040538bcb81.tar.gz", "hash": "0xfzk3zgnxbwnr55n3lglsb8nmhnchpiqz9d152xr6j8d9z0sdcn" }, + "bufferline-nvim": { + "type": "GitRelease", + "repository": { + "type": "GitHub", + "owner": "akinsho", + "repo": "bufferline.nvim" + }, + "pre_releases": false, + "version_upper_bound": null, + "release_prefix": null, + "submodules": false, + "version": "v4.9.1", + "revision": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3", + "url": "https://api.github.com/repos/akinsho/bufferline.nvim/tarball/v4.9.1", + "hash": "0m5363rpbjgvsnbhp9yrivbqj17lmrb5m57lpnq7dgxsmw3hrvk9" + }, "catppuccin": { "type": "Git", "repository": { @@ -1734,19 +1750,6 @@ "url": "https://github.com/code-biscuits/nvim-biscuits/archive/ff1d12c8b47cd28723da593b2cfa2e98391d439a.tar.gz", "hash": "18dvvg32nxrdp1ydbvxrzkdg7q214naq2bphs7y1s9zmjhyj25pm" }, - "nvim-bufferline-lua": { - "type": "Git", - "repository": { - "type": "GitHub", - "owner": "akinsho", - "repo": "nvim-bufferline.lua" - }, - "branch": "main", - "submodules": false, - "revision": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3", - "url": "https://github.com/akinsho/nvim-bufferline.lua/archive/655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3.tar.gz", - "hash": "0m5363rpbjgvsnbhp9yrivbqj17lmrb5m57lpnq7dgxsmw3hrvk9" - }, "nvim-cmp": { "type": "Git", "repository": { @@ -1838,6 +1841,19 @@ "url": "https://github.com/amrbashir/nvim-docs-view/archive/a5256fd30417f58804691df174bc76a8c8f8163a.tar.gz", "hash": "01jc102zzhn1vygjgqqbfbp0q0pjcccpy1113ssmg59p2ckzp1v0" }, + "nvim-highlight-colors": { + "type": "Git", + "repository": { + "type": "GitHub", + "owner": "brenoprata10", + "repo": "nvim-highlight-colors" + }, + "branch": "main", + "submodules": false, + "revision": "1ce0a09bfc28c7274e649d20927cea51e440b65c", + "url": "https://github.com/brenoprata10/nvim-highlight-colors/archive/1ce0a09bfc28c7274e649d20927cea51e440b65c.tar.gz", + "hash": "1wsscm2mycd7zalxv8paa3fk0qy46bbhq4yfr73sl71wvkdh6yjn" + }, "nvim-lightbulb": { "type": "Git", "repository": {