A comprehensive Neovim configuration based on LazyVim with full language support for Python, C/C++, TypeScript/JavaScript, Java, Docker, Terraform, JSON, and Rust.
Before using this configuration, ensure you have the following installed:
-
Neovim (v0.9.0 or higher)
# macOS brew install neovim # Linux (Ubuntu/Debian) sudo apt install neovim # Arch Linux sudo pacman -S neovim
-
Git (for plugin management)
# Verify installation git --version -
Node.js (for TypeScript/JavaScript support)
# Install via nvm (recommended) curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash nvm install --lts nvm use --lts
Python:
-
UV (Python package manager) - Required for Python projects
# macOS/Linux curl -LsSf https://astral.sh/uv/install.sh | sh
Verify installation:
uv --version
C/C++:
- GCC or Clang compiler
# macOS xcode-select --install # or install via Homebrew brew install gcc # Linux (Ubuntu/Debian) sudo apt install build-essential gdb
Java:
- JDK (Java Development Kit) 11 or higher
# macOS brew install openjdk@17 # or download from https://adoptium.net/ # Linux (Ubuntu/Debian) sudo apt install openjdk-17-jdk
Docker:
- Docker (for Dockerfile support)
# macOS brew install --cask docker # or download Docker Desktop from https://www.docker.com/products/docker-desktop # Linux # Follow instructions at https://docs.docker.com/engine/install/
Terraform:
- Terraform CLI
# macOS brew install terraform # Linux # Download from https://www.terraform.io/downloads
-
Clone or ensure this configuration is in place:
# If starting fresh, ensure the config directory exists mkdir -p ~/.config/nvim
-
Open Neovim:
nvim
-
LazyVim will automatically:
- Bootstrap Lazy.nvim plugin manager
- Install all configured plugins
- Set up LSP servers via Mason
- Install language servers and debuggers
-
Wait for installation to complete (first launch may take a few minutes)
-
Install Mason packages (if prompted):
- Type
:Masonto open the Mason UI - Required packages will be auto-installed, but you can manually install others
- Type
The default leader key is <Space>. Most custom keymaps use this prefix.
\- Toggle Neo-tree file explorer (reveals current file)<leader>e- Toggle Neo-tree file explorer<leader>ff- Find files (Telescope)<leader>fg- Find Git files (Telescope)<leader>fp- Find plugin files (Telescope)<leader>fr- Find recent files<leader>fb- Find buffers
<leader>y- Copy selection or line to system clipboard (works in normal and visual mode)
gd- Go to definitiongD- Go to declarationK- Show documentation (hover)<leader>ca- Code actions<leader>cr- Rename symbol<leader>cA- Code actions (source)
]d- Next diagnostic[d- Previous diagnostic<leader>xx- Toggle diagnostics (Trouble)<leader>xX- Toggle buffer diagnostics (Trouble)<leader>cd- Show line diagnostics
<leader>cs- Symbols (Trouble)<leader>cl- LSP definitions/references (Trouble)<leader>cr- References (Trouble)
<leader>cf- Format current buffer- Auto-format on save is enabled by default (except for: markdown, json, yaml, terraform)
Note: Formatting tools are language-specific and will be installed automatically via Mason.
<F5>- Start/Continue debugging<F1>- Run to cursor<F2>- Step over<F3>- Step into<F4>- Step out<leader>db- Toggle breakpoint<leader>dB- Toggle conditional breakpoint<leader>dc- Continue to cursor<leader>dr- Restart debugging<leader>dR- Terminate debugging<leader>du- Toggle UI<leader>dh- Toggle breakpoint hint
<leader>tt- Run nearest test<leader>tT- Run current test file<leader>ta- Run all tests<leader>ts- Run test suite<leader>tl- Run last test<leader>tL- Debug last test<leader>tw- Run watch mode (Vitest)<leader>to- Open test output<leader>tp- Toggle output panel
<leader>sw- Search word under cursor<leader>sW- Search word under cursor (regex)<leader>sh- Search help<leader>sr- Replace word under cursor
<leader>xq- Quickfix list (Trouble)<leader>xL- Location list (Trouble)
-
Install UV (if not already installed):
curl -LsSf https://astral.sh/uv/install.sh | sh -
Initialize UV project (if starting a new project):
uv init my-project cd my-project uv sync # Creates .venv and installs dependencies
-
For existing projects:
# Ensure dependencies are synced uv sync
- LSP: Pyright (default) or Pylsp
- Formatting: Black, Ruff (auto-installed via Mason)
- Linting: Ruff, Mypy, Pylint, Flake8
- Testing: Pytest (via neotest-python)
- Debugging: debugpy
Autocomplete & LSP:
- Code completion appears automatically as you type
gd- Go to definitionK- Show documentation<leader>ca- Code actions (imports, quick fixes)
Formatting:
<leader>cf- Format file- Auto-format on save (enabled by default)
Linting:
- Errors and warnings appear inline
<leader>xx- View all diagnostics
Testing:
- Place cursor on a test function
<leader>tt- Run that test<leader>tT- Run all tests in current file<leader>ta- Run all tests in project<leader>tL- Debug test (sets breakpoints, etc.)
Debugging:
- Set breakpoint:
<leader>dbor click in the gutter - Start debugging:
<F5> - Use navigation keys:
<F2>(step over),<F3>(step into),<F4>(step out) - View variables in the debug UI
UV Integration:
- The configuration automatically detects UV-managed projects
- It uses
.venv/bin/pythonfrom your UV project - Works seamlessly with
uv syncanduv run - LSP, debugging, and testing all use the correct Python interpreter
Example workflow:
# 1. Create and sync UV project
uv init my-python-app
cd my-python-app
uv add pytest # Add dependencies
uv sync
# 2. Open in Neovim
nvim src/main.py
# 3. Start coding - LSP, formatting, and linting work automatically
# 4. Write tests and run with <leader>tt
# 5. Debug with <F5> after setting breakpoints-
Install compiler:
# macOS xcode-select --install # or brew install gcc # Linux (Ubuntu/Debian) sudo apt install build-essential gdb
-
Ensure cpptools is installed (via Mason - auto-installed)
- LSP: clangd
- Formatting: clang-format
- Debugging: cpptools (via DAP)
Autocomplete & LSP:
- Code completion appears automatically
gd- Go to definitionK- Show documentation
Formatting:
<leader>cf- Format file with clang-format- Auto-format on save (enabled by default)
Debugging:
-
Compile your program first:
g++ -g -o myprogram main.cpp
-
Start debugging:
<F5>- Select "Launch file" configuration- Enter path to executable when prompted
- Use
<F2>,<F3>,<F4>to step through code
-
Attach to running process:
- Start your program with gdbserver:
gdbserver localhost:1234 ./myprogram
- In Neovim:
<F5>→ Select "Attach to gdbserver :1234" - Enter executable path when prompted
- Start your program with gdbserver:
Debugging Configurations:
- Launch file: Debug a compiled executable
- Attach to gdbserver: Attach to a running process via gdbserver
Build Systems:
- For CMake projects, ensure
compile_commands.jsonis generated:cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON . - clangd will automatically use
compile_commands.jsonfor better IntelliSense
-
Install Node.js (via nvm recommended):
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash nvm install --lts nvm use --lts -
Initialize project (if starting new):
npm init -y # or yarn init -y # or pnpm init
-
For ESM (ECMAScript Modules) support:
# Add to package.json echo '"type": "module"' >> package.json # Or use .mjs/.mts extensions for individual files
-
Install Vitest (recommended testing framework):
npm install --save-dev vitest @vitest/ui # or yarn add -D vitest @vitest/ui # or pnpm add -D vitest @vitest/ui
-
Optional: Install tsx (for running TypeScript ESM files):
npm install --save-dev tsx
- LSP: TypeScript Language Server (tsserver) with ESM support
- Formatting: Prettier
- Linting: ESLint
- Testing: Vitest (primary), with full ESM support
- Debugging: js-debug-adapter (pwa-node) with ESM support
This configuration fully supports ESM projects:
-
Automatic detection: tsserver detects ESM based on:
package.jsonwith"type": "module".mjs/.mtsfile extensions- Import/export syntax
-
Module resolution: Configured for ESM import resolution
-
Type checking: Full TypeScript type checking for ESM modules
-
Debugging: Multiple debug configurations for ESM:
- Launch file (ESM) - Uses ts-node/esm loader
- Launch via tsx (ESM) - Uses tsx for direct ESM execution
- Launch file (CommonJS) - For CommonJS projects
Autocomplete & LSP:
- Code completion with TypeScript types (ESM-aware)
gd- Go to definitionK- Show documentation<leader>ca- Code actions (imports, fixes)- Inlay hints for types and parameters
Formatting:
<leader>cf- Format with Prettier- Auto-format on save (enabled by default)
- Prettier automatically handles ESM syntax
Linting:
- ESLint errors appear inline
<leader>xx- View all diagnostics- ESLint configured for ESM projects
Testing with Vitest:
Vitest is the primary testing framework and fully supports ESM:
<leader>tt- Run nearest test<leader>tT- Run current test file<leader>ta- Run all tests<leader>ts- Run test suite<leader>tl- Run last test<leader>tL- Debug last test (with breakpoints)<leader>tw- Run watch mode (auto-reruns on changes)<leader>to- Open test output<leader>tp- Toggle output panel
Vitest automatically detects:
- ESM modules via
package.json"type": "module" - TypeScript files (
.ts,.tsx,.mts) - Test files matching patterns:
*.test.{ts,tsx,js,jsx,mts,mjs}or*.spec.{ts,tsx,js,jsx,mts,mjs}
Example Vitest test:
// math.test.ts
import { describe, it, expect } from 'vitest'
import { add } from './math'
describe('math', () => {
it('should add two numbers', () => {
expect(add(1, 2)).toBe(3)
})
})Debugging:
-
Set breakpoint:
<leader>dbor click in the gutter -
Start debugging:
<F5>- Select one of:- "Launch file (ESM via tsx)" - Recommended for ESM projects (requires
tsxpackage) - "Launch file (ESM via node)" - Alternative ESM option (uses ts-node/esm loader)
- "Launch file (CommonJS)" - For CommonJS projects
- "Attach" - Attach to running Node process
- "Launch file (ESM via tsx)" - Recommended for ESM projects (requires
-
Use debug controls:
<F2>- Step over<F3>- Step into<F4>- Step out<F5>- Continue
Example workflow (ESM project):
# 1. Initialize ESM project
npm init -y
echo '"type": "module"' >> package.json
# 2. Install dependencies
npm install --save-dev vitest typescript @types/node
npm install --save-dev tsx # For debugging ESM
# 3. Create tsconfig.json
cat > tsconfig.json << EOF
{
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "node",
"esModuleInterop": true,
"strict": true
}
}
EOF
# 4. Create vitest.config.ts
cat > vitest.config.ts << EOF
import { defineConfig } from 'vitest/config'
export default defineConfig({
test: {
globals: true,
},
})
EOF
# 5. Open in Neovim
nvim src/index.ts
# 6. Code with full TypeScript + ESM support
# 7. Write tests, run with <leader>tt
# 8. Debug with <F5> → "Launch file (ESM via tsx)"CommonJS projects are also fully supported - use "Launch file (CommonJS)" debug configuration.
-
Install JDK:
# macOS brew install openjdk@17 # Linux (Ubuntu/Debian) sudo apt install openjdk-17-jdk
-
Set JAVA_HOME (if needed):
# macOS export JAVA_HOME=$(/usr/libexec/java_home -v 17) # Linux export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
-
Ensure Java LSP and debuggers are installed (via Mason - auto-installed)
- LSP: jdtls (Eclipse JDT Language Server)
- Debugging: java-debug-adapter
- Testing: java-test (JUnit)
Autocomplete & LSP:
- Full Java IntelliSense
gd- Go to definitionK- Show documentation<leader>ca- Code actions
Debugging:
-
Remote debugging setup:
- Start your Java application with debug flags:
java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 -jar myapp.jar
- Start your Java application with debug flags:
-
Attach debugger:
<F5>- Select "Debug (Attach) - Remote"- Debugger connects to
localhost:5005
-
Use debug controls:
<F2>- Step over<F3>- Step into<F4>- Step out
Project Structure:
- Works best with Maven or Gradle projects
- Ensure
pom.xml(Maven) orbuild.gradle(Gradle) is in project root
- Install Docker:
# macOS brew install --cask docker # Linux # Follow: https://docs.docker.com/engine/install/
- LSP: docker-langserver
- Syntax highlighting: Treesitter
Autocomplete & LSP:
- Code completion for Dockerfile commands
gd- Go to definition (if available)- Linting for Dockerfile syntax
Example Dockerfile:
FROM node:18
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
CMD ["node", "index.js"]- Install Terraform:
# macOS brew install terraform # Linux # Download from https://www.terraform.io/downloads
- LSP: terraform-ls
- Formatting: terraform fmt (disabled by default, use manually)
- Syntax highlighting: Treesitter
Formatting:
- Formatting on save is disabled by default
- Format manually:
:!terraform fmt - Or use:
<leader>cf(if enabled)
LSP:
- Code completion for Terraform resources
gd- Go to definition- Validation and syntax checking
Note: Auto-formatting is disabled to prevent Terraform from modifying your files automatically.
No additional setup required.
- LSP: jsonls
- Schema validation: JSON Schema Store
- Formatting: Disabled by default
Autocomplete:
- Schema-aware completion for
package.json,tsconfig.json, etc. - Validation against JSON schemas
Formatting:
- Formatting on save is disabled by default
- Format manually:
<leader>cf
-
Install Rust:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
-
Install rust-analyzer (via Mason - auto-installed)
- LSP: rust-analyzer (via Mason)
- Syntax highlighting: Treesitter
Autocomplete & LSP:
- Full Rust IntelliSense via rust-analyzer
gd- Go to definitionK- Show documentation- Code completion and error checking
Note: For full Rust support (formatting, debugging), consider adding the Rust LazyVim extra in lua/config/lazy.lua:
{ import = "lazyvim.plugins.extras.lang.rust" },-
Check if LSP server is installed:
- Type
:Masonto open Mason UI - Look for your language server (e.g.,
pyright,clangd) - Install if missing
- Type
-
Restart LSP:
:LspRestart- Restart LSP for current buffer:LspInfo- Show LSP status
-
Check LSP logs:
:LspLog- View LSP logs
-
Ensure debug adapter is installed:
- Type
:Mason - Install:
debugpy(Python),cpptools(C++),js-debug-adapter(JavaScript)
- Type
-
Check DAP configurations:
<F5>should show available configurations- If none appear, check
lua/plugins/nvim-dap.lua
-
Check formatter is installed:
:Mason- Install formatter (e.g.,black,prettier,clang-format)
-
Check file type:
- Some file types have formatting disabled (markdown, json, yaml, terraform)
- Check
lua/config/options.luaforautoformat_disabled_filetypes
-
Format manually:
<leader>cf- Format current buffer
-
Ensure UV project is synced:
uv sync
-
Check
.venvexists:ls -la .venv/bin/python
-
Restart Neovim after syncing UV project
-
Check test adapter is installed:
- For Python:
pytestshould be in your UV environment - For JavaScript/TypeScript:
vitestshould be installed
- For Python:
-
Check test file structure:
- Python: Tests should be named
test_*.pyor*_test.py - JavaScript/TypeScript: Vitest looks for
*.test.{ts,tsx,js,jsx,mts,mjs}or*.spec.{ts,tsx,js,jsx,mts,mjs}
- Python: Tests should be named
-
For ESM projects:
- Ensure
package.jsonhas"type": "module"for ESM support - Vitest automatically detects ESM via package.json
- Check
vitest.config.tsexists and is properly configured
- Ensure
- LazyVim Documentation
- Neovim Documentation
- UV Documentation
- Mason.nvim - LSP/DAP installer
init.lua- Entry pointlua/config/- Core configurationlazy.lua- Plugin manager setupkeymaps.lua- Custom keymapsoptions.lua- Neovim options
lua/plugins/- Plugin configurationspython.lua- UV helper functionspython-lsp.lua- Python LSP configurationnvim-dap.lua- Debugging configurationtest.lua- Testing configurationtrouble.lua- Diagnostics UIneo-tree.lua- File explorertelescope-fzf-native.lua- Fuzzy finder
See LICENSE file for details.