[mini.pick] Colorscheme picker with preview #951
Replies: 7 comments 21 replies
-
Very nice! I think there were plans of including something like this in 'mini.extra'. Probably decided that it is fairly trivial to implement and left to the user. I'd also think about applying color scheme not only inside preview, but also after choosing. |
Beta Was this translation helpful? Give feedback.
-
Nice! I also use this idea. I did have to set the colorscheme like so: local on_stop = function()
vim.schedule(function() -- must use schedule, otherwise eyeliner stops displaying
vim.cmd.colorscheme(selected_colorscheme)
end)
end |
Beta Was this translation helpful? Give feedback.
-
it would be great if this could get integrated into |
Beta Was this translation helpful? Give feedback.
-
After several times going back and fourth, I think having relatively concise @pkazmier, as an original author of this, are you interested in PR? Some notes in advance:
|
Beta Was this translation helpful? Give feedback.
-
@echasnovski opinions? colorscheme.mp4 |
Beta Was this translation helpful? Give feedback.
-
I've done something similar with The interesting part is that the provided code saves and restores the colorscheme between neovim restarts. Hide---@param fallback? string
_G.get_colorscheme = function(fallback)
if not vim.g.COLORS_NAME then
-- Sync the colorscheme for the first call
vim.cmd.rshada()
end
if not vim.g.COLORS_NAME or vim.g.COLORS_NAME == '' then
return fallback or 'default'
end
return vim.g.COLORS_NAME
end
---@param colorscheme? string
_G.save_colorscheme = function(colorscheme)
colorscheme = colorscheme or vim.g.colors_name
if get_colorscheme() == colorscheme then
return
end
vim.g.COLORS_NAME = colorscheme
vim.cmd.wshada()
end |
Beta Was this translation helpful? Give feedback.
-
The colors scheme picker is now part of 'mini.extra'. Thanks @pkazmier for initial implementation in #1789! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I added a colorscheme picker to my configuration this morning and thought I'd share in case others were interested. If you preview a colorscheme, it will change your current colorscheme to the one you are previewing. If you cancel the picker, it will revert back to the colorscheme you had before you entered the picker.
Screen.Recording.2024-06-08.at.10.24.59.AM.mov
To track state of the original picker, I added the ability to have custom pre- and post-hooks for individual pickers:
With that in place, here is the definition of my colorscheme picker:
Beta Was this translation helpful? Give feedback.
All reactions