Reputation: 13
I want to set a specific config for a plugin if a certain colorscheme is applied at startup.
If vim.cmd("colorscheme") == "oxocarbon" then
print("this is oxocarbon")
else
print("this isn't oxocarbon")
end
Everytime I open neovim the theme oxocarbon loads, but the return is "this isn't oxocarbon".
require('lazy').setup({
{ import = "plugins.core" } -- oxocarbon get installed and loaded
})
require("macros") -- the if statement
After VimEnter
, when I type the command :lua vim.cmd("colorscheme")
(or simply :colorscheme
), it returns "oxocarbon" (Which is the configured theme loaded during VimEnter
)
Upvotes: 1
Views: 291
Reputation: 11820
Just to give you one idea, here it is how I set my colors:
local colorscheme = "tokyonight"
-- vim.notify("Selected colorscheme: " .. colorscheme) -- Debugging message
-- local colorscheme = "tokyonight"
local status_ok, _ = pcall(vim.cmd, "colorscheme " .. colorscheme)
if not status_ok then
vim.notify("colorscheme " .. colorscheme .. " not found!")
return
end
Upvotes: 0