You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey, how could I save the current theme set by toggling between sessions? I'm really new to the Neovim lua scripting and tried to solve this with the script below, without success:
-- -- Colorscheme configurationslocalget_onedark_style=function()
ifONEDARK_STYLE==nilthenONEDARK_STYLE='dark'endifONEDARK_STYLE=='dark' thenvim.o.background='dark'endifONEDARK_STYLE=='light' thenvim.o.background='light'endreturnONEDARK_STYLEendlocalonedark_options= {
style=get_onedark_style(),
-- toggle theme style ---toggle_style_key='<leader>ts', -- keybind to toggle theme style. Leave it nil to disable it, or set it to a string, for example "<leader>ts"toggle_style_list= {'light', 'dark'}, -- List of styles to toggle between. The possible styles are {'dark', 'darker', 'cool', 'deep', 'warm', 'warmer', 'light'}
}
require('onedark').setup(onedark_options)
require('onedark').load()
localsave_onedark_style=function()
print(ONEDARK_STYLE)
ifONEDARK_STYLE=='light' thenvim.o.background='dark'ONEDARK_STYLE='dark'elseifONEDARK_STYLE=='dark' thenvim.o.background='light'ONEDARK_STYLE='light'endvim.cmd('wsh!')
endvim.api.nvim_create_autocmd('ColorScheme', {
pattern= {'*'},
callback=save_onedark_style,
})
The text was updated successfully, but these errors were encountered:
Hey, how could I save the current theme set by toggling between sessions? I'm really new to the Neovim lua scripting and tried to solve this with the script below, without success:
The text was updated successfully, but these errors were encountered: