Re: [R] commenting out a block of R code

2012-05-07 Thread David L Carlson
riginal Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Ted Harding > Sent: Monday, May 07, 2012 2:27 AM > To: r-help@r-project.org > Subject: Re: [R] commenting out a block of R code > > In vim, first move to the top lin

Re: [R] commenting out a block of R code

2012-05-07 Thread Ted Harding
In vim, first move to the top line of the block. Then press Shift+V (i.e. upper-case V); this line will then be highlighted. Then move down (down-arrow key) to the bottom line of the block; the whole block will then be highlighted. At this stage enter :s/^/# / (The "g" in Don's sequence is not n

Re: [R] commenting out a block of R code

2012-05-06 Thread Ranjan Maitra
Hi Joshua and Don, Thanks very much! I guess I can now see why one could do that using the editor, but I like Joshua's hack suggestion. I did not think about it:-( Best wishes, Ranjan On Sun, 6 May 2012 19:41:01 -0700 Joshua Wiley wrote: > Hi Ranjan, > > To me, this is really a text editor

Re: [R] commenting out a block of R code

2012-05-06 Thread Don McKenzie
in vi (vim too?), in edit mode :a,bs/^/# /g inserts "# " at the beginning of lines a through b On 6-May-12, at 7:41 PM, Joshua Wiley wrote: Hi Ranjan, To me, this is really a text editors job. Feature-rich editors make it trivial, for example in Emacs, you can select a region (whatever siz

Re: [R] commenting out a block of R code

2012-05-06 Thread Joshua Wiley
Hi Ranjan, To me, this is really a text editors job. Feature-rich editors make it trivial, for example in Emacs, you can select a region (whatever size you want) and M-x comment-region automatically comments every line in that region. Similarly M-x uncomment-region will uncomment every line. If

[R] commenting out a block of R code

2012-05-06 Thread Ranjan Maitra
Dear friends, Is there an easy way of commenting out a block of R code after it has been written? (I am aware that R-aware editors can insert # line-by-line while it is being written, but I want to basically block out chunks of R code in a few strokes.) This question was asked on this mailing li