Skip to content
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

[BUG] Configured colorscheme is not used by default #2446

Open
1 task done
vendion opened this issue Oct 22, 2024 · 4 comments
Open
1 task done

[BUG] Configured colorscheme is not used by default #2446

vendion opened this issue Oct 22, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@vendion
Copy link

vendion commented Oct 22, 2024

Field Description
Plugin nord
Nixpkgs unstable
Home Manager unstable
  • I have read the FAQ and my bug is not listed there.

Description

Setting the default colorscheme to nord via colorschemes.nord.enable doesn't work, while the colorscheme gets installed and can be switched to by doing :colorscheme nord, the default Neovim colorscheme is used by default.

I have also tested with colorschemes.cyberdream.enable and got the same result.

Minimal, Reproducible Example (MRE)

{
  programs.nixvim = {
    enable = true;

    colorschemes.nord.enable = true;
  };
}
@vendion vendion added the bug Something isn't working label Oct 22, 2024
@Shyrogan
Copy link

Shyrogan commented Nov 15, 2024

As a temporary fix, you can use the following option

programs.nixvim = {
  extraConfigLuaPost = ''vim.cmd [[ colorscheme nord ]]'';
};

if you want

@MattSturgeon
Copy link
Member

MattSturgeon commented Nov 20, 2024

This should already be done by mkVimPlugin:

Perhaps the generated lua code is ending up in the wrong part of init.lua and is not having the desired effect 🤔

mkVimPlugin sets our colorscheme option:

nixvim/lib/vim-plugin.nix

Lines 115 to 117 in 929bb0c

(lib.optionalAttrs (isColorscheme && (colorscheme != null)) {
colorscheme = lib.mkDefault colorscheme;
})

Our colorscheme option adds the code to extraConfigVim:

extraConfigVim = ''
colorscheme ${config.colorscheme}
'';

Our content option sandwiches extraConfigVim between extraConfigLuaPre and extraConfigLua:

nixvim/modules/output.nix

Lines 113 to 121 in 929bb0c

if config.type == "lua" then
# Lua
helpers.concatNonEmptyLines [
config.extraConfigLuaPre
(helpers.wrapVimscriptForLua config.extraConfigVim)
config.extraConfigLua
config.extraConfigLuaPost
]
else

You can inspect the final generated lua yourself using nixvim-print-init.

@vendion
Copy link
Author

vendion commented Nov 24, 2024

Checking the output of nixvim-print-init I see that the first place colorscheme appears is like so

 143   vim.cmd([[let $BAT_THEME = 'nord'
 144
 145   colorscheme nord
 146   ]])

Which from the line numbers (143-146) happens early on, so is probably the one that is added automatically and thus the one not working. Then the very last line is just vim.cmd([[ colorscheme nord ]]) which I assume is the one I manually added with extraConfigLuaPost.

@Aliervo
Copy link

Aliervo commented Nov 26, 2024

This might actually be a regression in colorscheme. I just updated my system for the first time a while and I noticed my colors were off. I have been using:

programs.nixvim = {
  enable = true;

  colorscheme = "solarized-flat";
  extraPlugins = [ pkgs.vimPlugins.nvim-solarized-lua ];

  # Rest of config
};

I can check my flake.lock for a potential bisect if it helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants