finds.dev← search

// the find

tpope/vim-commentary

★ 6,171 · Vim Script · updated Oct 2024

commentary.vim: comment stuff out

A tiny Vim plugin that adds a single toggling operator for commenting/uncommenting code, respecting Vim's built-in 'commentstring' setting per filetype. Built for Vim (and Neovim) users who want line/motion/visual commenting without a heavier plugin.

Under 100 lines of Vim Script, so there's basically nothing to break or audit. Uses Vim's native operator-pending mapping mechanism (`gc{motion}`) instead of inventing its own key handling, which makes it compose naturally with counts, text objects, and `.` repeat. Toggling is symmetric — the same mapping comments and uncomments, and `gcgc` cleans up a block of adjacent comment lines, so you don't need separate mappings to remember.

Filetype support depends entirely on Vim/Neovim's built-in `commentstring`, so anything obscure or misconfigured needs a manual autocmd fix documented only in the README FAQ, not the plugin itself. No support for language-specific comment styles that need more than a single format string (e.g. languages where inline vs. block commenting differ meaningfully). Last pushed October 2024 with no recent activity — it's feature-complete by design, but also means don't expect fixes if Vim's operator semantics ever shift. No tests in the repo, though the surface area is small enough that this matters less than it would for most plugins.

View on GitHub → Homepage ↗

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →