-
-
Notifications
You must be signed in to change notification settings - Fork 158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
neovim: use mini.base16 for colorscheme #536
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From 6fe4ff7a686ae66a23c8040bb4384eccf801aa85 Mon Sep 17 00:00:00 2001 From: soulsoiledit <[email protected]> Date: Wed, 28 Aug 2024 18:18:16 -0500 Subject: [PATCH 1/2] nixvim: use mini.base16 for colorscheme mini.base16 provides better support for various neovim plugins
The commit message could be improved to:
nixvim: set colorscheme using mini.base16
Set the colorscheme using the mini.base16 plugin for better plugin integration.
Link: https://github.com/danth/stylix/pull/536
--- modules/nixvim/nixvim.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/nixvim/nixvim.nix b/modules/nixvim/nixvim.nix index dbc1da66..f6f20bf5 100644 --- a/modules/nixvim/nixvim.nix +++ b/modules/nixvim/nixvim.nix @@ -28,14 +28,14 @@ config = lib.mkIf (config.stylix.enable && config.stylix.targets.nixvim.enable && (config.programs ? nixvim)) ( lib.optionalAttrs (builtins.hasAttr "nixvim" options.programs) { programs.nixvim = { - colorschemes.base16 = { - colorscheme = { + plugins.mini = { + enable = true; + + modules.base16.palette = { inherit (config.lib.stylix.colors.withHashtag) base00 base01 base02 base03 base04 base05 base06 base07 base08 base09 base0A base0B base0C base0D base0E base0F; }; - - enable = true; }; highlight = let
Unless Nixvim refuses this patch, I would prefer this to be upstreamed to Nixvim, and then we simply update the Nixvim input.
This patch causes the following error without any additional inputs.stylix.inputs.<INPUTS>.follows
declarations:
Error detected while processing /home/<USER>/.config/nvim/init.lua:
E5113: Error while calling lua chunk: /home/<USER>/.config/nvim/init.lua:81: module 'mini.base16' not found:
no field package.preload['mini.base16']
no file '/nix/store/kf5k5qa53g9rrsch256vqgnr7al080al-luajit-2.1.1693350652-env/share/lua/5.1/mini/base16.lua'
no file '/nix/store/kf5k5qa53g9rrsch256vqgnr7al080al-luajit-2.1.1693350652-env/share/lua/5.1/mini/base16/init.lua'
no file '/nix/store/kf5k5qa53g9rrsch256vqgnr7al080al-luajit-2.1.1693350652-env/lib/lua/5.1/mini/base16.so'
no file '/nix/store/kf5k5qa53g9rrsch256vqgnr7al080al-luajit-2.1.1693350652-env/lib/lua/5.1/mini.so'
stack traceback:
[C]: in function 'require'
/home/<USER>/.config/nvim/init.lua:81: in main chunk
Maybe some Stylix inputs need to be updated.
From 1e8a1c103bd80c4bcfdbf649db84f71d47df6a53 Mon Sep 17 00:00:00 2001 From: soulsoiledit <[email protected]> Date: Wed, 28 Aug 2024 18:20:36 -0500 Subject: [PATCH 2/2] neovim: use mini.base16 for colorscheme mini.base16 provides better support for various neovim plugins
The commit message could be improved to:
neovim: replace base16-nvim with mini.base16
Replace the base16-nvim plugin with the mini.base16 plugin for better plugin
integration.
Closes: https://github.com/danth/stylix/issues/535
Link: https://github.com/danth/stylix/pull/536
--- modules/neovim/hm.nix | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/modules/neovim/hm.nix b/modules/neovim/hm.nix index 587c196e..e565ad1d 100644 --- a/modules/neovim/hm.nix +++ b/modules/neovim/hm.nix @@ -18,15 +18,17 @@ in { plugins = lib.singleton { - plugin = pkgs.vimPlugins.base16-nvim; + plugin = pkgs.vimPlugins.mini-nvim; type = "lua"; config = lib.mkMerge [ (with config.lib.stylix.colors.withHashtag; '' - require('base16-colorscheme').setup({ - base00 = '${base00}', base01 = '${base01}', base02 = '${base02}', base03 = '${base03}', - base04 = '${base04}', base05 = '${base05}', base06 = '${base06}', base07 = '${base07}', - base08 = '${base08}', base09 = '${base09}', base0A = '${base0A}', base0B = '${base0B}', - base0C = '${base0C}', base0D = '${base0D}', base0E = '${base0E}', base0F = '${base0F}' + require('mini.base16').setup({ + palette = { + base00 = '${base00}', base01 = '${base01}', base02 = '${base02}', base03 = '${base03}', + base04 = '${base04}', base05 = '${base05}', base06 = '${base06}', base07 = '${base07}', + base08 = '${base08}', base09 = '${base09}', base0A = '${base0A}', base0B = '${base0B}', + base0C = '${base0C}', base0D = '${base0D}', base0E = '${base0E}', base0F = '${base0F}' + } }) '') (lib.mkIf cfg.transparentBackground.main ''
I have not tested this patch yet.
We could add options to enable specific color scheme setters. @soulsoiledit, can you elaborate on how the algorithms of |
In this context, the algorithms don't differ at all. The algorithm described in mini-base16 only applies when you want to provide a subset of colors, ie only background, foreground, and accent. In that case, it generates a suitable palette based on those colors. Since we are providing the full palette, mini.base16 calls this function (https://github.com/echasnovski/mini.base16/blob/95db7f0ea89fbc60b321dbe23d39c1502a07a20e/lua/mini/base16.lua#L446) instead, which does the same thing as base16-nvim, grabbing colors directly from the palette given. I'm fine with keeping base16-nvim as the default. |
In that case, why do the colors look different:
Is it because some plugins are explicitly themed by
If the premise of |
mini assigns that highlight group, builtin variables such as (this, self, etc), as part of "special symbols" within a language, while base16-nvim assigns them the same as other variables. |
The visible change is probably caused by |
Replace the base16-nvim plugin with the mini.base16 plugin for better plugin integration Link: danth#536
Replace the base16-nvim plugin with the mini.base16 plugin for better plugin integration Link: danth#536
Add an option to select whether to use 'mini.base16' or 'base16-nvim'. Link: danth#536
1e8a1c1
to
9305cc7
Compare
Add an option to select whether to use 'mini.base16' or 'base16-nvim'. Link: danth#536
9305cc7
to
8b6d334
Compare
I'm not sure what's going on here. I checked the pinned version of nixpkgs in stylix, and the mini.nvim version there does seem to have mini.base16 included.
I have added this option under |
Add the stylix.targets.neovim.colorscheme option to select between the previous base16-nvim and the new default mini.base16 [1] plugin, offering better plugin integration. [1]: https://github.com/echasnovski/mini.base16 Link: danth#536 Co-authored-by: NAHO <[email protected]>
Add the stylix.targets.nixvim.colorscheme option to select between the previous base16-nvim and the new default mini.base16 [1] plugin, offering better plugin integration. [1]: https://github.com/echasnovski/mini.base16 Link: danth#536 Co-authored-by: NAHO <[email protected]>
There is probably something wrong with my setup. I will try to test this tomorrow.
I performed the following changes to this PR:
|
Add the stylix.targets.nixvim.colorscheme option to select between the previous base16-nvim and the new default mini.base16 [1] plugin, offering better plugin integration. [1]: https://github.com/echasnovski/mini.base16 Link: danth#536 Co-authored-by: NAHO <[email protected]> Tested-by: NAHO <[email protected]>
I added my |
Ideally the color usage should be as close to the upstream style guide as possible. Our own style guide currently just refers to that link when it comes to text editors. Unfortunately, the guide isn't very specific in some cases, such as the example with From the screenshots above, I personally prefer this new plugin since it differentiates between variables and boolean values in Nix, although that's just one of I assume many differences. According to the upstream guide, nether of these are totally correct - variables should be red and booleans should be yellow (unless @donovanglover's chosen scheme has non-standard colors). |
Until the style guide has been expanded 1, it won't hurt to provide a new colorscheme plugin. Once the VIM highlight groups are implemented in Stylix 1, we can replace both colorscheme plugins with the VIM highlight groups. |
Add the stylix.targets.neovim.colorscheme option to select between the previous base16-nvim and the new default mini.base16 [1] plugin, offering better plugin integration. [1]: https://github.com/echasnovski/mini.base16 Link: danth#536 Co-authored-by: NAHO <[email protected]>
Add the stylix.targets.nixvim.colorscheme option to select between the previous base16-nvim and the new default mini.base16 [1] plugin, offering better plugin integration. [1]: https://github.com/echasnovski/mini.base16 Link: danth#536 Co-authored-by: NAHO <[email protected]> Tested-by: NAHO <[email protected]>
7317f8b
to
4781c59
Compare
Add the stylix.targets.neovim.colorscheme option to select between the previous base16-nvim and the new default mini.base16 [1] plugin, offering better plugin integration. [1]: https://github.com/echasnovski/mini.base16 Link: danth#536 Co-authored-by: NAHO <[email protected]>
Add the stylix.targets.nixvim.colorscheme option to select between the previous base16-nvim and the new default mini.base16 [1] plugin, offering better plugin integration. [1]: https://github.com/echasnovski/mini.base16 Link: danth#536 Co-authored-by: NAHO <[email protected]> Tested-by: NAHO <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than my comment below, this looks good to go :))
Add the stylix.targets.neovim.colorscheme option to select between the previous base16-nvim and the new default mini.base16 [1] plugin, offering better plugin integration. [1]: https://github.com/echasnovski/mini.base16 Link: danth#536 Co-authored-by: NAHO <[email protected]>
Add the stylix.targets.nixvim.colorscheme option to select between the previous base16-nvim and the new default mini.base16 [1] plugin, offering better plugin integration. [1]: https://github.com/echasnovski/mini.base16 Link: danth#536 Co-authored-by: NAHO <[email protected]> Tested-by: NAHO <[email protected]>
f9ddc55
to
a1aba5e
Compare
Add the stylix.targets.neovim.plugin option to select between the previous base16-nvim and the new default mini.base16 [1] plugin, offering better plugin integration. [1]: https://github.com/echasnovski/mini.base16 Link: danth#536 Co-authored-by: NAHO <[email protected]>
Add the stylix.targets.nixvim.plugin option to select between the previous base16-nvim and the new default mini.base16 [1] plugin, offering better plugin integration. [1]: https://github.com/echasnovski/mini.base16 Link: danth#536 Co-authored-by: NAHO <[email protected]> Tested-by: NAHO <[email protected]>
a1aba5e
to
f736ff6
Compare
Add the stylix.targets.neovim.plugin option to select between the previous base16-nvim and the new default mini.base16 [1] plugin, offering better plugin integration. [1]: https://github.com/echasnovski/mini.base16 Link: danth#536 Co-authored-by: NAHO <[email protected]>
Add the stylix.targets.nixvim.plugin option to select between the previous base16-nvim and the new default mini.base16 [1] plugin, offering better plugin integration. [1]: https://github.com/echasnovski/mini.base16 Link: danth#536 Co-authored-by: NAHO <[email protected]> Tested-by: NAHO <[email protected]>
f736ff6
to
03fcddb
Compare
Add the stylix.targets.neovim.plugin option to select between the previous base16-nvim and the new default mini.base16 [1] plugin, offering better plugin integration. [1]: https://github.com/echasnovski/mini.base16 Link: danth#536 Co-authored-by: NAHO <[email protected]>
Add the stylix.targets.nixvim.plugin option to select between the previous base16-nvim and the new default mini.base16 [1] plugin, offering better plugin integration. [1]: https://github.com/echasnovski/mini.base16 Link: danth#536 Co-authored-by: NAHO <[email protected]> Tested-by: NAHO <[email protected]>
03fcddb
to
7941a3c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reviewed both commits and re-tested the Nixvim patch.
@danth, can you do a merge commit for this PR? AFAIK, I only have permission to do squash commits via the GitHub UI. |
Add the stylix.targets.neovim.plugin option to select between the previous base16-nvim and the new default mini.base16 [1] plugin, offering better plugin integration. [1]: https://github.com/echasnovski/mini.base16 Link: danth#536 Co-authored-by: NAHO <[email protected]>
Add the stylix.targets.nixvim.plugin option to select between the previous base16-nvim and the new default mini.base16 [1] plugin, offering better plugin integration. [1]: https://github.com/echasnovski/mini.base16 Link: danth#536 Co-authored-by: NAHO <[email protected]> Tested-by: NAHO <[email protected]>
7941a3c
to
17f6d6e
Compare
@trueNAHO done :) |
Add the stylix.targets.neovim.plugin option to select between the previous base16-nvim and the new default mini.base16 [1] plugin, offering better plugin integration. [1]: https://github.com/echasnovski/mini.base16 Link: danth#536 Co-authored-by: NAHO <[email protected]>
Add the stylix.targets.nixvim.plugin option to select between the previous base16-nvim and the new default mini.base16 [1] plugin, offering better plugin integration. [1]: https://github.com/echasnovski/mini.base16 Link: danth#536 Co-authored-by: NAHO <[email protected]> Tested-by: NAHO <[email protected]>
Add the stylix.targets.neovim.plugin option to select between the previous base16-nvim and the new default mini.base16 [1] plugin, offering better plugin integration. [1]: https://github.com/echasnovski/mini.base16 Link: danth#536 Co-authored-by: NAHO <[email protected]>
Add the stylix.targets.nixvim.plugin option to select between the previous base16-nvim and the new default mini.base16 [1] plugin, offering better plugin integration. [1]: https://github.com/echasnovski/mini.base16 Link: danth#536 Co-authored-by: NAHO <[email protected]> Tested-by: NAHO <[email protected]>
Add the stylix.targets.neovim.plugin option to select between the previous base16-nvim and the new default mini.base16 [1] plugin, offering better plugin integration. [1]: https://github.com/echasnovski/mini.base16 Link: danth#536 Co-authored-by: NAHO <[email protected]>
Add the stylix.targets.nixvim.plugin option to select between the previous base16-nvim and the new default mini.base16 [1] plugin, offering better plugin integration. [1]: https://github.com/echasnovski/mini.base16 Link: danth#536 Co-authored-by: NAHO <[email protected]> Tested-by: NAHO <[email protected]>
Switches both the neovim and nixvim modules to use mini.base16.
Closes #535