commentary.vim - Comment stuff out; takes a motion as a target : vim online

sponsor Vim development Vim logo Vim Book Ad
not logged in (login)



commentary.vim : Comment stuff out; takes a motion as a target

script karma Rating 906/418, Downloaded by 6465 Comments, bugs, improvements Vim wiki

created by
script type
utility
description
Comment stuff out. Use gcc to comment out a line (takes a count), gc to comment out the target of a motion (for example, gcap to comment out a paragraph), and gc in visual mode to comment out the selection. That's it.

I wrote this because 5 years after Vim added support for mapping an operator, I still couldn't find a commenting plugin that leveraged that feature (I overlooked vimscript #1173). Striving for minimalism, the first version weighs in at just 35 lines of code.

Oh, and it uncomments, too. The above maps actually toggle, and `gcu` uncomments a set of adjacent commented lines. Install repeat.vim, vimscript #2136, to enable repeating with . the line commenting map gcu. (The other maps are repeatable without it.)

https://github.com/tpope/vim-commentary
install details
You know the drill.
rate this script Life Changing Helpful Unfulfilling
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
commentary.zip 1.3 2016年02月11日 7.0 Tim Pope Provide :Commentary command.
Provide gc text object.
Support comments with no leading space.
Preserve whitespace in b:commentary_format.
Allow disabling backslash maps.
Fix count with linewise map.
Don't trigger modelines after commenting.
Deprecation warnings.
commentary.zip 1.2 2014年03月10日 7.0 Tim Pope Switch official interface from \\ to gc. \\ still works.
Allow overriding 'commentstring' with b:commentary_format.
Add User CommentaryPost callback.
commentary.zip 1.1 2011年08月28日 7.0 Tim Pope Smarter indentation handling.
Always pad with whitespace.
Support nesting: /* /1* abc *1/ */.
Support custom maps.
commentary.zip 1.0 2011年08月20日 7.0 Tim Pope Initial upload
ip used for rating: 40.74.122.252

Questions about Vim should go to the maillist. Help Uganda. Vim at Github

AltStyle によって変換されたページ (->オリジナル) /