Overview
conform.nvim provides fast, asynchronous code formatting with support for multiple formatters per filetype. All formatters must be installed globally. Configuration file:lua/plugins/formatter.lua:5
Installation
Events and commands
Loading behavior
Loading behavior
Keymaps
Manual formatting
Manual formatting
Format buffer - Manually formats the current buffer or visual selection
- Modes: Normal and Visual
- Async: true
- Description: “[F]ormat [B]uffer”
- Shows notification on successful format
Format-on-save
Automatic formatting
Automatic formatting
Maximum time (in milliseconds) to wait for formatting to complete. Aborts if exceeded.
Falls back to LSP formatting if no conform formatter is configured for the filetype.
Format-on-save runs synchronously with a 1-second timeout to ensure files are properly formatted before saving.
Formatter options
Biome conditional formatting
Biome conditional formatting
The
biome-check formatter only runs if a biome.json or biome.jsonc file exists in the project root.This prevents Biome from running in projects that don’t use it, improving performance.
Formatters by filetype
The configuration supports multiple formatters per filetype with fallback chains:- Lua
- C/C++
- JavaScript/TypeScript
- Web formats
- Config formats
- Documentation
- Go
- Shell scripts
- Docker
Uses stylua for Lua formatting.
Formatter chaining
The configuration uses two approaches for multiple formatters:Sequential execution
Sequential execution
Some filetypes run multiple formatters in sequence:This runs
goimports first, then gofumpt on the result.Fallback chain
Fallback chain
Other filetypes try formatters until one succeeds:This tries
biome-check first. If it doesn’t apply (no biome.json), it falls back to prettier.The
stop_after_first = true option prevents running subsequent formatters if the first one succeeds.Common commands
:ConformInfo- Show formatter status and configuration for current buffer<leader>fb- Manually format buffer or selection- Format-on-save is automatic (can be disabled per-buffer if needed)
Configuration options
Error notifications
Error notifications
Shows a notification if formatting fails.
Format expression
Format expression
The configuration sets Neovim’s This allows using
formatexpr option:gq motion for formatting with conform.nvim.Python formatters (
isort, black) are commented out in the configuration. Uncomment to enable Python formatting.