sponsor Vim development Vim logo Vim Book Ad

The NERD Commenter : A plugin that allows for easy commenting of code for many filetypes.

 script karma  Rating 563/192, Downloaded by 8313

created by
Marty Grenfell
 
script type
utility
 
description
NOTE: As of version 2.1.4 the script requires vim7.

Issue tracker: http://code.google.com/p/nerdcommenter/issues/list

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.

,cc |NERDComComment|
Comments out the current line or text selected in visual mode.

,cn |NERDComNestedComment|
Same as |NERDComComment| but forces nesting.

,c<space> |NERDComToggleComment|
Toggles the comment state of the selected line(s). If the topmost selected
line is commented, all selected lines are uncommented and vice versa.

,cm |NERDComMinimalComment|
Comments the given lines using only one set of multipart delimiters if
possible.

,ci |NERDComInvertComment|
Toggles the comment state of the selected line(s) individually. Each selected
line that is commented is uncommented and vice versa.

,cs |NERDComSexyComment|
Comments out the selected lines ``sexually''

,cy |NERDComYankComment|
Same as |NERDComComment| except that the commented line(s) are yanked
before commenting.

,c$ |NERDComEOLComment|
Comments the current line from the cursor to the end of line.

,cA |NERDComAppendComment|
Adds comment delimiters to the end of line and goes into insert mode between
them.

,cI |NERDComPrependComment|
Adds comment delimiters to the start of line and goes into insert mode between
them.

<C-c> |NERDComInsertComment|
Adds comment delimiters at the current cursor position and inserts between.

,ca |NERDComAltDelim|
Switches to the alternative set of delimiters.

,cl OR ,cr OR ,cb |NERDComAlignedComment|
Same as |NERDComComment| except that the delimiters are aligned down the
left side (,cl), the right side (,cr) or both sides
(,cb).

,cu |NERDComUncommentLine|
Uncomments the selected line(s).

Filetypes that can be commented by this plugin:
abaqus abc acedb ada ahdl amiga aml ampl ant apache apachestyle asm68k asm asn
aspvbs atlas autohotkey autoit automake ave awk basic b bc bdf bib bindzone bst
btm caos catalog c cfg cg ch changelog cl clean clipper cmake conf config
context cpp crontab cs csc csp css cterm cupl csv cvs dcl debchangelog
debcontrol debsources def diff django docbk dns dosbatch dosini dot dracula dsl
dtd dtml dylan ecd eiffel elf elmfilt erlang eruby eterm expect exports
fetchmail fgl focexec form fortran foxpro fstab fvwm fx gdb gdmo geek
gentoo-package-keywords' gentoo-package-mask' gentoo-package-use' gnuplot gtkrc
haskell hb h help hercules hog html htmldjango htmlos ia64 icon idlang idl
indent inform inittab ishd iss ist jam java javascript jess jgraph jproperties
jproperties jsp kconfig kix kscript lace lex lftp lifelines lilo lisp lite
lotos lout lprolog lscript lss lua lynx m4 mail make maple masm master matlab
mel mf mib mma model moduala.  modula2 modula3 monk mush muttrc named nasm
nastran natural ncf netdict netrw nqc nroff nsis ocaml occam omlet omnimark
openroad opl ora otl ox pascal passwd pcap pccts perl pfmain php phtml pic pike
pilrc pine plaintex plm plsql po postscr pov povini ppd ppwiz procmail progress
prolog psf ptcap python python qf radiance ratpoison r rc readline rebol
registry remind rexx robots rpl rtf ruby sa samba sas sather scheme scilab
screen scsh sdl sed selectbuf sgml sgmldecl sgmllnx sicad simula sinda skill
slang sl slrnrc sm smarty smil smith sml snnsnet snnspat snnsres snobol4 spec
specman spice sql sqlforms sqlj sqr squid st stp strace svn systemverilog tads
taglist tags tak tasm tcl terminfo tex text plaintex texinfo texmf tf tidy tli
trasys tsalt tsscl tssgm uc uil vb verilog verilog_systemverilog vgrindefs vhdl
vim viminfo virata vo_base vrml vsejcl webmacro wget winbatch wml [^w]*sh
wvdial xdefaults xf86conf xhtml xkb xmath xml xmodmap xpm2 xpm xslt yacc yaml
z8a
 
