I just installed Neovim and created a simple init.vim file (located at HOME/.config/nvim/init.vim), and when I do :source %
the script works, but when I exit and reopen Neovim, the file doesn't get loaded and I get the normal Neovim without the configurations I added to the file... How can I let Neovim load init.vim?
-
When asking questions, always include the relevant information. In this case, your system, nvim version, etc. Do not make guess what your environment is. You get a better chance of being answered. – jdhao Dec 27 '21 at 04:59
-
The path `~/.config/nvim/init.vim` working for me without sourcing, I guess more information need to provide. – link89 Apr 14 '22 at 14:18
3 Answers
Try to run Neovim with -V
option, which will dump the startup log to the given file:
nvim -V /tmp/nvim.log
Then open the created log file and carefully read the lines. It's hard to say what could be wrong there, but you may see which configuration files were loaded and, perhaps, the warnings when reading some files.
For example, my log file contains the following line:
continuing in /home/jubnzv/.config/nvim/init.vim
Which mean that init.vim
was loaded.
Try to find the similar line in your log. If you don't see it, please check the filepath and permissions for the configuration file.

- 1,526
- 2
- 8
- 20
-
the first lines seem to indicate the problem: ```could not source "$VIM\sysinit.vim" could not source "C:\Users\filip\AppData\Local\nvim\init.vim" sourcing "C:\tools\neovim\Neovim\share\nvim\runtime\filetype.vim" not found in runtime path: "ftdetect/*.vim" not found in runtime path: "ftdetect/*.lua" ``` but still, i don't know how to fix this.... – dumb_ptr Dec 26 '21 at 13:30
-
What is the absolute path to your configuration file? You should put it in `C:\Users\filip\AppData\Local\nvim\init.vim`. – jubnzv Dec 26 '21 at 13:40
-
it's C:\Users\filip\.config\nvim\init.vim.... i guess i'll move it to `C:\Users\filip\AppData\Local\nvim\init.vim` – dumb_ptr Dec 26 '21 at 13:47
-
If you are on Linux based OS then init.vim or init.lua file should be under $HOME/.config/NVIM/init.vim
In windows OS it should be under
C:\Users\filip\AppData\Local\nvim\init.vim
:source %
Works because it forces NVIM to source file opened in current buffer.

- 23
- 5
In MacOS I found the following error after running nvim -V /tmp/nvim.log
(as in @jubnzv's answer):
E5422: Conflicting configs: "/Users/lernerzhang/.config/nvim/init.lua" "/Users/lernerzhang/.config/nvim/init.vim"
Then I kept the init.vim and deleted init.lua, and moved the content of init.lua file to ~/.config/nvim/lua/config.lua
and sourced the config.lua file in init.vim by adding this line into it:
lua require('config')

- 6,184
- 2
- 49
- 66