For Neovim 0.13 (nightly). Plugins come from vim.pack; LSP, treesitter,
completion, the file browser, undotree, multicursor and the pickers are all
builtin. One plugin:
- fff finds files and greps. Its post-install hook in
init.luadownloads or builds its binary.
:packupdate updates it, and the resolved commit is in nvim-pack-lock.json. Also assumed installed: ripgrep, universal-ctags,
a C compiler (for treesitter parsers) and the language servers in lsp/.
Keymaps are in KEYMAPS.md.
This config currently uses 0.13's vim.pack, multicursor, UI2, native
undotree, filesystem-watcher autoread, structural treesitter
selection, rich command completion items, winpinned, and yank/put operation
highlighting. Useful builtins that need no config include:
:restart/ZRrestarts Nvim while restoring the session;:restart!starts clean.alandilselect the whole buffer or current trimmed line in Visual or operator-pending mode.q:,q/andq?are now normal buffers: splits, async work andinccommandkeep working inside them.:log lsp,:uptime,:browse oldfiles, andz=expose native log, runtime, old-file and spelling UIs.:packadd nvim.difftooladds:DiffTool left right, including directory comparison and rename detection.vim.ui.imgdisplays images in supported terminals; run:checkhealth vim.healthto see whether the current terminal qualifies.
init.lua plugins, module wiring, colorscheme, ui2
lua/config/
options.lua options, cmdline autocompletion, no bold/italic/underline
keymaps.lua editing, quickfix stepping, <Tab> and member completion
lsp.lua servers, gd (LSP else tags), clangd unity-build definition
pickers.lua fff, plus native oldfiles, :Grep, symbols
treesitter.lua highlighting, :TSInstall/:TSUpdate/:TSList
ts_indent.lua indents.scm engine (used by Jai)
project.lua project root, vendored dirs every scanner skips
clangd_setup.lua :ClangdSetup
ctags.lua :Ctags, &tags and &path for C
c_complete.lua struct members after . -> :: for C without an LSP
c_indent.lua the case-label indent fix for C
format.lua odinfmt, Prettier, Prettier indent options
notes.lua dividers.lua comment_tags.lua
lua/launch/ launch.json keys, output buffers, build errors
lua/hh/ scope shading, project macro highlighting, picker dim
(set up once in init.lua, for every colorscheme)
lsp/ one file per language server
colors/stb-brown-light.lua default colorscheme (brown text on soft off-white)
after/ ftdetect/ queries/ syntax/
Use :colorscheme stb-dark or :colorscheme stb-light (stb also selects
the light variant). These port the original 4coder STB palettes: monochrome
code, green comments and red escapes, with scope shading and picker dimming.
Use :colorscheme stb-night for STB dark syntax on a near-black (#0c0c0c)
background with darker menus, gutters and status bars.
Use :colorscheme stb-brown for the same near-black surfaces with Handmade
Hero's warm tan text (#a08563) and STB's green comments.
Use :colorscheme stb-brown-light for darker brown text on a soft off-white background
with STB light's darker green comments.
To choose one at startup, change the vim.cmd.colorscheme(...) line in
init.lua.
Servers are enabled in lua/config/lsp.lua and configured in lsp/. The
builtin commands cover the rest: :checkhealth vim.lsp,
:lsp restart|stop|enable [name], :log lsp.
Diagnostics are received but never drawn: <leader>vd, <leader>qf and
<leader>qq still show them, and :lua vim.diagnostic.enable() turns them on.
Jai uses Nvim's built-in .jai detection, the local syntax/jai.vim fallback,
the native Tree-sitter parser installed by :TSInstall jai, and Jails from
lsp/jails.lua. The old jai.vim package is unnecessary because the local
syntax is its current rule set plus function-call highlighting.
These are unity builds.
clangd is opt-in. It only attaches where :ClangdSetup has written a
.clangd: each unity TU's includes become an -include chain, scoped to the
directories that TU covers. It also writes a flagless
compile_commands.json, because clangd's background indexer only takes its
file list from one. A database a build system writes is kept. Gitignore
.cache/clangd/ and compile_commands.json. Run :ClangdSetup! again after
adding a module directory. Include roots outside the project go in
<root>/.clangd-include-dirs, one per line.
Without clangd, :Ctags builds a per-project tags file under
~/.cache/nvim/tags/. gd is a tag jump, <Tab> completes words from the
buffers and the tags file, and typing ., -> or :: lists struct members.
Treesitter resolves the variable's type and the tags file supplies the
members.
Indent width is 2 unless the project has an .editorconfig.
Manual, with <leader>f. Odin goes through odinfmt, which picks up the
nearest odinfmt.json (vim.g.odinfmt_on_save = true formats on save). JS/TS
goes through the project's own Prettier, then eslint's fixAll. JS/TS buffers
also take tabWidth/useTabs from the project's Prettier config, overrides
included.
Per-project keys, bound while you are in the project. :LaunchInit writes a
starter.
out names the output buffer (default *compilation*): one buffer per name,
one job per buffer. Starting a command stops whatever was writing there.
Output is a plain buffer fed from a PTY, so it can be searched and yanked.
When a command exits, its error locations become the quickfix list and are
marked in the files. <M-n> / <M-p> step through them, and <CR> on an
output line jumps to it. Press g in an output buffer or <leader>r anywhere
to repeat the latest command. One errorformat covers Jai,
clang, gcc, zig, MSVC, Odin, Rust, CMake and ESLint.
With no launch.json, <leader>b runs :Make, the build command detected
from the project's files (lua/launch/make.lua). For Jai it builds
build.jai, then first.jai, falling back to the current file.
{ // Comments are fine, trailing commas are not. Saving the file rebinds the keys. "<F1>": "./build.sh", "<F4>": { "cmd": "./build.sh && ./build/game", "out": "*run*" }, "linux": { "<F1>": "./build_linux.sh" } // mac/linux/windows override the entries above }