50

I can't seem to find my init.vim. I believe it is supposed to be under ~/Neovim/share/nvim but the only folder there is runtime. Do I have to make a file called init.vim? If so, where do I put it?

If anyone is still reading this, I have not fixed the problem. I have found where init.vim should be but it is not there and when I try to create the file I cannot write it when I save it. Even when I do it as administrator, I cannot write the file.

Bigbadboybob
  • 928
  • 2
  • 11
  • 18

6 Answers6

59

the config file for neovim is at ~/.config/nvim/init.vim. or if set $XDG_CONFIG_HOME/nvim/init.vim. you can get more info with :help nvim-config from your neovim instance.

Community
  • 1
  • 1
kokito
  • 1,114
  • 1
  • 13
  • 19
  • 6
    What is `$XDG_CONFIG_HOME`. When I did `:help nvim-configuration`, it said that I should use `$XDG_CONFIG_HOME/nvim/init.vim` for my configuration. – Bigbadboybob Jan 01 '17 at 23:48
  • 3
    I personally don't use `XDG_CONFIG_HOME` environment variable but you can if you want to (if you want to know more about it [freedesktop](https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html). neovim will look at `~/.config/nvim/init.vim` if it's not defined. what OS are you running? – kokito Jan 02 '17 at 03:42
  • I'm using Windows 10 – Bigbadboybob Jan 02 '17 at 14:48
  • I don't know much about windows, maybe this will help [windows installation](https://github.com/neovim/neovim/wiki/Installing-Neovim#user-content-windows) – kokito Jan 02 '17 at 18:27
  • I think I opened the right file but I can't write the file. – Bigbadboybob Jan 04 '17 at 01:09
  • what permission are on the file? do you have admin privilege? maybe this will help [windows permission](https://msdn.microsoft.com/en-us/library/bb727008.aspx) – kokito Jan 04 '17 at 06:16
  • I'm not sure but whenever I open it, it says new directory so not sure if the file actually exists. – Bigbadboybob Jan 04 '17 at 21:52
  • `$XDG_CONFIG` is not set when the default value `~/.config` should be used https://superuser.com/a/425712/114341 – Günter Zöchbauer Nov 21 '19 at 13:03
18

I couldn't find init.vim at ~/.config/nvim/init.vim in Ubuntu 18.04. I installed neovim with neovim instructions:

Since 18.04 As in Debian, neovim is in Ubuntu.

sudo apt install neovim

Python (:python) support seems to be automatically installed

sudo apt install python-neovim
sudo apt install python3-neovim

So instead, I use vim-bootstrap to create the config file and put in neovim configuration:

mkdir ~/.config/nvim & cp ~/Downloads/generate.vim ~/.config/nvim/init.vim 

PD: I am using zsh shell and I have vim installed.

israteneda
  • 705
  • 1
  • 14
  • 26
  • 2
    thanks, vim-bootstrap even has RUST setup plugin with neovim – STEEL Sep 17 '20 at 03:49
  • Also, a nice alternative to bootstrap vim/neovim configuration is [SpaceVim](https://spacevim.org/quick-start-guide/#install) a distribution for vim/neovim – israteneda Jun 29 '21 at 22:09
15

For Windows 10, the neovim's init.vim file is located in %userprofile%\AppData\Local\nvim\init.vim. Typically, it would be located in : C:\Users\USERNAME\AppData\Local\nvim\init.vim. Change USERNAME with your username.

Daniel Kim
  • 926
  • 1
  • 9
  • 17
  • 2
    With :help init.vim you can get the location for init.vim. For windows it is ~/AppData/Local/nvim/init.vim Or $XDG_CONFIG_HOME/nvim/init.vim. – xing Mar 04 '19 at 15:04
  • 1. You can have literally an empty init.vim file in %AppData% and config will be taken from a different place. 2. :help init.vim sometimes doesn't work. On my machine it yields an error `E149: Sorry, no help for init.vim` – ashrasmun Aug 12 '21 at 08:23
  • This was very useful , thanks a lot. – Ankit Chawla Dec 30 '21 at 06:21
13

On ubuntu, I created on my own a directory /.config/nvim and init.vim configuration file and that worked.

mkdir ~/.config/nvim
nvim ~/.config/nvim/init.vim
proximab
  • 1,865
  • 1
  • 13
  • 18
4

from within neovim do

:echo $MYVIMRC

to display the full path to the currently used init.vim file

Martin
  • 659
  • 7
  • 14
-4

For Windows, init.vim was located in Neovim\share\nvim\runtime\plugin

J. Doe
  • 23
  • 1
  • 1
  • 10