From: Hugh Sasse Staff Elec Eng Date: 2001-11-17T04:55:48+09:00 Subject: [ruby-talk:25638] Re: /* */ comments On Sat, 17 Nov 2001, Ed L Cashin wrote: > > A decent text editor should provide a way to quickly comment out a > bunch of lines. emacs, e.g., has language-specific modes or you can > use the "string-rectangle" function. Just for balance :-) -- in vi you could use this: #!/usr/local/bin/ruby -w -p # Filter a file and comment out all the lines # This should be usable in vi[m] with the :[range]!comment.rb # or !{motion}comment.rb (etc) commands # Author: Hugh Sasse # # Created: 16-NOV-2001 # Last Modified: 16-NOV-2001 # $Revision: 1.1 $ # # add comments where there are none: gsub(/^(\s*)([^#])/, '\1# \2') unless /^\s*$/ #Hugh