Wednesday, September 25, 2013

Re: Something to wrap a selection

Paul Isambert <zappathustra@free.fr> writes:

[...]

>> It will look like this when done and I've removed the one comment
>> to let the new rule work
>>
>> # Keywords: Replace old rule with new experimental rule
>> # [Keydate:130922_214226 0 - Sun Sep 22, 2013
>> # This is the default setting because blah blah blah
>> # more blah blah blah blah blah
>> # current rule in rc file
>> New rule replacing line above
>> # &&
>
> ... how is the "current rule in rc file" identified as an old code
> line to be commented? Here I'll assume it is the last but one line,
> following your example, but I suppose it's quite unlikely that it will
> always be so. The ":MarkChange" command should be called while the
> region to be processed is selected; it could be modified so it is
> called on the old code (to be commented) and then find the limits of
> the entire region by itself (e.g. with blank lines).

Thanks for the input, I'm just getting started trying to understand
and use your suggestions.

It's going to sound horribly lame, but I'm already stuck just trying
to call the function you wrote.
This isn't the way, I can see
:markchange <press enter> NOT

So how is it called?

Also I'm afraid I was not very clear about what I'm after. So
explaining a bit further.

I didn't expect the code to try to identify anything special in the
selected section, like an uncommented line. Just to comment it all
after asking me for Keywords.

A typical entry in a rc file with some helpful commented lines might
look like:

# helpful info
# commented value

Then I might add

# helpful info
# commented value
uncommented value

Then I would select those three lines, call my handy wrapping code
which would first prompt for keywords, then insert what I gave
it along with the commented word `Keywords:' like:

# Keywords: prompted words

then Todays date

# [todays date]

next - it would comment every thing selected:

# # helpful info
# # commented value
# uncommented value

And finally the closing symbol

# &&

So the end result would be:

# Keywords: prompted words
# [todays date]
# # helpful info
# # commented value
# uncommented value

Last step... I would manually uncomment the line I wanted:

# Keywords: prompted words
# [todays date]
# # helpful info
# # commented value
uncommented value

(Sorry if this seems a bit over the top... but wasn't able to make
clear what I was after and my example was actually incorrect too.)
------- --------- ---=--- --------- --------


--
--
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/groups/opt_out.

No comments: