Lua config for Neovim 0.12+ using lazy.nvim.
Leader key is <Space>.
git clone https://github.com/tcvdh/init.lua.git ~/.config/nvim
nvimFirst launch bootstraps lazy.nvim and installs every plugin. Mason then installs the language
servers and tools, and treesitter compiles parsers as you open files. Wait for it to finish
(watch :Lazy and :Mason), then restart nvim.
One manual step: run :Copilot auth to sign in to GitHub Copilot.
| Needed for | Packages |
|---|---|
| Neovim itself | neovim 0.12 or newer |
| Plugin install, mason downloads | git, curl, tar, unzip, gzip |
| Compiling treesitter parsers | a C compiler (gcc or clang) |
Grep (<leader>ps) |
ripgrep |
| Icons | a Nerd Font set in your terminal |
Mason-installed Python tools (basedpyright) and npm tools (prettier, tsgo) |
python, node + npm |
Lazygit (<leader>gg) |
lazygit |
| Clipboard on Linux | wl-clipboard (Wayland) or xclip (X11) |
Arch: sudo pacman -S neovim git curl unzip gcc ripgrep nodejs npm python lazygit wl-clipboard
macOS: brew install neovim ripgrep node lazygit (plus a Nerd Font and Xcode CLT for the compiler)
Optional:
- LaTeX (vimtex): a TeX distribution with
latexmk,latexindent, and a viewer.zathuraon Linux,sioyekon macOS (picked automatically inlazy/vimtex.lua). fd: Snacks uses it for file search when present, otherwise falls back torg.- Rust formatting needs
rustfmt(rustup component add rustfmt).
Language servers (lazy/lsp.lua): lua_ls, rust_analyzer, clangd, asm_lsp, tsgo,
texlab, basedpyright, ruff. Zig (zls) is configured but only enabled if you install it.
Tools: tree-sitter-cli, stylua, prettier, clang-format.
If something is missing, :Mason shows state and :checkhealth tells you what is wrong.
init.lua -> require("tcvdh")
lua/tcvdh/
init.lua requires the files below
set.lua options
remap.lua general keymaps
autocmds.lua yank highlight, LSP keymaps (set on attach)
lazy_init.lua lazy.nvim bootstrap
lazy/ one file per plugin (or group)
clang-format-default.yaml C/C++ fallback style (see below)
.stylua.toml Lua formatting: 4 spaces, 100 columns
| Area | Plugins |
|---|---|
| Core | lazy.nvim, plenary, nvim-web-devicons |
| UI | catppuccin (macchiato), lualine, which-key, fidget, todo-comments, snacks (dashboard, notifier, indent guides) |
| Navigation | snacks picker, oil.nvim, flash.nvim |
| Git | gitsigns, lazygit (via snacks) |
| LSP | nvim-lspconfig, mason, mason-lspconfig, mason-tool-installer, lazydev |
| Completion | blink.cmp, friendly-snippets, copilot.lua (inline ghost text) |
| Formatting | conform.nvim |
| Syntax | nvim-treesitter (main branch), treesitter-context, asm-context |
| Editing | vim-sleuth, nvim-autopairs, neotab |
| Languages | vimtex (LaTeX), render-markdown |
Press <Space> and wait: which-key lists everything available.
| Key | Action |
|---|---|
<leader>pf |
Find files in project (includes dotfiles, skips .git) |
<leader>ps |
Grep text across the project |
<leader>pw |
Grep word under cursor (or visual selection) |
<leader><leader> |
Open buffers |
<leader>sn |
Find files in this nvim config |
<leader>pv |
Oil: open file explorer |
- |
Oil: open parent directory as an editable buffer (rename by editing, :w to apply) |
z= |
Spelling suggestions |
<leader>gg |
Lazygit |
Search starts from the directory nvim was opened in, so open it at the project root.
In a picker, <C-q> sends results to the quickfix list.
| Key | Action |
|---|---|
gd |
Go to definition (<C-o> to jump back) |
K |
Hover docs |
]d / [d |
Next / previous diagnostic |
<leader>vd |
Diagnostics for the current line |
<leader>vca |
Code actions (normal and visual) |
<leader>vrr |
References |
<leader>vrn |
Rename symbol |
<leader>vws |
Workspace symbols |
<C-s> (insert) |
Signature help |
<leader>f |
Format buffer (conform, falls back to LSP) |
<leader>q |
Diagnostics to location list |
Neovim 0.12 built-ins also work: grr references, gra code action, grn rename, gri implementation.
| Key | Action |
|---|---|
<C-Space> |
Open menu / docs |
<M-j> / <M-k> |
Next / previous item (<C-n> / <C-p> also work) |
<M-Enter> |
Accept (selects the first item if none selected) |
<C-e> |
Close menu |
<C-k> |
Signature help |
| Key | Action |
|---|---|
<M-l> |
Accept suggestion |
<C-l> |
Accept one line |
<Esc> |
Dismiss |
| Key | Action |
|---|---|
s + chars |
Jump: type 1-2 characters, then press the label shown at the target |
S |
Select a treesitter block (function, if, arguments), works with operators: dS |
r (after an operator) |
Remote: yr + pattern + label yanks there without moving |
R (operator/visual) |
Treesitter search |
<C-s> (in / search) |
Toggle flash labels on search |
s replaces the built-in single-character substitute; use cl instead.
| Key | Action |
|---|---|
]c / [c |
Next / previous hunk |
<leader>hs / <leader>hr |
Stage / reset hunk (works on a visual selection) |
<leader>hS |
Stage buffer |
<leader>hp |
Preview hunk |
<leader>hb |
Blame line |
<leader>hd |
Diff against index |
<leader>tb |
Toggle inline blame |
| Key | Action |
|---|---|
J / K (visual) |
Move selected lines down / up |
<C-h/j/k/l> |
Move between windows |
<leader>s |
Substitute the word under cursor across the file |
<leader>p (visual) |
Paste without overwriting the register |
<leader>d |
Delete without yanking |
<C-f> / # (visual) |
Search forward / backward for the selection |
Markdown renders inside the buffer automatically; :RenderMarkdown toggle turns it off.
<leader>f runs conform:
| Filetypes | Formatter |
|---|---|
| c, cpp | clang-format. A .clang-format in the project (searched upward) wins; otherwise clang-format-default.yaml (LLVM, 4 spaces, 100 columns) |
| lua | stylua |
| python | ruff (ruff_format) |
| js, ts, tsx, json, yaml | prettier |
| rust | rustfmt |
| tex | latexindent |
Defaults are 4 spaces. vim-sleuth detects the real indent from .editorconfig or the existing
file contents. Treesitter only does highlighting; indenting uses Vim's built-in indent files
(cindent for C/C++).
- Treesitter is on the
mainbranch becausemasterbreaks on Neovim 0.12. lazy-lock.jsonpins plugin versions. Commit it after updating with:Lazy update.- Text width and color column are both 100; spell check is on for markdown, text, gitcommit, and tex.