Does extraConfigLua
override configuration set by plugins?
#2830
-
Hello guys! Hope you're doing well. I'm migrating my neovim config to nixvim. Given I have a lot of plugins, to quickly get it up and running I'm doing the following for most of the plugins:
{
plugins.leap = { enable = true; };
extraConfigLua = # lua
''
local leap = require("leap")
local opts = {
safe_labels = {}, -- disable auto-jumping to the first match; doesn't work on one unique target
max_phase_one_targets = 0, -- first char won't show possible matches
equivalence_classes = { " \t\r\n", "([{", ")]}", "'\"`" },
}
leap.setup(opts)
-- Bidirectional search
vim.keymap.set({ "n", "x", "o" }, "s", "<Plug>(leap)")
vim.api.nvim_set_hl(0, "LeapLabel", { fg = "#000000", bg = "#CCFF88", bold = true })
'';
} I don't use any options provided by leap/default.nix. What are the side effects or problems generally? I know leap/default.nix sets some defaults. I understand that when I use Will my Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi ! The approach that Nixvim takes consists in letting you explicitly decide what goes in your config.
If you do not explicitly set options, nixvim will not do anything more. Anyway, as
extraPlugins = [ pkgs.vimPlugins.leap-nvim ];
extraConfigLua = ''
...
''; |
Beta Was this translation helpful? Give feedback.
-
Thank you so much! Your answer is perfect: it addressed my question and the solution is exactly what I need! At this stage I just want nixvim to manage installing the plugins; I didn't want to check the plugin definition one by one (also before I get familiar with nix in general). It's good I asked before converting all my config. Thank you again and have a good day! |
Beta Was this translation helpful? Give feedback.
Hi !
Welcome abroad :)
The approach that Nixvim takes consists in letting you explicitly decide what goes in your config.
This means that, apart from specific exceptions,
plugins.foo.enable = true
will onlyextraPlugins
)require('foo').setup({})
If you do not explicitly set options, nixvim will not do anything more.
Then, you can pass any configuration option to the
plugins.foo.settings
attrs.In the case of
leap
, as we have a proper module for it, I would encourage you to use it. However, not that it still uses our legacy implementation and does not provide the new flexiblesettings
pattern.Here is the documentation for it: …