0

I want to dynamically load the local plugins when using Neovim.

For example, there are some directories ~/plugin1 and ~/plugin2 (they're colorscheme plugins).

When using Neovim, I try to add ~/plugin1 and ~/plugin1/colors to runtimepath, but it's not working:

vim.opt.runtimepath:append('~/plugin1')
vim.opt.runtimepath:append('~/plugin1/colors')

The error message says color xxx is not found.

Then I check vim.api.nvim_get_runtime_lists(), and it shows the plugin1 folder is not one of the runtimepath returned.

How could I dynamically add a folder to runtimepath???

2
  • I can't say for Lua, but typically set runtimepath^= or set runtimepath+= is sufficient. The error message: does it come from the colorscheme command? You might want to check whether or not you need to expand ~ when using vim.opt.runtimepath:append in Lua.
    – D. Ben Knoble
    Mar 13 at 17:26
  • The error is colorscheme xxx not found, but thanks for your suggest that expand ~, I will check it.
    – linrongbin
    Mar 14 at 7:40

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.