The init.lua file
Neovim, like a lot of other linux/unix programs, is configured through a user’s dotfiles.
You can create dotfiles which change the default settings in Neovim, initialize plugins, set colorschemes, and more.
When you open up Neovim, it will look for these dotfiles to load your Neovim configuration.
One of the most important files it will look for is the init.lua
file.
Create an init.lua file
On startup, Neovim looks for an init.lua
file in your config directory (~/.config/nvim
).
If you don’t already have one, create the directory with the following command:
And from your home directory, enter it with:
From here, run touch init.lua
to create your initial configuration file.
Testing Your Initial Configuration File
Open up your new init.lua
file with nvim init.lua
.
Enter insert mode with I
and type the follwing:
Then go back to normal mode with Esc
, and type :wq
to save and quit the file.
Re-open the file with nvim init.lua
, and you should see “Hello World!” at the bottom of your terminal. 🎉