Closed zetashift closed 3 years ago
Never mind, I figured it out, I had to create my own plugin, I thought I could do it from my init.fnl!
@zetashift glad you worked out a solution and that the extension stuff works!
You should be able to pass your parsed spec (what lush(fn)
returns) to lush
again to apply it (that's all the default .vim
file does).
This looks something like
local lush = require('lush')
local spec = lush(function()
return {
Normal { bg = "red", fg = "yellow" }
}
end)
lush(spec)
So for you it's probably something like (just guessing from my limited play with fennel):
(module magic.plugin.gruvy
{autoload {lush lush
hsl lush.hsl}})
(local colors {
; ...
})
(local gruvy (require :lush_theme.gruvy))
(local spec ((. (lush.extends [gruvy]) :with) (fn []
[
; ...
])))
; send parsed spec to lush for compile -> apply
(lush spec)
You might get weird behaviour from vim if you're not calling colorscheme
explicitly, can't speak to any of those side effects. Probably fine?
The h lush-manual-toolchain
shows a bit more detail if you wanted more control for whatever reason:
(lush spec)
was one of the things I tried, but it didn't work, now it does! I was so sure I did it too haha. Maybe I did (apply lush spec)
or something else wrong, but now I would say my dotfiles are completely done!
Thank you, I really like the docs and this plugin :D
Wait actually it doesn't totally: this is currently what I see, comments and TSInclude
are wrongly colored using extends in my config. The same code works fine if it's a separate plugin:
Doing:
(vim.cmd "colorscheme gruvy")
makes my extends modifications not show up (so the standard gruvy
theme).
But (lush spec)
seems to mess things up for non treesitter files:
Here is my code: https://github.com/zetashift/.dotfiles/blob/main/.config/nvim/fnl/magic/plugin/gruvy.fnl
EDIT: might actually be an issue here: https://github.com/Olical/magic-kit/issues/2
Doing (vim.cmd "colorscheme gruvy") makes my extends modifications not show up (so the standard gruvy theme).
The extends syntax won't define a "new" colorscheme, to vim, since vim only knows about them by looking for colors/<name>.vim
, so your extensions don't get written "into" gruvy if that makes sense, you're constructing and applying it in-memory.
This is why you would see it working when you set via colorscheme my-gruvy-flat
.
I assume if you copy-paste your plugins/gruvy.fnl
into the end of init.fnl
, it probably works by making sure it's the last thing to run?
Or you can maybe just remove the (vim.ex.colorscheme gruvy)
line and rely on Lush to do the work when it hits your extension? The only issue I can think of with that might be anything that's watching for ColorScheme|ColorSchemePre|ColorSchemePost
au commands.
Lush doesn't do much in terms of application, when you call (lush spec)
it converts the lua table into viml and sends it off to vim to execute, not much space for things to go wrong, that race-ish issue you linked is probably a reasonable culprit.
Seems this might have been resolved upstream?
Seems this might have been resolved upstream?
My config changed heavily and I don't use lush no more, sadly, so I'm not sure if I can check.
However even if I don't use lush anymore, it was my first foray into theming anything in NeoVim and it made things significantly easier and was nice to use, it's perfect for a starter!
Hiya, I extended a theme: https://github.com/elianiva/gruvy.nvim and the process was easy and the docs were clear, thanks a lot!
I was wondering however how I would load my
spec
that I extended and specify it to thecolorscheme
, because currently I can only apply my extensions when:Lushify
'ing it manually.This is my code (it's in Fennel but I can always specify the Lua code):