6

I just download Neovim & I'm trying to configure it following a tutorial, but I can't find the path $XDG_CONFIG_HOME/nvim/init.vim or ~/AppData/Local/nvim/init.vim. I don't know if a have to enter from CMD or from windows powershell. I've doing research but nothing is clear enough, although I'm lacking some knowledge.

I used chocolatey to install, and the folders I have look like this:

  • C:\tools\neovim\Neovim
    • inside of this there are 3 folders, bin, lib & share
  • C:\Users\nameUser\AppData\Local\nvim-data
    • 1 folder shada & a log file

Inside of local there isn't a nvim folder; it's not hidden or something, I checked.

:echoerr "init.vim is loaded" shows init.vim is loaded

3
  • 1
    Welcome to Vi and Vim! Just a quick note: the :echoerr test doesn't really mean anything; :echoerr just echo's what you type (no actual checking anything) with error highlighting. Probably the simplest thing do to (assuming you're on windows) is launch neovim and type :edit ~/AppData/Local/nvim/init.vim--you might have to create the nvim directory (it looks like the rest is already there)
    – D. Ben Knoble
    Commented Nov 13, 2020 at 17:02
  • Thanks! Now iI have another problem when add this 3 lines on init.vim set runtimepath^=~/.vim runtimepath+=~/.vim/after let &packpath = &runtimepath source ~/.vimrc and open nvim gives me an error in the last one, I try creating .vimrc in the same directory but still shows that errorError detected while processing C:\Users\username\AppData\Local\nvim\init.vim: line 3: E484: Can't open file C:\Users\username/.vimrc Press ENTER or type command to continue
    – Kuroce
    Commented Nov 13, 2020 at 20:35
  • i’ll add a short answer covering my comment. If you have new questions, you may ask new ones; do note that some of your questions may already have answers (and we appreciate your efforts to do some research first 😁)
    – D. Ben Knoble
    Commented Nov 13, 2020 at 20:46

2 Answers 2

8

It is likely that you are reading the wrong tutorial since you are using Windows, but your tutorial are apparently meant for Linux/macOS users.

The definitive answer: the neovim config is named init.vim or init.lua and its location varies based on the operating system you use. You can use command :echo stdpath('config') inside Neovim to find this directory. If this directory does not exist, just create it and put your config file in it. That is all.

See also neovim's doc on startup and doc on stdpath().

1

The :echoerr test doesn't really mean anything; :echoerr just echo's what you type (no actual checking anything) with error highlighting.

Probably the simplest thing do to (assuming you're on windows) is launch neovim and type :edit ~/AppData/Local/nvim/init.vim--you might have to create the nvim directory (it looks like the rest is already there).

I don't know the appropriate windows commands, but on a *nix, you would do

mkdir ~/.config/nvim
nvim ~/.config/nvim/init.vim

(assuming $XDG_CONFIG_HOME is ~/.config or unset)

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