# numtostr/comment.nvim

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/numtostr-comment-nvim).**

4,589 stars · 170 forks · Lua · mit

## Links

- GitHub: https://github.com/numToStr/Comment.nvim
- awesome-repositories: https://awesome-repositories.com/repository/numtostr-comment-nvim.md

## Topics

`comment` `comment-plugin` `hacktoberfest` `lua` `neovim` `neovim-lua` `neovim-plugin` `nvim` `plugin` `treesitter`

## Description

Comment.nvim is a Neovim plugin for toggling line and block comments in code. It uses a language-aware syntax resolver to determine the correct comment characters based on the active buffer's filetype and a text-object commenting engine to apply these changes across specific code regions using motions.

The plugin features a hook-based action pipeline that executes user-defined pre and post callbacks around core buffer modification operations. It supports Tree-Sitter syntax detection to handle embedded languages within a single file and allows for the definition of custom comment syntax for unsupported file types.

The system provides capabilities for inserting, toggling, and repeating comment operations, including pattern-based line exclusion. It manages these actions through a stateful command stack to enable the immediate re-execution of the most recent comment or uncomment operation.

## Tags

### Development Tools & Productivity

- [Comment Toggling Utilities](https://awesome-repositories.com/f/development-tools-productivity/comment-toggling-utilities.md) — Toggles comments on and off for selected lines or blocks using code-aware movement commands. ([source](https://github.com/numToStr/Comment.nvim/tree/master/doc/))
- [Comment Syntax Customization](https://awesome-repositories.com/f/development-tools-productivity/comment-formatting-utilities/structured-comment-management/comment-syntax-customization.md) — Allows users to define custom comment delimiters for unsupported programming languages or file types. ([source](https://cdn.jsdelivr.net/gh/numtostr/comment.nvim@master/README.md))
- [Commenting Engines](https://awesome-repositories.com/f/development-tools-productivity/commenting-engines.md) — Implements distinct logic paths for applying either linewise or blockwise comment styles based on user selection.
- [Language-Aware Syntax Resolvers](https://awesome-repositories.com/f/development-tools-productivity/language-aware-syntax-resolvers.md) — Determines the correct comment characters based on the filetype of the active Neovim buffer.
- [Neovim Plugins](https://awesome-repositories.com/f/development-tools-productivity/neovim-plugins.md) — Provides an integrated commenting solution specifically for the Neovim text editor.
- [Text Buffer Manipulations](https://awesome-repositories.com/f/development-tools-productivity/text-buffer-manipulations.md) — Directly modifies the editor buffer content using Lua API calls to insert or remove comment delimiters.
- [Text-Object Commenting](https://awesome-repositories.com/f/development-tools-productivity/text-object-selection/text-object-commenting.md) — Toggles comments for specific code regions using cursor motions and text objects like paragraphs or brackets.
- [Comment Action Pipelines](https://awesome-repositories.com/f/development-tools-productivity/action-execution-pipelines/comment-action-pipelines.md) — Executes user-defined pre and post callbacks around core buffer modification operations to allow behavior extension.
- [Command Re-execution](https://awesome-repositories.com/f/development-tools-productivity/command-history-managers/command-re-execution.md) — Enables the immediate re-execution of the most recent comment operation by storing its parameters in a stateful stack.
- [Comment Insertion Utilities](https://awesome-repositories.com/f/development-tools-productivity/comment-insertion-utilities.md) — Adds a new comment line before or after the current line and automatically enters edit mode. ([source](https://cdn.jsdelivr.net/gh/numtostr/comment.nvim@master/README.md))
- [Comment Mode Selection](https://awesome-repositories.com/f/development-tools-productivity/comment-mode-selection.md) — Supports both linewise and blockwise commenting depending on the user command or visual mode selection.
- [Language-Specific Configurations](https://awesome-repositories.com/f/development-tools-productivity/language-specific-configurations.md) — Allows the definition of custom comment delimiters for programming languages not automatically recognized.
- [Repeatable Comment Operations](https://awesome-repositories.com/f/development-tools-productivity/repeatable-comment-operations.md) — Stores the parameters of the most recent comment action to facilitate immediate re-execution.

### Operating Systems & Systems Programming

- [Buffer Modification Engines](https://awesome-repositories.com/f/operating-systems-systems-programming/file-i-o-management/buffered-text-reading/plugin-buffer-access/buffer-modification-engines.md) — Employs a dedicated engine to apply insert, toggle, and uncomment actions by directly editing the buffer text.

### Software Engineering & Architecture

- [Comment Syntax Mappings](https://awesome-repositories.com/f/software-engineering-architecture/syntax-tree-analysis/language-syntax-parsers/filetype-mappings/comment-syntax-mappings.md) — Resolves language-specific comment characters at runtime by looking up the buffer filetype in a configuration map.
- [Pipeline Lifecycle Hooks](https://awesome-repositories.com/f/software-engineering-architecture/pipeline-lifecycle-hooks.md) — Provides a hook-based pipeline to run user-defined callbacks before and after each comment operation.
- [Embedded Language Detection](https://awesome-repositories.com/f/software-engineering-architecture/syntax-tree-analysis/embedded-language-detection.md) — Uses Tree-Sitter syntax tree analysis to determine the correct comment markers for embedded languages within a file. ([source](https://cdn.jsdelivr.net/gh/numtostr/comment.nvim@master/README.md))

### Part of an Awesome List

- [Commenting Utilities](https://awesome-repositories.com/f/awesome-lists/devtools/commenting-utilities.md) — Powerful commenting with motion support.
