# tpope/vim-commentary

**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/tpope-vim-commentary).**

6,161 stars · 211 forks · Vim Script

## Links

- GitHub: https://github.com/tpope/vim-commentary
- Homepage: http://www.vim.org/scripts/script.php?script_id=3695
- awesome-repositories: https://awesome-repositories.com/repository/tpope-vim-commentary.md

## Description

This project is a Vim commenting plugin and language-aware commenter designed to apply file-type specific comment characters to source code. It functions as a text object extension that allows for the toggling of comment markers on selected lines or blocks of text.

The plugin utilizes Vim motions and ranges to determine the specific text to be modified, automating the process of adding or removing comment markers. It provides multi-language syntax support by automatically mapping comment characters based on the current file type.

Users can define custom comment characters for specific file types to ensure compatibility across different programming languages.

## Tags

### Part of an Awesome List

- [Commenting Workflows](https://awesome-repositories.com/f/awesome-lists/devtools/automation-and-workflow/commenting-workflows.md) — Provides an automated workflow for quickly adding or removing comment markers from blocks of code.
- [Pattern-Based Comment Removal](https://awesome-repositories.com/f/awesome-lists/devtools/regex-and-pattern-matching/pattern-based-comment-removal.md) — Identifies and strips leading comment characters by matching specific text patterns at the start of lines.

### Development Tools & Productivity

- [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 and override custom comment characters based on file type. ([source](https://github.com/tpope/vim-commentary/blob/master/README.markdown))
- [Motion-Based Selection](https://awesome-repositories.com/f/development-tools-productivity/motion-based-selection.md) — Uses standard Vim motions and visual selections to determine which lines of text to modify.
- [Vim Plugins](https://awesome-repositories.com/f/development-tools-productivity/vim-plugins.md) — Integrates with the Vim editor to provide text manipulation capabilities using motions and ranges.
- [Regexp-Based Text Injection](https://awesome-repositories.com/f/development-tools-productivity/regexp-based-text-injection.md) — Applies comment characters to the start of lines using regular expression substitutions.
- [Text Object Extensions](https://awesome-repositories.com/f/development-tools-productivity/vim-plugins/text-object-extensions.md) — Extends Vim's text object capabilities to allow manipulating blocks of text based on comment syntax rules.

### Programming Languages & Runtimes

- [Comment Toggling](https://awesome-repositories.com/f/programming-languages-runtimes/code-commenting/comment-toggling.md) — Functions as a language-aware system for toggling comment markers across various programming languages.
- [Filetype-Aware Syntax Support](https://awesome-repositories.com/f/programming-languages-runtimes/filetype-aware-syntax-support.md) — Automatically handles different comment characters for various programming languages based on the current file type.

### 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) — Implements mappings that associate specific filetypes with their corresponding comment delimiters.