install details
***NOTE***: In version 2.0.0 the script file and help file were renamed to NERD_commenter.vim and NERD_commenter.txt.
If you are upgrading from version < 2.0.0 to version >= 2.0.0 then you must delete the old files NERD_comments.vim and
NERD_comments.txt.

Stick it in the plugin directory. The help doc should be installed when you next run vim. If it isnt then you can find it at the bottom of the script.
 

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
NERD_commenter.vim 2.1.6 2007-10-25 7.0 Marty Grenfell - 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.
NERD_commenter.vim 2.1.5 2007-10-12 7.0 Marty Grenfell - 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.
NERD_commenter.vim 2.1.4 2007-09-29 7.0 Marty Grenfell - 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
NERD_commenter.vim 2.1.3 2007-08-27 6.0 Marty Grenfell - 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.
NERD_commenter.vim 2.1.2 2007-08-22 6.0 Marty Grenfell Added support for the vera and ldif filetypes. Thanks to Normandie
Azucena and Florian Apolloner for the emails.
NERD_commenter.vim 2.1.1 2007-08-18 6.0 Marty Grenfell - 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.
NERD_commenter.vim 2.1.0 2007-08-08 6.0 Marty Grenfell - 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.
NERD_commenter.vim 2.0.7 2007-07-22 6.0 Marty Grenfell Added support for eclass and ebuild filetypes. Thanks to Alex Tarkovsky
for the email.
NERD_commenter.vim 2.0.6 2007-06-29 6.0 Marty Grenfell - 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.
NERD_commenter.vim 2.0.5 2007-06-16 6.0 Marty Grenfell - 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.
NERD_commenter.vim 2.0.4 2007-05-11 6.0 Marty Grenfell - 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.
NERD_commenter.vim 2.0.3 2007-05-03 6.0 Marty Grenfell - Added dummy support for the csv filetype (thx to Mark Woodward for the
  email)
- Added dummy support for vo_base and otl filetypes (thanks to fREW for
  the email)
NERD_commenter.vim 2.0.2 2007-04-13 6.0 Marty Grenfell Minor bug fix that was stopping nested comments from working
NERD_commenter.vim 2.0.1 2007-04-12 6.0 Marty Grenfell - 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
NERD_commenter.vim 2.0.0 2007-04-02 6.0 Marty Grenfell - NOTE: renamed the script to  NERD_commenter.vim. When you install this
  version you must delete the old files: NERD_comments.vim and
  NERD_comments.txt.
- 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
  details):
    - 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
      ways)
    - Some have been removed altogether, namely: NERD_create_h_filetype
      (why was a commenting script creating a filetype?!),
      NERD_left_align_regexp, NERD_right_align_regexp,

- 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\)"
  filetypes.
- 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
information.
NERD_comments.vim 1.69.2 2007-01-25 6.0 Marty Grenfell Added dummy support for the qf (quickfix filetype). This stops the script from spitting out the "unknown filetype" message when you go :copen.

Thanks to Ilia N Ternovich for emailing me about this.
NERD_comments.vim 1.69.1 2007-01-18 6.0 Marty Grenfell *fixed the mark clobbering that was occuring.

*added support for the following filetypes: netdict, bib, bst, passwd, omlet and kconfig. Thanks to Michael Brunner, Antono Vasiljev, Melissa Reid and Tim Carey-Smith for telling me about these filetypes (hope i didnt miss anyone)
NERD_comments.vim 1.69 2006-09-08 6.0 Marty Grenfell fixed a bug when initializing vb comment delimiters (cheers to boesi for pointing it out). Added support for the following filetypes: debsources, eruby, xhtml and yaml. Added "dummy" support for the following filetypes: netrw, svn, taglist, and the null filetype. These filetypes have no comment delimiters but now that NERD knows about them it doesnt complain anymore.
NERD_comments.vim 1.68 2006-08-13 6.0 Marty Grenfell Added an option called NERD_mapleader which allows you to change the two keys that all the mappings begin with by default. This will allow users to change all mappings easily so they dont conflict with any other plugins. Thanks to Tim Carey-Smith and Gary Church whose complaints prompted me to make this option :)
NERD_comments.vim 1.67 2006-05-18 7.0 Marty Grenfell Replaced the NERD_dont_create_menu_shortcut option with NERD_menu_mode. This new option allows the user to specify 1) whether a comment menu should be made and 2) whether this menu should have <alt>-c as a shortcut. Go :help NERD_menu_mode for more info. Thanks to Joseph Barker for the sugesting that the menu should be an optional feature.

