On a VoidLinux system my init.lua (or init.vim) are not being read.

nvim foo # init.lua not read
nvim -u ~/.config/nvim/init.lua foo # init.lua is read fine

The files are in the correct place:

❯ tree ~/.config/nvim
├── init.lua

Using strace I have verified that the NeoVim binary is not even attempting to open the init.lua file, even though it stats the file and determines that init.lua exists and init.vim does not (ENOENT)

$ strace -f nvim -c ':quit' 2>&1 | grep '/init\.'

[pid  2179] readv(25, [{iov_base="e/erwin/.config/nvim/init.vim\241c\34"..., iov_len=35}, {iov_base="\n\316c|#f,\203\241f\304!/home/erwin/.config/"..., iov_len=1024}], 2) = 407
[pid  2179] statx(AT_FDCWD, ".config/nvim/init.lua", AT_STATX_SYNC_AS_STAT, STATX_ALL, {stx_mask=STATX_ALL|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFREG|0644, stx_size=135, ...}) = 0
[pid  2179] statx(AT_FDCWD, ".config/nvim/init.vim", AT_STATX_SYNC_AS_STAT, STATX_ALL, 0x7ffde8f874c0) = -1 ENOENT (No such file or directory)
[pid  2179] readv(25, [{iov_base="e/erwin/.config/nvim/init.vim\241c\34"..., iov_len=35}, {iov_base="\n\316c|#f,\203\241f\304!/home/erwin/.config/"..., iov_len=1024}], 2) = 407
[pid  2179] write(26, "home/erwin/.config/nvim/init.vim"..., 410) = 410

None of the $XDG_* variables are set in a way that would change the location of ~/.config

1 Answer 1





I tried this on another box (with my same dotfiles) and I got the same result.

I use the PowerLevel10K Zsh prompt theme, which looks great, but adds a TON (288 right now) extra environment variables, making it difficult to see what else may be happening with the environment.

So I used env to start nvim with an empty environment:

env --ignore-environment nvim

With an empty environment, init.lua was sourced automatically.

It turns out I was using $VIMINIT to set some basic defaults for vi and vim and neovim was reading $VIMINIT instead of the init.lua file.

I just needed to unset VIMINIT and neovim sources init.lua as expected.

According to NeoVim's starting.txt, it looks like $EXINIT or $MYVIMRC could also trigger this.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.