Steve Bertrand <[email protected]> [09-12-09 04:16]:
> Hi all,
>
> Here's a simple one I can't quite figure out.
>
> I've done a search/replace throughout a file, and thanks to my regex
> carelessness, I've wrecked lines I didn't intend to touch.
>
> I know how to fix this with another :%s///g, but I've always wondered
> and never figured out how to use the 'dt' command to remove everything
> between 'here' and the second instance of 'there'. For example:
>
> my $sanity = ISP::Sanity->new({ new({ config => 'ISP.conf-dist' }) });
>
> How do I 'dt', and del from ^ that parens, to......................^
> that one?
>
> Thanks, and cheers ;)
>
> Steve
>
> --
> You received this message from the "vim_use" maillist.
> For more information, visit http://www.vim.org/maillist.php
>
Hi Steve,
'dt' is a little more """complicated""" in this case as another
command I want to suggest you. But first what you have asked for:
my $sanity = ISP::Sanity->new({new({ config => 'ISP.conf-dist' }) });
I suppose, your cursor is at the beginning of the line. Then you have
to jump to the beginning of the area you want to delete
f{l
f: jump onto the following character which in this case is:
{: the character
then do a
d2t)
d: delete everything which will be touched by the next movement of the
cursor
2: jump using the SECOND occurence of the given character
t: dont jump onto (as 'f') do but in front of the give character
): finally the "given character" himself
This is a little more """complicated""" since you have to count ')'s
first.
The alternative way to accomlish the same is (cursor again at the
beginning of the line)
f(dib
f: jump onto the given character which is
(:
d: delete all characters touched by the next movement
ib: the "inner block" surrounded by ()
If you want to read more abnout that try
:h text-objects
Have a nice day!
mcc
--
Please don't send me any Word- or Powerpoint-Attachments
unless it's absolutely neccessary. - Send simply Text.
See http://www.gnu.org/philosophy/no-word-attachments.html
In a world without fences and walls nobody needs gates and windows.
--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php