Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to source init.lua without restarting neovim

Tags:

config

lua

neovim

Is there a clean way to reload a neovim init.lua config and all its modules (using the require() function) without restarting neovim?

I've read on another post that :luafile $MYVIMRC was supposed to accomplish just that but it doesn't reload those cached files unfortunately. I'm hoping to setup a keymap like I used to have in my previous init.vim config. Something along the lines of:

local opts = { noremap = true, silent = true }

vim.api.nvim_set_keymap("n", "<leader><CR>", ":luafile $MYVIMRC<CR>", opts)

I'm on nvim v0.8.0.

like image 477
mduboule Avatar asked Sep 06 '25 03:09

mduboule


1 Answers

Try to run this command :

:luafile %
like image 105
Cyrius Avatar answered Sep 07 '25 19:09

Cyrius