How to insert lua code into a plugin's setupOpts #797
-
I'm trying to pass a lua function into a plugin's (
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
lua code has to be wrapped with on_attach = lib.generators.mkLuaInline ''
function()
....
end
'' |
Beta Was this translation helpful? Give feedback.
-
I don't get it. Something like this: {
programs.nvf = {
enable = true;
settings = {
vim = {
filetree.nvimTree.on_attach = lib.generators.mkLuaInline ''
return { It gives the error that |
Beta Was this translation helpful? Give feedback.
-
Sorry for the cut-off. Here is my code file again: return {
{
"catppuccin/nvim",
name = "catppuccin",
priority = 1000, -- Ensure it loads early to apply the colorscheme properly
config = function()
require("catppuccin").setup({
flavour = "auto", -- Set the flavor to latte
background = { -- Optional: Match Vim's background setting
light = "latte",
dark = "mocha",
},
transparent_background = true, -- Optional: Set to true if you prefer no background color
integrations = { -- Optional: Enable integrations with AstroNvim plugins
cmp = true,
gitsigns = true,
nvimtree = true,
treesitter = true,
telescope = true,
},
})
-- Apply the colorscheme after setup
vim.cmd.colorscheme("catppuccin")
end,
},
{
"f-person/auto-dark-mode.nvim",
config = function()
require("auto-dark-mode").setup({
update_interval = 1000, -- Check every second
set_dark_mode = function()
vim.api.nvim_set_option("background", "dark")
vim.api.nvim_set_hl(0, "MsgArea", { fg = "#03ff13" })
end,
set_light_mode = function()
vim.api.nvim_set_option("background", "light")
vim.api.nvim_set_hl(0, "MsgArea", { fg = "green" })
end,
})
require("auto-dark-mode").init()
end,
},
} This code file was previously in Furthermore, I don't understand how to translate this script with the information you gave me. Like, how can I call Can you please help me? |
Beta Was this translation helpful? Give feedback.
lua code has to be wrapped with
lib.generators.mkLuaInline