Neovim -条件配色方案

20jt8wwn  于 5个月前  发布在  其他
关注(0)|答案(1)|浏览(71)

目标

我想设置一个特定的插件配置,如果某个配色方案是在启动时应用。

我所尝试的

If vim.cmd("colorscheme") == "oxocarbon" then
    print("this is oxocarbon")
else
    print("this isn't oxocarbon")
end

字符串

问题

每次我打开neovim主题oxocarbon加载,但返回的是“这不是oxocarbon”。

最小配置- init.lua

require('lazy').setup({
{ import = "plugins.core" } -- oxocarbon get installed and loaded
})
require("macros") -- the if statement

备注

VimEnter之后,当我键入命令:lua vim.cmd("colorscheme")(或简称:colorscheme)时,它返回“oxocarbon”(这是在VimEnter期间加载的配置主题)

bxpogfeg

bxpogfeg1#

只是给你给予一个想法,这是我如何设置我的颜色:

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

字符串

相关问题