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

Override example throws E5113: attempt to index local 'override' (a nil value) #340

Closed
craigmac opened this issue Jul 6, 2024 · 6 comments
Labels
bug Something isn't working documentation Improvements or additions to documentation

Comments

@craigmac
Copy link

craigmac commented Jul 6, 2024

Example in docs:

local override = require('github-theme').override

My code:

require("github-theme").setup({})

local palette = require("github-theme.palette").load("github_dark_default")

local override = require("github-theme").override
override.groups({
  all = {
    WinSeparator = { fg = palette.gray },
  },
})

vim.cmd.colorscheme("github_dark_default")
@tmillr
Copy link
Member

tmillr commented Jul 7, 2024

I think this is either outdated or a typo; it's supposed to be local override = require("github-theme.override"). But you're probably better off just putting the overrides directly into the setup call as shown here.

@craigmac
Copy link
Author

craigmac commented Jul 7, 2024

I've tried that as well, after checking the source, it also doesn't work.

@tmillr
Copy link
Member

tmillr commented Jul 7, 2024

Change palette.gray to palette.gray.base or palette.gray.bright.

@craigmac
Copy link
Author

craigmac commented Jul 8, 2024

Right, changed but that also didn't work :/

@craigmac craigmac closed this as not planned Won't fix, can't repro, duplicate, stale Jul 8, 2024
@tmillr
Copy link
Member

tmillr commented Jul 8, 2024

hmmmm the example doesn't work for me either, but using setup() it does:

local palette = require('github-theme.palette').load('github_dark_default')

require('github-theme').setup({
  groups = { all = { WinSeparator = { fg = palette.gray.base } } },
})

vim.cmd.colorscheme('github_dark_default')

Also make sure you are on the latest commit or release. You may also want to try removing the cache dir (or, run :GithubThemeCompile).

tmillr added a commit to tmillr/github-nvim-theme that referenced this issue Jul 16, 2024
tmillr added a commit to tmillr/github-nvim-theme that referenced this issue Jul 16, 2024
tmillr added a commit to tmillr/github-nvim-theme that referenced this issue Jul 16, 2024
tmillr added a commit to tmillr/github-nvim-theme that referenced this issue Jul 16, 2024
tmillr added a commit to tmillr/github-nvim-theme that referenced this issue Jul 16, 2024
- Hash entire config instead of just the table passed to `setup()`. This
  helps to ensure that a re-compile occurs when overrides are set
  outside of `setup()`.

- Loading/sourcing colorscheme now causes re-compilation if config or
  overrides have changed, even if `setup()` has been called before.

- Clear `vim.g.colors_name` before setting `vim.o.background` so that
  colorscheme is not reloaded recursively when setting
  `vim.o.background` (as opposed to using a variable to check for nested
  colorscheme load, which is what we were doing before).

- fix(compiler): always write hash to filesystem whenever a compilation
  occurs, incl when `require('github-theme').compile()` is called
  directly.

Related: projekt0n#262, projekt0n#340, projekt0n#341

Please enter the commit message for your changes. Lines starting
th '%' will be ignored, and an empty message aborts the commit.
tmillr added a commit to tmillr/github-nvim-theme that referenced this issue Jul 16, 2024
- Hash entire config instead of just the table passed to `setup()`. This
  helps to ensure that a recompilation occurs when overrides are set
  outside of `setup()`.

- Loading/sourcing colorscheme now causes recompilation if config or
  overrides have changed, even if `setup()` has been called before.

- Clear `vim.g.colors_name` before setting `vim.o.background` so that
  colorscheme is not reloaded recursively when setting
  `vim.o.background` (as opposed to using a variable to check for nested
  colorscheme load, which is what we were doing before).

- fix(compiler): always write hash to filesystem when a compilation
  occurs, incl. when `require('github-theme').compile()` is called
  directly.

Related: projekt0n#262, projekt0n#340, projekt0n#341

Please enter the commit message for your changes. Lines starting
th '%' will be ignored, and an empty message aborts the commit.
tmillr added a commit that referenced this issue Jul 16, 2024
- Hash entire config instead of just the table passed to `setup()`. This
  helps to ensure that a recompilation occurs when overrides are set
  outside of `setup()`.

- Loading/sourcing colorscheme now causes recompilation if config or
  overrides have changed, even if `setup()` has been called before.

- Clear `vim.g.colors_name` before setting `vim.o.background` so that
  colorscheme is not reloaded recursively when setting
  `vim.o.background` (as opposed to using a variable to check for nested
  colorscheme load, which is what we were doing before).

- fix(compiler): always write hash to filesystem when a compilation
  occurs, incl. when `require('github-theme').compile()` is called
  directly.

Related: #262, #340, #341
tmillr added a commit that referenced this issue Jul 16, 2024
@tmillr
Copy link
Member

tmillr commented Jul 16, 2024

This should be fixed now and the docs have been updated.

@tmillr tmillr closed this as completed Jul 16, 2024
@tmillr tmillr added bug Something isn't working documentation Improvements or additions to documentation labels Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants