6.4 KiB
6.4 KiB
nvim
Personal Neovim config based on kickstart.nvim, tuned for backend-heavy work
in JavaScript/TypeScript, C/C++, Kubernetes, and server development.
This README is the working manual for what is configured, why it exists, and how to use it quickly.
Design principles
- Additive, not disruptive: new plugins and mappings are added without replacing existing behavior.
- Modular plugin specs: each concern lives in
lua/custom/plugins/*.lua. - Terminal-friendly workflow: most actions map to short leader sequences and preserve CLI-first habits.
- Keep startup stable: major features are lazy-loaded by command, filetype, or explicit keymaps where possible.
Repository layout
init.lua: base options, core plugin setup, LSP, formatting, treesitter.lua/custom/plugins/*.lua: modular plugin specs and custom behavior.doc/nvim.txt: Vim help document (:help nvim-config).lazy-lock.json: plugin lockfile managed by lazy.nvim.
Quick validation commands
Run these after config changes:
nvim --headless "+qa"
nvim --headless "+checkhealth" "+qa"
luac -p init.lua lua/custom/**/*.lua
Useful maintenance commands:
nvim --headless "+Lazy! sync" "+qa"
nvim --headless "+MasonToolsInstallSync" "+qa"
Keymap manual
Git workflow
<leader>gg: open Neogit UI<leader>gd: open Diffview<leader>gD: close Diffview<leader>gf: Diffview file history (current file)<leader>gF: Diffview repo history<leader>h...: Gitsigns hunk actions (:which-key <leader>h)
Diagnostics and code navigation
<leader>xx: Trouble diagnostics<leader>xw: Trouble workspace diagnostics<leader>xd: Trouble current buffer diagnostics<leader>xq: Trouble quickfix list<leader>xl: Trouble location list<leader>tc: toggle treesitter context header<leader>jm/<leader>jk: next/previous function start<leader>jM/<leader>jK: next/previous function end<leader>jc/<leader>jC: next/previous class start- Textobject select (operator-pending/visual):
af/iffor function,ac/icfor class
Tests and debug
<leader>nr: neotest run nearest<leader>nf: neotest run current file<leader>ns: neotest run suite (cwd)<leader>nd: neotest debug nearest via DAP<leader>nn: neotest summary toggle<leader>no: neotest output for nearest test<leader>nO: neotest output panel toggle<leader>na: attach to running neotest process<leader>nS: stop neotest run
Existing DAP keys are unchanged:
<F5>continue/start,<F1>step into,<F2>step over,<F3>step out<F7>toggle dap-ui,<leader>btoggle breakpoint,<leader>Bconditional bp
Search, replace, and explorer
<leader>sR: project search/replace with grug-far<leader>eo: open Oil explorer view (optional, non-default explorer)
CMake workflow (optional)
<leader>cg: CMake generate<leader>cb: CMake build<leader>cr: CMake run<leader>ct: CMake test<leader>cc: CMake select build type
Plugin stack by workflow
LSP and language intelligence
nvim-lspconfig+mason-lspconfig+mason-tool-installer- Vue integration:
vue_lsenabledts_lsscoped tovuewith@vue/typescript-plugin- keeps
typescript-tools.nvimavailable for TS/JS workflows
- Kubernetes/Helm integration:
yamllswith schema mappings for Kubernetes, Helm chart, Helmfile, and Kustomizehelm_lsenabledvim-helmadded for Helm syntax support
Treesitter and structural editing
nvim-treesitteruses current API (require('nvim-treesitter').setup()).nvim-treesitter-contextprovides sticky scope context.nvim-treesitter-textobjectsadds structure-aware function/class jumps.
Debugging
- Core:
nvim-dap,nvim-dap-ui,mason-nvim-dap,nvim-dap-go. - JS/TS:
nvim-dap-vscode-jsconfigured withjs-debug-adapterandpwa-nodelaunch/attach defaults. - C/C++:
codelldbinstallation via Mason and baseline launch profile (Launch current file (codelldb)).
Testing
neotestcore with adapters:neotest-jestneotest-vitestneotest-gtest
Notes for C++ tests:
neotest-gtestneeds executable mapping per project (use:ConfigureGtestfrom the neotest summary window).
Formatting and linting
- Formatting via
conform.nvim:- JS/TS/JSON/YAML:
prettierd->prettier - C/C++:
clang_format - Lua:
stylua
- JS/TS/JSON/YAML:
- Linting via
nvim-lint:- markdown:
markdownlint - dockerfile:
hadolint - yaml / yaml.helm-values:
yamllint
- markdown:
Linting is executable-aware for configured linters to avoid noisy diagnostics when a linter binary is unavailable.
Project workflow plugins
trouble.nvim: focused diagnostics/issues panelgrug-far.nvim: project-wide search/replaceoil.nvim: optional file editing explorer (does not replace default explorer)cmake-tools.nvim: CMake build/run/test helpers (lazy and optional)
Mason-managed tools and servers
This config ensures installation for key tools used by the workflows above, including:
prettierd,prettier,clang-formathadolint,yamllint,markdownlint,styluajs-debug-adapter,codelldb- configured LSP servers from
serverstable (includinghelm_ls)
Check with :Mason and install manually if needed.
Typical workflows
JS/TS service workflow
- Edit with LSP + treesitter context.
- Run nearest test with
<leader>nror file with<leader>nf. - Debug test or code path with
<leader>nd/<F5>. - Use
<leader>sRfor safe project refactors.
C/C++ workflow
- Navigate symbols with
<leader>jm/jk/jc/jC. - Build/test with CMake mappings if project uses CMake.
- Debug using existing DAP keys and select
Launch current file (codelldb). - Run gtest via neotest after
:ConfigureGtestsetup.
Kubernetes/Helm workflow
- Edit manifests with
yamllsschema-backed completion/validation. - Edit charts/templates with Helm support (
helm_ls,vim-helm). - Use
<leader>sRfor scoped multi-file YAML refactors.
Troubleshooting
- Verify startup:
nvim --headless "+qa" - Verify health:
nvim --headless "+checkhealth" "+qa" - Verify LSP clients in current buffer:
:LspInfo - Verify formatter mapping:
:ConformInfo - Verify Mason state:
:Mason - Re-sync plugins:
:Lazy sync
If a new feature appears missing, first confirm lazy-loading trigger (keymap/filetype/command) was actually used.
Help docs
This repo ships a Vim help file:
:help nvim-config:help nvimn-config