Skip to content

Treesitter Comments

Treesitter Comments is a powerful plugin that uses treesitter to provide intelligent comment functionality for Neovim, making it easy to comment and uncomment code.

What Problem Does It Solve?

Traditional comment functionality in Neovim can be:

  • Limited in functionality
  • Not context-aware
  • Hard to use
  • Inconsistent across languages
  • Difficult to extend

How It Improves Productivity

  1. Intelligent Comments:

    • Context-aware commenting
    • Language-specific comments
    • Smart comment detection
    • Better accuracy
  2. Efficient Workflow:

    • Faster commenting
    • Better selection
    • Improved editing
    • Consistent behavior
  3. Advanced Features:

    • Custom comment styles
    • Pattern-based commenting
    • Context-aware comments
    • Extended operators

How to Use

Basic Usage

  • Use gc to comment/uncomment
  • Use gb to comment/uncomment block
  • Use gcc to comment/uncomment line
  • Use gbc to comment/uncomment block

Common Operations

  • Line comments
  • Block comments
  • Region comments
  • Nested comments

Integration

  • Works with treesitter
  • Compatible with LSP
  • Supports multiple languages
  • Works with snippets