Traap's Blazing Fast Neovim configuration.
resetNeovim does the following:
- Uses bnvim to clone or pull Neovim sources and build them.
- Uses "switchNeovim traap" to switch to my Neovim configuration.
- Backups are not done.
- You have been warned.
Try nvims to safely experiment with multiple Neovim configurations.
nvim.traap is my production Neovim configuration. It is powered by
lazy.nvim, uses Neovim's native LSP
client, and borrows selected conventions from LazyVim without loading the
LazyVim distribution or its default plugin set.
The configuration favors deliberate lazy loading and a small startup surface. It provides a complete coding environment when launched in Neovim and a reduced integration layer when embedded in VS Code.
- Neovim 0.12 or newer. This tree is maintained on Neovim 0.13, which
provides
vim.lsp.config()andvim.lsp.enable(). - Git, which bootstraps
lazy.nvimand installs plugins. - A Nerd Font from the v3 collection. Diagnostic signs use the icon table in
lua/traap/config/icons.lua. ripgrepfor Snacks grep and todo searches.tree-sitterCLI 0.26.1 or newer,curl,tar, and a C compiler, sonvim-treesittercan build parsers.- Node.js and Yarn to build
markdown-preview.nvim. misewith Ruby 4.0.0 and Solargraph for Ruby LSP support.nixdonPATHwhen Mason's registry does not ship it.
Language servers managed by Mason may have additional runtime requirements.
Use :checkhealth, :checkhealth vim.lsp, and :Mason when diagnosing a
missing tool.
init.lua owns the startup sequence:
- Set the global and local leader to
<Space>. - Bootstrap
lazy.nviminto Neovim's data directory when it is absent. - Load the curated plugin specifications from
lua/traap/plugins. - Apply options, autocommands, keymaps, clipboard integration, and platform detection.
- Apply TokyoNight when running in standalone Neovim.
Plugins are intentionally unversioned so updates follow their current upstream
branches. The automatic update checker and configuration-change notifications
are disabled. lazy-lock.json records the working revisions.
Useful package commands:
| Command | Purpose |
|---|---|
:Lazy |
Open the plugin manager. |
:Lazy sync |
Install missing plugins, update plugins, and remove unused plugins. |
:Lazy update |
Update installed plugins and the lockfile. |
:Lazy clean |
Remove plugins no longer present in the specification. |
:Lazy profile |
Inspect startup and plugin load times. |
:Mason |
Inspect language-server installations. |
| Path | Responsibility |
|---|---|
init.lua |
Entrypoint and startup ordering. |
lua/traap/config/bootstrap.lua |
Installs and adds lazy.nvim to the runtime path. |
lua/traap/config/lazy.lua |
Package-manager policy and UI. |
lua/traap/config/options.lua |
Global editor defaults. |
lua/traap/config/autocmds.lua |
Filetype and buffer lifecycle behavior. |
lua/traap/config/keymaps.lua |
Core, plugin, LSP, and platform mappings. |
lua/traap/plugins/ |
Curated plugin specifications and customizations. |
lua/traap/lsp/servers.lua |
Filetype-to-server registry and server overrides. |
lua/traap/lsp/config.lua |
LSP capabilities, installation, setup, and formatting. |
lua/traap/lsp/init.lua |
Native LSP compatibility commands. |
lua/traap/core/ |
Clipboard, notifications, platform detection, wiki helpers, and utilities. |
The principal defaults are two-space indentation, an 80-column text width, relative line numbers, persistent sign columns, rounded floating windows, right/below splits, no swapfile, and no line wrapping. The system clipboard is used locally; remote SSH sessions retain Neovim's internal clipboard.
Folds use foldmethod=marker. A fold opens with a Lua comment, three left
braces, and a title. It closes on column 80. The close line is the comment
leader, one space, dashes, and three right braces. Deeper indentation shortens
the dash run so the line stays 80 columns. Four closes in servers.lua omit
the space before the braces and add one dash instead. Do not reflow these
lines. comment_block.lua generates the same 80-column pair from
'commentstring'.
Autocommands add several workflow conveniences:
- Create missing parent directories immediately before saving.
- Restore the last cursor location when reopening ordinary files.
- Close help, quickfix, Fugitive, health, and similar utility windows with
q. - Apply prose- and comment-friendly format options to supported source files.
- Mark
csv,sh, andtexbuffers withvim.b.autoformat = false. - Reapply custom purple borders and UI highlights after colorscheme changes.
Snacks is the main interface layer. Its dashboard identifies this configuration
as powered by lazy.nvim; explorer, file and grep pickers, Git browsing,
notifications, buffer deletion, status column, word references, toggles, image
support, and Zen mode are enabled. Animation, indentation guides, scrolling,
terminal, and Lazygit integrations are deliberately disabled.
The explorer and picker cooperate with Herdr and tmux: <C-h>, <C-j>, <C-k>, and
<C-l> leave the picker and move in the requested direction when there is no
adjacent Neovim window. Herdr takes precedence when both environments are present.
Frequently used mappings include:
| Mapping | Action |
|---|---|
<leader>e |
Open the explorer. |
<leader>ff / <leader>fg |
Find files / Git files. |
<leader>fb / <leader>fr |
Find buffers / recent files. |
<leader>sg / <leader>sw |
Grep text / grep the word or selection. |
<leader>sd / <leader>sD |
Show workspace / buffer diagnostics. |
<leader>gb / <leader>gl |
Browse Git branches / log. |
<leader>gB |
Open the current location with Git browse. |
blink.cmp combines buffer, LSP, path, and snippet sources. It enables command
line completion, friendly snippets, ghost text, signature help, automatic
documentation after 500 ms, and Rust-backed fuzzy matching when available.
Completion capabilities are injected into every configured LSP server.
lazydev.nvim supplies Neovim Lua runtime metadata so completion and diagnostics
understand vim, plugin APIs, and the active runtime path.
Treesitter is loaded at startup. The current nvim-treesitter rewrite does
not support lazy-loading, and it needs Neovim 0.12 or newer. Bash and
regular-expression parsers are ensured during setup. Other parsers are
installed on the first corresponding FileType event, with the install wait
capped at two minutes. Parser setup is skipped for transient interfaces such as
completion menus, help, quickfix, Lazy, Mason, Noice, notifications, LSP info,
and Snacks picker buffers.
Harpoon 2 writes its list on VimLeavePre. UI edits are not saved on toggle,
and closing the Harpoon window does not sync the list. The old save_on_change,
mark_branch, enter_on_sendcmd, excluded_filetypes, and
tmux_autoclose_windows settings are no longer part of Harpoon. Slots one
through eight are selected with ;1 through ;8. Harpoon is not enabled
inside VS Code.
markdown-preview.nvim loads for markdown and wiki buffers and builds its
web application with yarn install. Wiki and journal commands are provided by
wiki.vim plus the local vim-bundle-wiki.vim customizations. Bullets and
checkboxes are active for Markdown, wiki, text, scratch, and Git commit buffers;
;x toggles a checkbox. <leader>wv opens the last :WikiExport PDF with
$PDF_VIEWER from $WIKIHOME/printed/.
img-clip.nvim stores pasted images beneath images/<document-name>/, prompts
for the filename, URL-encodes paths, and inserts filetype-specific markup for
Markdown, wiki, AsciiDoc, HTML, Org, reStructuredText, TeX, and Typst. It is
disabled on Windows.
In addition to the standard keywords, todo-comments recognizes:
YouTube,Youtube, andyoutubewith a red YouTube icon.URL,Url, andurlwith a purple link icon.
Keyword sets are merged with the defaults and matches are highlighted even when they appear outside comments.
Fugitive loads on :G; Gitsigns supplies buffer signs and hunk operations, and
Snacks supplies repository pickers and browser integration. grug-far.nvim
provides project-wide search and replacement. Better Quickfix adds a preview
window whose borders follow the configuration's purple highlight palette.
TokyoNight uses its transparent night style with italic comments and keywords,
transparent sidebars and floats, bold Lualine section headers, and purple
borders. TokyoNight 4 removed hide_inactive_statusline; Lualine runs with
globalstatus instead. Noice renders the command line in a popup, sends ordinary
messages through notifications, exposes long messages in a split, and filters
routine editor noise. Lualine includes Git state, diagnostics, macro recording,
Noice command/search status, file metadata, and cursor position. Which-key uses
its modern preset with spelling suggestions.
The LSP stack is composed of three plugins:
nvim-lspconfigsupplies server definitions compatible with Neovim's native LSP configuration API.mason.nviminstalls language-server executables in Neovim's data directory.mason-lspconfig.nvimtranslates LSP server names into Mason packages.
Servers are installed and configured by filetype rather than eagerly at
startup. On the first matching FileType event, the configuration:
- Looks up the server in
lua/traap/lsp/servers.lua. - Skips setup when that server was already handled during the session.
- Asks Mason to ensure the package is installed unless
mason = false. - Merges Blink completion capabilities and the format-on-save attachment hook with the server-specific options.
- Configures and enables the server through
vim.lsp.config()andvim.lsp.enable().nvim-lspconfig'ssetup()framework is not used.
The first visit to a filetype may start a Mason install for that one package.
mason-lspconfig is not set up again on each filetype, because a later
setup() call replaces ensure_installed. Open another buffer of that type
or run :LspStart after installation finishes if the executable was not
available when Neovim first attempted to start the server. A server missing
from the Mason registry produces a warning. Set mason = false and provide
opts.cmd for those tools.
The registry currently supports:
| Languages | Servers |
|---|---|
| Bash, C/C++, C#, CSS | bashls, clangd, csharp_ls, cssls |
| Go, HTML, Java, JSON | gopls, html, jdtls, jsonls |
| Julia, LaTeX prose, Lua, Markdown | julials, ltex, lua_ls, marksman |
| Nix, Python, QML, Ruby | nixd, pyright, qmlls, solargraph |
| Rust, SQL, Svelte, TeX | rust_analyzer, sqls, svelte, texlab |
| TOML, JavaScript/TypeScript, Vim, XML, YAML, Zig | taplo, ts_ls, vimls, lemminx, yamlls, zls |
Solargraph is explicitly excluded from Mason management and is deliberately launched with:
mise exec ruby@4.0.0 -- solargraph stdio
nixd is installed by Mason when the registry ships it, and otherwise must
exist on PATH with mason = false. The Lua server
knows the complete Neovim runtime library and accepts vim and Snacks as
globals. Clangd enables background indexing and clang-tidy, requests detailed
completion, and suppresses automatic header insertion.
When a client supports textDocument/formatting for that buffer, a
buffer-local BufWritePre hook formats synchronously. The hook skips the
buffer when vim.b.autoformat is false. csv, sh, and tex set that flag.
Native LSP mappings are installed when a client attaches:
| Mapping | Action |
|---|---|
gd / gD |
Definition / declaration. |
gi / gr |
Implementation / references. |
K / <leader>k |
Hover / signature help. |
<leader>rn |
Rename symbol. |
<leader>ca |
Code action. |
<leader>E |
Open diagnostic float. |
[d / ]d |
Previous / next diagnostic. |
<leader>q |
Populate the location list with diagnostics. |
LSP maintenance commands:
| Command | Purpose |
|---|---|
:LspInfo |
Run :checkhealth vim.lsp. |
:LspLog |
Open the Neovim LSP log in a tab. |
:LspStart [server...] |
Enable named servers, or the server for the current filetype. |
:LspRestart[!] [server...] |
Restart named or active servers; ! force-stops clients. |
:LspStop[!] [server...] |
Disable named or active servers; ! force-stops clients. |
To add or change a language server, edit
lua/traap/lsp/servers.lua. Each registry entry requires a native LSP server
name and one or more filetypes. Add opts for server-specific settings or a
custom command. Set mason = false when the executable is installed outside
Mason.
example = {
name = "example_ls",
filetypes = { "example" },
opts = {
settings = { example = { enabled = true } },
},
}Standalone Neovim receives the complete UI, completion, LSP, Treesitter, Git, Harpoon, and content-authoring stack. VS Code receives a reduced plugin list and routes selected editor actions to VS Code commands. Platform helpers also adapt clipboard behavior for SSH and Windows and allow picker navigation to cross Neovim/tmux boundaries.
After changing the configuration, useful checks are:
nvim --headless "+Lazy! sync" "+qa"
nvim --headless "+checkhealth" "+qa"
stylua --check init.lua luaWithin Neovim, use :Lazy profile to inspect startup behavior, :Mason to
inspect installed language servers, and :LspInfo from a source buffer to
confirm that its client attached.