The NERD Commenter : A plugin that allows for easy commenting of code for many filetypes.
| script karma
Downloaded by 65537
Comments, bugs, improvements
script versions (upload new version)
|Grab the latest dev version from github: https://github.com/scrooloose/nerdcommenter.
The following key mappings are provided by default (there is also a menu
provided that contains menu items corresponding to all the below mappings):
Most of the following mappings are for normal/visual mode only. The
|NERDComInsertComment| mapping is for insert mode only.
Comment out the current line or text selected in visual mode.
Same as <leader>cc but forces nesting.
Toggles the comment state of the selected line(s). If the topmost selected
line is commented, all selected lines are uncommented and vice versa.
Comments the given lines using only one set of multipart delimiters.
Toggles the comment state of the selected line(s) individually.
Comments out the selected lines ``sexily''
Same as <leader>cc except that the commented line(s) are yanked first.
Comments the current line from the cursor to the end of line.
Adds comment delimiters to the end of line and goes into insert mode between
Adds comment delimiters at the current cursor position and inserts between.
Disabled by default.
Switches to the alternative set of delimiters.
Same as |NERDComComment| except that the delimiters are aligned down the
left side (<leader>cl) or both sides (<leader>cb).
Uncomments the selected line(s).
|The NERD Commenter requires Vim 7 or higher.
Extract the plugin files in your ~/.vim (*nix) or ~/vimfiles (Windows). You
should have 2 files:
Next, to finish installing the help file run:
See |add-local-help| for more details.
Make sure that you have filetype plugins enabled, as the script makes use of
|'commentstring'| where possible (which is usually set in a filetype plugin).
See |filetype-plugin-on| for details, but basically, stick this in your vimrc
filetype plugin on
Click on the package to download.
ip used for rating:
||- remove all filetypes which have a &commentstring in the standard vim runtime
for vim > 7.0 unless the script stores an alternate set of delimiters
- make the script complain if the user doesnt have filetype plugins enabled
- use <leader> instead of comma to start the default mappings
- fix a couple of bugs with sexy comments - thanks to Tim Smart
- lots of refactoring
||- remove the NERDShutup option and the message is
suppresses, this makes the plugin silently rely on
&commentstring for unknown filetypes.
- add support for dhcpd, limits, ntp, resolv, rgb, sysctl,
udevconf and udevrules. Thanks to Thilo Six.
- match filetypes case insensitively
- add support for mp (metapost), thanks to Andrey Skvortsov.
- add support for htmlcheetah, thanks to Simon Hengel.
- add support for javacc, thanks to Matt Tolton.
- make <%# %> the default delims for eruby, thanks to tpope.
- add support for cucumber and pdf. Fix sass and railslog
delims, thanks to tpope
||- add support for newlisp and clojure, thanks to Matthew Lee Hinman.
- fix automake comments, thanks to Elias Pipping
- make haml comments default to -# with / as the alternative delimiter,
thanks to tpope
- add support for actionscript and processing thanks to Edwin Benavides
- add support for ps1 (powershell), thanks to Jason Mills
- add support for hostsaccess, thanks to Thomas Rowe
- add support for CVScommit
- add support for asciidoc, git and gitrebase. Thanks to Simon Ruderich.
- use # for gitcommit comments, thanks to Simon Ruderich.
- add support for mako and genshi, thanks to Keitheis.
- add support for conkyrc, thanks to David
- add support for SVNannotate, thanks to Miguel Jaque Barbero.
- add support for sieve, thanks to Stefan Walk
- add support for objj, thanks to Adam Thorsen.
||- rewrote the mappings system to be more "standard".
- removed all the mapping options. Now, mappings to <plug>
mappings are used
- see :help NERDComMappings, and :help
NERDCreateDefaultMappings for more info
- remove "prepend comments" and "right aligned comments".
- add support for applescript, calbire, man, SVNcommit,
potwiki, txt2tags and SVNinfo. Thanks to nicothakis,
timberke, sgronblo, mntnoe, Bernhard Grotz, John O'Shea,
François and Giacomo Mariani respectively.
- bugfix for haskell delimiters. Thanks to mntnoe.
||- add support for llvm. Thanks to nicothakis.
- add support for xquery. Thanks to Phillip Kovalev.
- fixed haskell delimiters (hackily). Thanks to Elias
- add support for mailcap. Thanks to Pascal Brueckner.
- add support for stata. Thanks to Jerónimo Carballo.
- applied a patch from ewfalor to fix an error in the help
file with the NERDMapleader doc
- disable the insert mode ctrl-c mapping by default, see
:help NERDComInsertComment if you wish to restore it
||compatibility fix for vim7.2, cheers to Ben Schmidt, David Fishburn, and
Erik Falor for the emails, and to JaGoTerr for posting the issue.
||- added pamconf support, thanks to Martin Kustermann
- added mason support, thanks to Indriği Einarsson
- added map support, thanks to Chris
- added bzr support, thanks to Stromnov
- added group support, thanks to Krzysztof A. Adamski
- change license to wtfpl
||- added support for gitconfig, tar, nerdtree
- added support for dtrace, thanks to nicothakis for the post
|| - added support for rib, pyrex/cython, liquid, services, gitcommit,
vimperator, and slice. Thanks to spookypeanut, Greg Jandl, Christophe
Benz, A Pontus, and Stromnov for emailing me and/or posting issues.
- set the NERDRemoveExtraSpaces option to 1 by default as the doc states
- other fixes: (thanks to Zhang Shuhan for all his emails and testing)
* made the sexy comment mapping fall back to normal commenting if sexy
comments arent possible for the current filetype
* fixed some bugs with sexy comments
* made the uncommenting side of toggle comments slightly more robust
* fixed a bug where some extra spaces werent being removed (although
the currect options were set)
||- added support for patran and dakota, thx to Jacobo Diaz for the email
- added support for gentoo-env-d, gentoo-init-d, gentoo-make-conf, grub, modconf and sudoers filetypes, thx to Li Jin for the patch.
- added support for SVNdiff, gitAnnotate, gitdiff. Thx to nicothakis for posting the issue
||- fixed a bug with the selection option and visual commenting (again). Thanks to Ingo Karkat (again).
||- added support for Wikipedia (thanks to Chen Xing)
- added support for mplayerconf
- bugfixes (thanks to Ingo Karkat for the bug report/patch)
- added support for mkd (thanks to Stefano Zacchiroli)
||- added support for mrxvtrc and aap, thx to Marco for the emails
- added dummy support for SVNAnnotate, SVKAnnotate and CVSAnnotate, thx to nicothakis for posting the issue
||- fixed a couple of bugs with the NERDSpaceDelims option, thx to David Miani and Jeremy Hinegardner
- added dummy support for lhaskell, thx to pipp for posting the issue
- added an alternative set of delims for the plsql filetype, thx to Kuchma Michael
- added support for spectre, thx to Brett Warneke
- added support for scala, thx to Renald Buter
- added support for asymptote, thx to Vladimir Lomov
- made NERDDefaultNesting enabled by default as this seems more intuitive, thx to marco for the suggestion
||- added support for gentoo-conf-d thanks to tinoucas for posting the issue and the patch
- added support for the D filetype. Thanks to Greg Weber for the email.
- added dummy support for cobol, cheers to timberke for posting the issue.
- added support for velocity. Thanks to Bruce Sherrod for the email.
||- added support for lilypond, bbx and lytex. Thanks to Eyolf Østrem for the email.
- added an alterative set of delimiters for the dosbatch filetype, thanks to Ingo Karkat for the email.
- added support for the markdown filetype. Thanks to Nicolas Weber for posting the issue.
||- added support for the ahk filetype. Cheers to Don Hatlestad for the email.
- added support for desktop and xsd filetypes. Thanks to Christophe Benz.
- added dummy support for Rails-log
- fixed a bunch of bugs in the comment delimiter setup process, thanks to Cheng Fang for the email :D
- hardcore refactoring and removal of seldomly used, overly-complex functionality
- the script now requires vim 7
||- fixed numerous bugs that were causing tabs to permanently be converted to spaces, even if noexpandtab was set. Thanks to Heptite on #vim for working with me to track them down :)
- added dummy support for "lookupfile". Thanks to David Fishburn for the email.
- added support for "rst", thanks to Niels Aan de Brugh for the email.
||Added support for the vera and ldif filetypes. Thanks to Normandie
Azucena and Florian Apolloner for the emails.
||- added dummy support for SVNcommitlog and vcscommit. Thanks to John O'Shea for the email.
- added support for Groovy. Thanks to Jason Mills for the email.
||- now the script resets the delimiters when the filetype of the buffer changes (thanks to James Hales for the patch)
- added formal support/doc for prepending a count to many of the commenting maps so you can go, eg, 5,cc to comment 5 lines from normal mode. Thanks again to James Hales for the patch.
- added support for the "gams" filetype that Jorge Rodrigues created.
- added support for the "objc" filetype, thanks to Rainer Müller for the email.
- added support for the "sass" filetype that Dmitry Ilyashevich created.
||Added support for eclass and ebuild filetypes. Thanks to Alex Tarkovsky
for the email.
||- Changed the default setting of NERDMapleader to ",c", meaning all the maps now start with ,c instead of \c. This is to stop a major mapping clash with the vcscommand plugin. Anyone wanting to keep the \c map leader should read :help NERDMapleader.
- Added support for debcontrol and dummy support for debchangelog filetypes, thanks to Stefano Zacchiroli for the email.
- Made it so that the NERDShutUp option now only controls the "Pleeease email the delimiters..." requests. It no longer affects the general output of the script.
- Simplified the names of the help tags.
||- Added support for autoit, autohotkey and docbk filetypes (thanks to Michael Böhler)
- Added support for cmake (thanks to Aaron Small)
- Added support for htmldjango and django filetypes (thanks to Ramiro Morales)
- Improved the delimiters for eruby again
- Applied a patch from Seth Mason to fix some pathing issues with the help file installation.
||- Added support for verilog_systemverilog and systemverilog filetypes
(Thanks to Alexey for the email)
- Added support for fstab, thanks to Lizendir for the email.
- Added support for the smarty filetype.
- Improved the delimiters for eruby.
- Added dummy support for changelog filetype.
||- Added dummy support for the csv filetype (thx to Mark Woodward for the
- Added dummy support for vo_base and otl filetypes (thanks to fREW for
||Minor bug fix that was stopping nested comments from working
||- Fixed the visual bell for the |NERDComToEOLMap| map.
- Added another possible value to the NERDMenuMode option which causes the
menu to be displayed under 'Plugin -> Comment'. See :h NERDMenuMode.
This new menu mode is now the default.
- Added support for the occam filetype (thanks to Anders for emailing me)
- Made the main commenting function (NERDComment) available outside the
script. See :h NERD_com_NERDComment
- bug fixes and refactoring
||- NOTE: renamed the script to NERD_commenter.vim. When you install this
version you must delete the old files: NERD_comments.vim and
- Reworked the mappings and main entry point function for the script to
avoid causing visual-bells and screen scrolling.
- Changes to the script options (see |NERD_com-Customisation| for
- They are all camel case now instead of underscored.
- Converted all of the regular expression options into simple boolean
options for simplicity.
- All the options are now stated positively, eg.
NERD_dont_remove_spaces_regexp has become NERDRemoveExtraSpaces.
- Some of the option names have been changed (other than in the above
- Some have been removed altogether, namely: NERD_create_h_filetype
(why was a commenting script creating a filetype?!),
- Removed all the NERD_use_alt_style_XXX_coms options and replaced them
with a better system. Now if a filetype has alternative delims, the
script will check whether an option of the form
"NERD_<&filetype>_alt_style" exists, and if it does then alt delims will
be used. See |NERD_com-cust-delims| for details.
- The script no longer removes extra spaces for sexy comments for the
NERDRemoveExtraSpaces option (it will still remove spaces if
NERDSpaceDelims is set).
- Added dummy support for viminfo and rtf.
- Added support for the "gentoo-package-\(keywords\|mask\|use\)"
- Added '#' comments as an alternative for the asm filetype
Thanks to Markus Klinik and Anders for bug reports, and again to Anders
for his patch. Thanks to John O'Shea and fREW for the filetype