Saturday, June 27, 2015

Re: Auto-commenting

Jack Stratton <jack@phroa.net> [15-06-28 07:08]:
> Hi,
>
> On 2015-06-27 21:00, Meino.Cramer@gmx.de wrote:
> >Hi,
> >when using vim for editing Perl sources, vim proceeds
> >the next line with an comment sign '#', if the previous
> >one was a comment line using <RET> in insert mode.
> >To not to miss even one of the wonderful feature of vim ;) :
> >Suppose the situation is as follows (inser mode)
> > # this is a comment in perl _
> >and "_" is, where my coursor is, Now I want to start
> >coding in the next line. <RET> gives me a new line, but
> >with a "#" in front of it, which I need to delete.
> >Another way to get "commentless" to the next line would
> >be <ESC>o
> >Is there any other more elegant and/or shorter way to accomplish this?
> >Thanks a lot for any help in advance!
> >Best regards,
> >Meino
>
> I believe disabling the 'r' formatoption is what you want.
> See ":h formatoptions" for how to change them (and what they are), or
> ":h fo-table" to see all the available options.
>
> Here's an online copy:
> http://vimhelp.appspot.com/change.txt.html#fo-table
>
> 'r' is not set by default in vi(m), so I imagine your .vimrc has the
> option
> set and you simply forgot it was there ;)
>
> HTH,
> --
> Jack
>
> --
> --
> You received this message from the "vim_use" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php
>
> --- You received this message because you are subscribed to the Google
> Groups "vim_use" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to vim_use+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

Hi Jack,

thanks for reply and yout help! :)

I looked into my .vimrc and found

set formatoptions-=o

so, no "r" ist set. I dont want to switch of this feature completly.
My search was for a short and handy/elegant way to get into
the first code line from the last comment line.

Best regards,
Meino


--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: