Looking for init.vim on windows

I am a beginner user of vim/nvim. I am trying to find the init.vim file as most tutorials out there change this file to customize neovim.

I am on windows and I used chocolatey to install nvim. I was trying to find init.vim folder in c:/user/<user_name>/AppData/Local/ folder, but I only found nvim-data folder. I could not find the nvim folder

Using :help base-directories command I found out that nvim-data is Data directory, and nvim is the config directory.

My question is why nvim folder is not created already along with nim-data? Is there any process to create the nvim folder and the init.vim file within it?

Thanks!

Maybe you’re looking for :help init.vim. Actually :help vimrc-intro is better.

But addressing your concern, the init.vim file needs to be created by you the user, why? Because it’s a user configuration and unfortunately will have to be created by the user, so you just need to manually create the nvim folder and the init.vim file.

Here is how you can do it in powershell:

mkdir ~\AppData\Local\nvim && New-Item -Path ~\AppData\Local\nvim\init.vim -Type File

And then you can edit the file in nvim with :edit $MYVIMRC

Thank you very much!

Also, I am wondering if there is any structured resource available that introduced what I can put in the init.vim - or what more can I do with init.lua + lua?

1 Like

You could always look up videos on youtube, that’s how I learned it, a quick vimrc search on youtube can give you a start

Lua configs are quite new, I haven’t seen many articles/resources out there on how to get started. The main on I’ve seen is the nvim-lua-guide which is really good. Outside of that, you can look up other users config on github or on reddit.

Lastly, you can look at my configs, I have two separate ones (work and experimenting) one is in init.vim and the other is in lua, just to give you an idea there isn’t much comments there to explain, most of the time :h name (where name is anything vim related function/options/etc) in vim can give you more info:

1 Like

What is the difference among vimrc, init.vim and init.lua?

That’s a good question :slight_smile:

There is no difference among those files when it comes to purpose, they all do one thing for vim and that is: configure your custom settings for vim/neovim

The only difference is the location:

  • vimrc or aka .vimrc is used for vim only which is located in ~/.vimrc in your home directory (assuming you’re on Linux)
  • init.vim is used for neovim only and is located in ~/.config/nvim/init.vim and does exactly the same thing what a vimrc would do, it’s just the location
  • init.lua now is also for neovim only and is located in the same location as an init.vim but in lua instead

vimrc/init.vim uses a scripting language call vimscript also called vimL (they both are interchangable) which is developed exclusively for vim.

init.lua is, as you can guess, in lua which is a more complete programming/scripting language that is used in many software that want to embed a custom scripting language for changing settings.

At this point if you are starting for the first time (and since you are in a neovim forum) you should start with the init.vim. There is a lot of trend with init.lua but honestly as long as you understand lua you can start with that, but there is more support and solutions out there for init.vim as init.lua is quite new, but that’s just IMO. Other users here are also free to mention what they use :slight_smile:

1 Like

Thanks for the detailed explanation.

Why neovim chose to use init.vim instead of using vimrc?

So they won’t interfere and you can use vim and neovim in parallel.

1 Like

How can that happen since init.vim is located under a folder named nvim?

@creativenull
I really liked your Neovim config file as a person who was not willing to switch from vimscript to Lua i was super attracted to your Lua layout and decided to try it out. But there are few problems with your Readme file.
The lack of a complete installation guide for window users and the required packages to make sure the the expected end result will be matched.
The lack of a complete guide on how to install them and where to find them.

This was just a suggestion, i transitioned from Linux to windows due to some issues with my previous laptop and i really wanted to have the same environment as Linux. All am saying is that your readme file is really short on explanation for a complete beginner.
Will be making a readme file from your whole dotfile for Lua and Neovim on windows. Reach out if you would like to have me give you a copy of it.