I want to reload my neovim
configuration files with just a couple of keystrokes instead of having to restart the app. I was able to do this when using an init.vim
with the following command:
nnoremap <leader>sv <cmd>source $MYVIMRC<CR>
$MYVIMRC
points correctly to my config entry point.
The problem is that I switched to using lua
, and now I can't do the same. I have read the docs and tried variants of the following without success:
util.nnoremap("<leader>sv", "<cmd>luafile $MYVIMRC<CR>")
Finally, I found a solution doing this:
function load(name)
local path = vim.fn.stdpath('config') .. '/lua/' .. name .. '.lua'
dofile(path)
end
load('plugins')
load('config/mapping')
load('lsp/init')
Which is buggy and feels wrong.
Is there any way to do this? I read the example in vimpeccable
, but I want to see the other available options since I would rather not install another plugin.
I know that plenary
includes a function to reload modules, but I don't understand how to use it. A complete example of that would be good too since I already use plenary
in my config.