Added suppport for plaintex, context and mail filetypes (when commenting a "mail" file "> " is used as the left delimiter so that the commented text appears as quoted text in the email). Thanks to Jonathan Derque for emailing me with these filetypes.
NERD_comments.vim 1.66 2006-04-18 6.0 Marty Grenfell Applied a patch that Norick Chen emailed to me that fixed the asp delimiters (which were wrong and caused an error)

Thanks Norick :)

NERD_comments.vim 1.65 2006-04-11 6.0 Marty Grenfell Made minimal comments use the NERD_place_holder_regexp option. Now if place holders are needed but are disabled for the current filetype then the minimal comment is aborted. Thanks to Stefano Zacchiroli emailing me and prompting this change.

Fixed a minor bug with minimal comments.
NERD_comments.vim 1.64 2006-04-09 6.0 Marty Grenfell Refactored the code a bit and removed the NERD_use_toggle_coms_default and
NERD_use_sexy_coms_default_regexp options. Now you have to adjust the key
mappings to achieve the same effects as these options

Sexy comments now always use the c style delimiters if they are available (even if another set of multipart delims is available) because they generally look the best.

Fixed a bug that occured when using the tabs in vim7 (thanks to Harry for pointing it out:).

Added a new commenting type called "minimal" comments where a SINGLE set of multipart delimiters is used to comment out a bunch of lines. Go :help NERD_com-minimal-comment for details. Thanks to Stefano Zacchiroli for this suggestion.

Fixed some random little bugs.
NERD_comments.vim 1.63 2006-02-12 6.0 Marty Grenfell fixed a bug that was stopping the NERD_space_delim_filetype_regexp option from working with left aligned toggle comments. Thanks to boesi for pointing this out.
NERD_comments.vim 1.62 2006-01-17 6.0 Marty Grenfell Fixed 2 bugs that caused problems when uncommenting sexy comments. Thanks to Torsten Blix for emailing me about them.
NERD_comments.vim 1.61 2006-01-14 6.0 Marty Grenfell Applied a patch sent to me by Eike Von Seggern that fixed a bug that caused a space to be added to the end of the line when commenting with single-part delimiters.
NERD_comments.vim 1.60 2006-01-10 6.0 Marty Grenfell Added a new option that turns off the NERD_comments menu shortcut (Alt-c) which could interfere with other (Non-NERD)  mappings. Thanks to Nguyen for pointing out this problem :)
NERD_comments.vim 1.59 2005-10-25 6.0 Marty Grenfell fixed a small bug that was causing problems with spaces around delimiters.
NERD_comments.vim 1.58 2005-10-24 6.0 Marty Grenfell fixed a bug that could be a problem when changing buffers. Thanks to David Bourgeois for pointing it out.
NERD_comments.vim 1.57 2005-10-21 6.0 Marty Grenfell Fixed a retarded bug when commenting c files (thanks to David  Bourgeois for pointing it out).
Changed the NERD_dont_remove_spaces option to NERD_dont_remove_spaces_regexp and made it take a regular expression. Go :help NERD_dont_remove_spaces_regexp for details. Put a section in the help file that gives some examples of regular expressions that  you may want to use for some of the options. Go :help NERD_com-reg-exps for details.
NERD_comments.vim 1.56 2005-10-01 6.0 Marty Grenfell Tweaked the behaviour of the "toggle comment" mapping: now if you are commenting a range (with toggle comments) and  you have the NERD_use_nested_comments_default option turned on it will comment the already comment lines again. Cheers to Igor Prischepoff for this suggestion. I also reorgansied the help page and added some stuff to make it more readable :)
NERD_comments.vim 1.55 2005-09-14 6.0 Marty Grenfell made the \ci mapping work with whole lines line the \c<space> mapping does i.e the mapping only counts a line as commented if it commented from the start of the line.
Fixed a couple of silly bugs
NERD_comments.vim 1.54 2005-09-13 6.0 Marty Grenfell Fixed the \cn mapping that i broke in the last version. Thanks to harry for pointing that out.
Changed the behaviour of toggle comments: now lines are only counted as commented if they are commented from the beginning of the line. Thanks to Igor Prischepoff for suggesting this. I applied a patch by Richard (Krischikm) which fixed a couple of bugs and added a new option (see :help NERD_use_ada_with_spaces for details). I changed how the script handles tabs: now each line is examined individually instead of using examining the &expandtabs option and assuming it applies to every line. The script should not interfere with the tabbing style of any file you edit now... even if they alternate between soft and hard tabs with each line :).  Stopped the cursor jumping when the \cu mapping is used.
NERD_comments.vim 1.53 2005-09-12 6.0 Marty Grenfell Made some changes to how spaces around comments are removed when uncommenting... basically they are always removed unless the new option NERD_dont_remove_spaces is set. Go :help NERD_dont_remove_spaces for details. I added this functionality because i usually dont have NERD_comments adding spaces after/before the left/right delimiters but when im editing code written by people who DO it makes me insane because it is uncommented incorrectly.  Fixed the cursor and screen jumping bugs... hopefully :)
NERD_comments.vim 1.52 2005-09-06 6.0 Marty Grenfell Fixed an error in the help file. Added support for // comments in c. Made an option to turn these // comments on by default (go :help NERD_use_single_part_c_comments for details). Thanks to Richard Willis whose feedback prompted these changes :)
NERD_comments.vim 1.51 2005-09-05 6.0 Marty Grenfell Added yet another mapping (<leader>ci) which inverts the commented state of every selected line. i.e. for each line selected, if it is commented it is uncommented and vice versa. Thanks to Nick Brettell for the idea. Improved the cursor positioning after commenting is done so if you do a visual comment the cursor returns to a better position. Removed some line continuations that were screwing up on some systems. Thanks to Richard for pointing that out to me.
NERD_comments.vim 1.50 2005-08-31 6.0 Marty Grenfell Added a new mapping <leader>c<space> that toggles the comment state of the selected lines. It uncomments all the lines if the first line is commented and comments them otherwise. The mapping can be changed with this option: NERD_com_line_toggle_map. Toggle commenting can be made the default commenting method (so it applied when <leader>cc is pressed) with this option: NERD_use_toggle_coms_default. Thanks to Igor Prischepoff for the idea :)
NERD_comments.vim 1.49 2005-08-30 6.0 Marty Grenfell Fixed a bug that was causing problems when the ignorecase option in vim was set. Thanks to Brent Rice for telling me about this problem and helping me track the bug down :)
NERD_comments.vim 1.48 2005-08-28 6.0 Marty Grenfell Fixed a bug with sexy comments that was stopping them from working when you were using the alternative set of delimiters for some languages (eg c/java/etc)
NERD_comments.vim 1.47 2005-08-25 6.0 Marty Grenfell Fixed bugs with sexy comments (most of the bugs were only an issue when using compact sexy comments): Now they work properly if they end on a blank line. When uncommenting sexy comments the display window doesnt jump anymore. If the sexy comment starts or ends on another ordinary  comment it no longer screws up. Sexy comments no longer delete parts of lines (which they did from time to time). Blank lines above compact sexy comments are no longer removed when uncommenting.
Fixed another bug with the <C-c> mapping.
NERD_comments.vim 1.46 2005-07-17 6.0 Marty Grenfell enhanced the option: NERD_comment_whole_lines_in_v_mode so that it can now take 2 values. Go :help NERD_comment_whole_lines_in_v_mode for an explaination. Thanks to jorge scandaliaris for emailing me with his criticism about this :)
NERD_comments.vim 1.45 2005-07-14 6.0 Marty Grenfell Now the script doesnt create a seperate filetype for h files unless  you tell it to with a new option called NERD_create_h_filetype. Go :help NERD_create_h_filetype for more info.
This update was done to prevent NERD_comments from  screwing with the taglist plugin.

Thanks to Markus Erlmann for pointing out that it caused problems.
NERD_comments.vim 1.44 2005-07-06 6.0 Marty Grenfell Fixed a bug with the <C-c> mapping after i broke it (again :().
Thanks to Martin Stubenschrott for pointing this bug out!
NERD_comments.vim 1.43 2005-06-30 6.0 Marty Grenfell Fixed a bug with visual commenting.
Added a new option, go :help NERD_comment_whole_lines_in_v_mode for details. Thanks to  jorge scandaliaris and  Shufeng Zheng for their suggestions about this.
NERD_comments.vim 1.42 2005-06-26 6.0 Marty Grenfell Now, when any visual comments are made, the cursor is placed at the top left line/col of the visual selection block after the comment is done instead of on the top line at the first col. Thanks to Nick Brettell for complaining about this.

Added support for .geek files hahahaha
NERD_comments.vim 1.41 2005-06-16 6.0 Marty Grenfell fixed a small bug with the <C-c> functionality when the script is configured to put extra spaces between the delimiters.
NERD_comments.vim 1.40 2005-05-18 6.0 Marty Grenfell Fixed a bug that was screwing up place holders with nested commenting when NERD_use_nested_comments_default option is set. Changed the left and right default place holders because the strings that were being used were sort of common in c/c++/java/... files. If you liked them the way they were you can just set them back with the NERD_lPlace and NERD_rPlace options.
Thanx to Nick for complaining about the place holders and spotting the other bug :P
NERD_comments.vim 1.39 2005-05-15 6.0 Marty Grenfell Fixed a retarded bug with the <C-c> mapping.
Changed the <leader>ce mapping to have a default mapping of <leader>cA and added a new mapping that adds a comment delimiter to the start of the current line and inserts between the delimiters - the default mapping is <leader>cI (thats an uppercase i not a lowercase L).
Fixed a bug that caused the script to spaz out if you tried to comment a file with no filetype.
NERD_comments.vim 1.38 2005-05-13 6.0 Marty Grenfell Added new functionality for when text is commented in normal visual mode (i.e not visual-block or visual-line). Now Nerd_comments comments out exactly the text that is selected in visual mode regardless of the type of visual mode you are in.
Thanks to Nick Brettell his ideas about this!

Also, if you are commenting out text in visual or visual-block mode, NERD_comments will use multip-part delimiters is they are available so that the exact text that was selected will be exactly what is commented out - a new option has been added to turn off this behaviour (go :help NERD_allow_any_visual_delims_regexp for details).

Fixed a couple of small bugs with the <C-c> mapping that prolly on one even noticed :P



NERD_comments.vim 1.37 2005-05-09 6.0 Marty Grenfell Added a new mapping/menu item:
Now when <leader>ce is pressed a comment is appended to the EOL and the cursor gets put in insert mode in the appropriate place to type the comment.

Thanks to Litchi for emailing me with this idea :)

NERD_comments.vim 1.36 2005-05-08 6.0 Marty Grenfell added lots more supported filetypes
NERD_comments.vim 1.35 2005-05-04 6.0 Marty Grenfell Added support for some new filetypes.
Fixed a small bug with sexy comments.
Fixed a bug with tabs that was not too serious but would screw up commenting of things like makefiles in a big way. Cheers to Nick Brettell for pointing this bug out!
NERD_comments.vim 1.34 2005-04-29 6.0 Marty Grenfell Add support for a couple more filetypes. Thanks to Sam R for emailing me about them!
NERD_comments.vim 1.33 2005-04-29 6.0 Marty Grenfell added a new mapping/menuItem that yanks the current line or selected text before commenting it out. This is handy if you wanna experiment with a piece of code... u just comment out the code and put a copy underneath it that you experiment on.
NERD_comments.vim 1.32 2005-04-25 6.0 Marty Grenfell now,  if the current filetype matches NERD_use_sexy_coms_default_regexp then sexy comments will only be used if you are commenting more than one line with <leader>cc... i thought sexy comments on one line looked retarded. Of course you can still do one line sexy comments with <leader>cs
NERD_comments.vim 1.31 2005-04-25 6.0 Marty Grenfell Added a new option called NERD_use_sexy_coms_default_regexp. This option is used to tell NERD_comments to use sexy comments for certain filetypes by default when <leader>cc is pressed.

Now if you edit a filetype that the script doesnt know about the warning it echos isnt so "loud"

Thanks to Nguyen for suggesting these changes.
NERD_comments.vim 1.30 2005-04-22 6.0 Marty Grenfell Have finally implemented "sexy" comments. Go :help NERD_com_sexy_commenting to see what they are... i cant even be stuffed explaining.

There is an option to make your sexy comments compact and use up less lines, go :help NERD_use_compact_sexy_com_regexp.

Thanks to Nguyen for the idea... sorry it took so long dude :P
NERD_comments.vim 1.29 2005-04-18 6.0 Marty Grenfell There are a couple of new options to tell NERD_comments to always left align, right align or both align, comment delimiters when commenting multiple lines in visual mode. Go :help NERD_left_align_regexp, :help NERD_right_align_regexp. If the current filetype matches one or both of these regular expressions then hitting <leader>cc will automatically align the delimiters.

There are comment mappings/menu items which can be used to do aligned comments for any filetype. The mappings are <leader>cl <leader>cr and <leader>cb for left, right and both aligned comments respectively. These mappings and menu items assume that the comments will be nested if need be.

Now, when uncommenting lines, the script looks for left and right delimiters separately so for eg: if you uncomment a line with one right delimiter on it (but no left delim) then it will still be removed.

Fixed a couple of minor bugs.
NERD_comments.vim 1.28 2005-04-12 6.0 Marty Grenfell Added a menu with menu items for each of the scripts key mappings.
Refactored the code a bit.
Now, if  you edit a filetype that vim doesnt know about the script wont crap out.
Added support for a couple more filetypes.
NERD_comments.vim 1.27 2005-04-06 6.0 Marty Grenfell a few bug fixes
NERD_comments.vim 1.26 2005-04-05 6.0 Marty Grenfell Removed an echoerr that i forgot to remove from last release...
NERD_comments.vim 1.25 2005-04-04 6.0 Marty Grenfell Updated comment recognition heuristics. Modified the place holder system a bit so it is better. Did some refactoring to simplify the code a bit. Fixed some random bugs
NERD_comments.vim 1.24 2005-04-01 6.0 Marty Grenfell Fixed some bugs with place holders.

Parameterised some of the place holder stuff to make it more customisable. There are now 3 more options: NERD_lPlace, NERD_rPlace and NERD_place_holder_regexp. These options are used to control the strings that are used as place holders and to specify the filetypes NERD_comments will use place holders for. Go :help and the name of each option for more info

Now when a line is uncommented, the outtermost delimiters are removed regardless of whether they are the alternative delimiters for that filetype or not
NERD_comments.vim 1.23 2005-04-01 6.0 Marty Grenfell Added support for place holders when nesting comments with left AND right delimiters.
Now if you go <leader>cn on a line of already commented code (eg: /* int foo */), the current delimiters will be swapped for place holders so the example line will become: /*[+ int foo +]*/ where [+ and +] are the place holders.
Also, i fixed a pretty major bug with visual-block commenting
NERD_comments.vim 1.22 2005-03-28 6.0 Marty Grenfell Fixed the syntax highlighting probs with h files.

There is a new option which is used to place a space after the left delimiter and before the right delimiter. The option is set to a regular expression and any filetypes that match this expression have the aforementioned spaces added when commenting. Go :help NERD_space_delim_filetype_regexp for details.

Thanks to Nguyen for pointing these emailing me about these things!!

NERD_comments.vim 1.21 2005-03-26 6.0 Marty Grenfell fixed some bugs.
added support for more filetypes
NERD_comments.vim 1.20 2005-03-26 6.0 Marty Grenfell did some refactoring

added support for more filetypes
NERD_comments.vim 1.19 2005-03-24 6.0 Marty Grenfell If the filetype is unkown to the script it now looks at &commentstring to get the comment delimiters for that filetype
NERD_comments.vim 1.18 2005-03-23 6.0 Marty Grenfell Block commenting is done automatically now... if you select some text in visual-block mode and go <leader>cc it will  behave the same as if you pushed <leader>cb before.

Similarly, if you select some text with visual-block mode and go <leader>cn it wll behave as if you had pushed <leader>cB

the <leader>cb and <leader>cB mappings have now been removed cos they are redundant

The comment recognition heuristics have been updated a little bit so NERD_comments is now a bit better at recognising comment delimiters
NERD_comments.vim 1.17 2005-03-23 6.0 Marty Grenfell block commenting is much better now
NERD_comments.vim 1.16 2005-03-21 6.0 Marty Grenfell umm, the script has been changed a lot...
- the keymappings and options are different and there is waaaay more of them
- there is now way more functionality provided by the script
- there is a help file that is self-installing and fully contained in the script (i stole the installation function from the vimspell plugin (thx vimspell!!))
- the internals of the script are a bit more sophisticated in the way they recognise comments (they have to be cos of the new functionality) but it is not perfect at recognising comment delimiters (infact it only uses a set of heuristics)
NERD_comments.vim 1.15 2005-03-15 6.0 Marty Grenfell Changed the guts of the script a bit.

Now the imap for <C-c> is done automatically which means that adding support for commenting another language is really easy and takes just one line!

