Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Neovim
  3. format-on-save.nvim

format-on-save.nvim

MITLua

A Neovim plugin that automatically formats files on save using LSP or shell utilities like prettierd and shfmt.

GitHubGitHub
172 stars5 forks0 contributors

What is format-on-save.nvim?

format-on-save.nvim is a Neovim plugin that automatically formats code when files are saved, using either Language Server Protocol (LSP) formatters or shell utilities like prettierd and shfmt. It solves the problem of maintaining consistent code style without manual intervention, especially after the deprecation of tools like null-ls.

Target Audience

Neovim users who want automated, reliable code formatting integrated into their editor workflow, particularly those transitioning from null-ls or seeking a simple format-on-save solution.

Value Proposition

Developers choose this plugin for its straightforward synchronous approach, support for both LSP and shell formatters, and features like cursor restoration, avoiding the complexity and edge cases found in other formatting plugins.

Overview

Automatically formats files when saving using either LSP or shell utilities like prettierd or shfmt

Use Cases

Best For

  • Automatically formatting code on save in Neovim
  • Using both LSP and shell-based formatters (e.g., prettierd, shfmt) in a single plugin
  • Preserving cursor positions when editing the same file in multiple splits
  • Transitioning from null-ls for formatting needs
  • Configuring conditional formatters based on project files
  • Experimenting with partial buffer updates to preserve extmarks

Not Ideal For

  • Developers who need an actively maintained plugin with regular bug fixes and updates
  • Teams requiring asynchronous formatting to avoid editor blocking during slow formatter execution
  • Projects that rely on partial formatting or real-time formatting during editing, not just on save
  • Environments with very large files where synchronous formatting could cause noticeable hangs or delays

Pros & Cons

Pros

Reliable Synchronous Formatting

Ensures formatting completes before the file is saved, avoiding complex edge cases associated with asynchronous operations, as stated in the README's core principles.

Versatile Formatter Support

Supports LSP formatters, shell utilities like prettierd, custom Lua functions, and lazy-loaded formatters, allowing flexible configuration for different filetypes and projects.

Multi-Window Cursor Preservation

Automatically restores cursor positions across all windows displaying the current file, which is useful for split editing and enhances the user experience.

Configurable Error Handling

Allows customization of error notifications via built-in notifiers or custom implementations, such as using vim.notify for tailored error reporting.

Cons

Abandoned Project

The plugin is no longer maintained, as the author has switched to conform.nvim, leaving known bugs unfixed and no future updates, as highlighted in the README warning.

No Asynchronous Option

Forces all formatting to be synchronous, which can block the editor and cause delays with slower formatters, limiting flexibility for performance-sensitive workflows.

Incomplete Implementation

Missing planned features from the TODO list, such as file size limits, LSP timeout configuration, and better error handling for non-zero exit codes, reducing robustness.

Frequently Asked Questions

Quick Stats

Stars172
Forks5
Contributors0
Open Issues6
Last commit1 year ago
CreatedSince 2023

Tags

#formatting#developer-tools#text-editor#neovim-plugin#nvim-plugin#code-formatting#vim-plugins#nvim#lsp#formatter

Built With

N
Neovim
L
Lua

Included in

Neovim20.6k
Auto-fetched 18 hours ago

Related Projects

conform.nvimconform.nvim

Lightweight yet powerful formatter plugin for Neovim

Stars5,274
Forks302
Last commit2 months ago
neoformatneoformat

:sparkles: A (Neo)vim plugin for formatting code.

Stars2,047
Forks181
Last commit3 months ago
formatter.nvimformatter.nvim

Formatter.nvim is a Neovim plugin that runs external code formatters on your files. It provides a flexible and asynchronous way to format code across many languages, helping developers maintain consistent code style without leaving the editor. ## Key Features - **Asynchronous Execution** — Runs formatters in the background without blocking the editor. - **Buffer Locking** — Prevents modifications during formatting with lock commands. - **Opt-in Default Configurations** — Includes pre-built formatter setups for common filetypes that you can choose to use. - **Conditional Formatting** — Allows formatter configurations to include logic for when to run. - **Before/After Hooks** — Execute custom code before and after formatting via autocommands. - **Filetype-specific Setup** — Configure different formatters per filetype with ordered execution. ## Philosophy Formatter.nvim believes in providing a robust, non-blocking formatting experience while giving users full control over their configurations, avoiding assumptions about preferred tools.

Stars1,456
Forks145
Last commit1 year ago
guard.nvimguard.nvim

Lightweight, fast and async formatting and linting plugin for Neovim

Stars519
Forks26
Last commit5 months ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub