init.lua


With an understanding of how Neovim searches for and sources configuration files, we can start configuring.

Open a terminal or file manager and navigate to your configuration directory. Recall that you can determine where it is by executing:

:lua vim.print(vim.fn.stdpath("config"))

or

:echo stdpath("config")

If you have freshly installed Neovim this folder may not yet exist. In that case go ahead and create it. Otherwise, depending on your system your configuration folder may contain some of the search directories and either an existing init.lua or init.vim file:

~/.config/nvim/ ($XDG_CONFIG_HOME)
  |
  +- ftplugin/
  +- lua/
  +- plugin/
  +- init.lua (or init.vim)

Since we will be creating a new configuration we need to move these files to another location. For example, you might change the name of this directory from nvim to nvim-old and create a new nvim folder to hold your new configuration.