Haskell and lisp are now supported

There is a new function that is designed to handle programming languages with more than one commenting style which is a bit of a hack but works well.

Theres another option NERD_use_c_style_prolog_comments
NERD_comments.vim 1.14 2005-03-09 6.0 Marty Grenfell Did a bit of refactoring... no functionality changes.

Thanks to Matthew Hawkins for pointing out the code repitition :P
NERD_comments.vim 1.13 2005-03-07 6.0 Marty Grenfell - added a new option: NERD_use_c_comments_for_h_files. This option is needed cos
  h files are used with c files which only allow /**/ comments, but they are also
  used with c++/c# which allow // comments which are illegal in c
                                                                                                                                                                                    
- the option NERD_use_slash_star_java_cpp_comments now affects c# files as well.
  This means that c# files are now commented like c++/java files
                                                                                                                                                                                    
- added a new autocommand which sets the filetype to h if we enter a buffer with
  an h file in it. This was needed cos some versions of vim dont seem to have an h
  filetype. Some versions of vim treat h files as cpp files which screws everything up!!!
NERD_comments.vim 1.12 2005-03-06 6.0 Marty Grenfell Fixed a bug with forced commenting (<leader><leader>c)
NERD_comments.vim 1.11 2005-03-05 6.0 Marty Grenfell Some minor bug fixes and improvements
NERD_comments.vim 1.10 2005-03-03 6.0 Marty Grenfell An additional mapping has been added:
<leader><leader>c will now comment out the selected lines and will force nested commenting (provided the comment style has no right delimiter - to avoid compiler errors). Note that if the option NERD_allow_nested_comments is set then <leader>c performs this behaviour anyway...
NERD_comments.vim 1.09 2005-03-01 6.0 Marty Grenfell - there is a new option NERD_allow_nested_comments which will allow nested comments provided that there is no right delimiter for that commenting style. This should prevent nested commenting errors.

eg. the option will allow nested // style java comments (which will not produce compiler errors) but will not allow nested /* */ style c comments (which would cause compiler errors).
The reason this feature has been added is the following: Say that you have commented out an entire function which already has comments in it... when you uncomment out the function, errors will result because of the comments that were already there that have been uncommented. This way those comments will become nested comments and the function will be exactly as it was before you commented it.

- the option NERD_double_slash_java_comments has been changed to NERD_use_star_slash_java_cpp_comments. Now, when editing java/c++ file  // style comments are used by default unless this option is set. This is to make it easier for ppl who want to use the nested comments option as well...
NERD_comments.vim 1.08 2005-03-01 6.0 Marty Grenfell - Massive refactoring which has significantly reduced the size of the script
- Corrections to some of the comment delimiters used
- also the filetype event used in the auto commands that turn on the mappings has been capitalised to FileType to fix a problem with some versions of vim
- version number is now in the script

All of this was done by Matthew Hawkins... THANK YOU VERY MUCH !!! :)
NERD_comments.vim 1.07 2005-02-28 6.0 Marty Grenfell - Now, when commenting lines of code, lines that are already commented out are not commented again
- when commenting code, blank lines (or lines containing only spaces and/or tabs) are not commented
- an option has been added which lets you have // style java comments instead of /* */ java comments just stick 'let NERD_double_slash_java_comments=1' in your vimrc
NERD_comments.vim 1.06 2005-02-27 6.0 Marty Grenfell Now the left comment delimiter is placed in the position that the leftmost character occupies instead of at the start of the line. This means that indenting is preserved
NERD_comments.vim 1.05 2005-02-27 6.0 Marty Grenfell fixed bug for removing comment delimiters

added support for shite loads more filetypes
NERD_comments.vim 1.04 2005-02-26 6.0 Marty Grenfell The functions that turn on the comment mappings are now local to the script
NERD_comments.vim 1.03 2005-02-26 6.0 Marty Grenfell Now the comment mappings are loaded automatically.
NERD_comments.vim.gz 1.02 2005-02-25 6.0 Marty Grenfell fixed some bugs. Comments now work for c. Also the hlsearch option is not potentially changed when the comment mappings are used
NERD_comments.vim.gz 1.01 2005-02-25 6.0 Marty Grenfell err, various corrections to comments
NERD_comments.vim.gz 1 2005-02-25 6.0 Marty Grenfell Initial upload

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Sponsored by Web Concept Group Inc. SourceForge.net Logo