@stephansama nvim
Article explaining neovim config
interactive bundle visualization
bundle visualization generated using bloat.nvim and Esbuild analyzer
Install directly to neovim config with the following command
git clone https://github.com/stephansama/nvim ~/.config/nvimor install to a specific folder and invoke the config with the following command
git clone https://github.com/stephansama/nvim ~/.config/stephansamanvim
# then launch neovim with the newly downloaded configuration
NVIM_APPNAME=stephansamanvim nvimThis Neovim configuration is built to be a highly customized and efficient development environment. Here are some of the key features:
- 📦 Plugin Management: Uses Neovim 0.12+'s built-in
vim.packpackage manager (seenvim-pack-lock.jsonfor the lock file). Plugins are declared per-domain underplugin/— e.g.plugin/editor.lua,plugin/ui.lua,plugin/ai.lua. - 📝 Schema-Driven Configuration: Leverages TypeScript and
zodto create and enforce schemas for configuration files like key mappings and dashboard shortcuts. This provides strong typing and validation for what would otherwise be plain JSON or Lua tables. - Lua Type-Checking: Utilizes
tstlto generate Lua from TypeScript, enabling robust type-checking and autocompletion for the Lua configuration within the editor. - 🧩 Modular Structure: The configuration is broken down into logical modules for plugins, LSP settings, key mappings, and utilities, making it easy to manage and extend.
- 🩺 Per-Server LSP Config: Uses Neovim 0.11+'s
vim.lsp.configstyle with one file per server underlsp/(clangd,cssls,emmet_language_server,gopls,jsonls,lua_ls,tailwindcss,yamlls) and runtime overrides underafter/lsp/. - 🛠️ Build Pipeline: TypeScript sources compile to Lua via
typescript-to-lua; pre-build (scripts/modes.ts) and post-build (scripts/clean.ts) hooks run automatically onpnpm run build. - 🪝 Quality Gates:
lefthookfor git hooks,nano-stagedfor pre-commit formatting,commitlint(conventional commits),eslint, andprettier(with@prettier/plugin-lua). - 👀 Watch Mode:
bacon.tomldefines watch jobs fortsc, lint, fmt, and schema generation, with vim-style keybindings for in-editor monitoring. - 🚀 Built-in Tooling: Includes scripts for building schemas, syncing snippets, and other automation tasks, managed via
pnpmand aMakefile.
graph TD
A["nvim/"] --> B["after/"];
A --> C["ftplugin/"];
A --> D["lsp/"];
A --> E["lua/"];
A --> F["plugin/"];
A --> G["scripts/"];
A --> H["snippets/"];
subgraph after
B --> B1["lsp/"];
B --> B2["plugin/"];
B --> B3["queries/"];
end
subgraph lua
E --> E1["config/"];
E --> E2["icons/"];
E --> E3["keys/"];
E --> E4["lang/"];
E --> E5["schemas/"];
E --> E6["utils/"];
end
subgraph plugin
F --> F1["editor.lua / ui.lua / ai.lua"];
F --> F2["lspconfig.lua / fzf.lua / mini.lua"];
F --> F3["javascript.lua / rust.lua / markdown.lua / testing.lua"];
end
Keymaps, dashboard shortcuts, modes, and language packs are authored as TypeScript zod schemas under lua/schemas/, validated at build time, and emitted as .json files alongside their .lua consumers under lua/keys/, lua/lang/, and lua/icons/. For example, lua/keys/global.ts defines the schema and produces lua/keys/global.json, which lua/keys/global.lua reads at runtime. This gives every config table a single source of truth with autocomplete and validation, instead of free-form Lua tables.
make install # pnpm install (via mise)
make build # pnpm run build → tstl → scripts/clean.ts
make dev # tstl --watchpnpm run buildrunststl -p tsconfig.lua.jsonwithscripts/modes.ts(pre-build) andscripts/clean.ts(post-build).baconprovides editor-driven watch jobs for typecheck, lint, fmt, and schema generation.lefthookwires pre-commit formatting vianano-staged.
Copyright © 2023-present @stephansama
