From Zero to Zen: My Neovim Configuration Explained
Welcome to my Neovim setup—a configuration that balances minimalism, power, and ergonomics. Whether you're a long-time Vim user or someone curious about what a modern, Lua-powered editor can look like, this post will walk you through my setup, one section at a time.
Why Neovim?
I wanted an editor that:
- Starts up in milliseconds
- Keeps my hands on the keyboard
- Feels hackable without being chaotic
- Doubles as a writing and coding tool
Neovim checked all the boxes. And with Lua, configuring it feels like writing real, expressive code—not just tweaking obscure settings.
🛠️ Core Editor Settings
UI/UX Enhancements
vim.opt.termguicolors = true
vim.opt.cursorline = true
vim.opt.signcolumn = "yes"
vim.opt.scrolloff = 10
vim.opt.number = true
vim.opt.relativenumber = true
These settings improve visibility and reduce distractions. The cursor line keeps you focused, while relative numbers speed up vertical movement.
Input Tweaks
vim.opt.mouse = "a"
vim.opt.inccommand = "split"
vim.opt.timeoutlen = 300
vim.opt.updatetime = 250
These provide faster responsiveness, better substitutions, and optional mouse support (though keyboard is still king).
Formatting & Indentation
vim.opt.breakindent = true
vim.opt.list = true
vim.opt.listchars = { tab = "» ", trail = "·", nbsp = "␣" }
This helps spot those sneaky invisible characters and ensures indentation respects logical lines.
Clipboard & Undo
vim.schedule(function()
vim.opt.clipboard = "unnamedplus"
end)
vim.opt.undofile = true
vim.opt.undodir = os.getenv("HOME") .. "/.nvim/undodir"
You get system clipboard support and persistent undo across sessions. Win-win.
Search Behavior
vim.opt.ignorecase = true
vim.opt.smartcase = true
vim.opt.incsearch = true
Intuitive search that feels smarter without being too clever.
File Handling
vim.opt.swapfile = false
vim.opt.backup = false
No unnecessary backup or swap files cluttering your project.
⌨️ Key Bindings
-
<Esc>
: Clears search highlights -
jk
: Escapes insert mode -
<leader>w/q
: Save/quit quickly -
<Tab>
and<S-Tab>
: Navigate buffers -
<C-e>
: Close buffer -
<leader>c
: Toggle comments (usingnorm gcc
) -
<leader>x
: Run shell commands in Vimux -
<leader>v/h
: Split panes vertically/horizontally -
<C-d>
/<C-u>
: Scroll and center
Yank Highlighting
vim.api.nvim_create_autocmd("TextYankPost", {
group = vim.api.nvim_create_augroup("kickstart-highlight-yank", { clear = true }),
callback = function()
vim.highlight.on_yank()
end,
})
A tiny feature that provides big feedback when yanking any text.
📦 Plugin Management with Lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable",
"https://github.com/folke/lazy.nvim.git", lazypath })
end
vim.opt.rtp:prepend(lazypath)
lazy.nvim
is blazing fast, lazy-loads by default, and feels like a modern plugin manager should.
🔌 Plugin Highlights
Productivity
-
autosession
: Automatic session restore -
undotree
: Visual undo history -
todo-comments
: Highlight TODOs and FIXMEs
IDE Features
-
nvim-lspconfig
: Language Server Protocol support -
nvim-treesitter
: Syntax-aware highlighting -
fzf-lua
+telescope.nvim
: File and symbol fuzzy-finders -
blink.nvim
: Auto-completion
Visual & Git
-
gruvbox
: My theme of choice -
lualine
,bufferline
: Pretty status and tab lines -
gitsigns
,diffview
: Git diff tools right inside Neovim
UX Improvements
-
autopairs
,vim-sandwich
: Auto-closing pairs -
vim-sleuth
: Smart tab detection -
oil.nvim
: File explorer -
tmux-navigator
: Seamless pane navigation with tmux
Documentation & Writing
-
neorg
: Note-taking inside Neovim
🤖 LSP Integration
vim.api.nvim_create_autocmd("LspAttach", {
group = vim.api.nvim_create_augroup("lsp-attach", { clear = true }),
callback = function(event)
local map = function(keys, func, desc, mode)
mode = mode or "n"
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = "LSP: " .. desc })
end
map("gr", require("fzf-lua").lsp_references, "Go to references")
map("<leader>ds", require("fzf-lua").lsp_document_symbols, "List document symbols")
map("<leader>ws", require("fzf-lua").lsp_workspace_symbols, "List workspace symbols")
map("<leader>wd", require("fzf-lua").diagnostics_workspace, "List workspace diagnostics")
end,
})
Dynamic, buffer-local LSP mappings tied to the attach event. Cleaner and safer.
🧩 Conclusion
Neovim isn't just an editor—it's a platform. And with a setup like this, you'll spend less time fighting your tools and more time building cool stuff.
Happy hacking! 🚀
Top comments (0)