Neovim File Structure

For modern versions, Neovim looks for its configuration in ~/.config/nvim/. The main entry point is now init.lua instead of the old init.vim.

A recommended folder structure to keep things organized:

~/.config/nvim/
├── init.lua
└── lua/
    ├── core/
    │   ├── options.lua  (Global settings)
    │   └── keymaps.lua  (Your keyboard shortcuts)
    └── plugins/         (Plugin configuration)

Your first init.lua

Start with these basic lines to notice the difference immediately:

-- Set the leader key to spacebar
vim.g.mapleader = " "

-- Basic settings
local opt = vim.opt
opt.number = true         -- Show line numbers
opt.relativenumber = true -- Relative numbers for fast jumps
opt.shiftwidth = 4        -- Indent size
opt.expandtab = true      -- Convert tabs to spaces
opt.termguicolors = true  -- True color support
Introduction to NeovimVim Modes