Thursday, April 1, 2010

Re: Search & Replace

On Thu, 1 Apr 2010, Kunal Bajpai wrote:

> I have been using Vim for about 3-4 months and am a student web
> developer. I am still learning Vim and need help with a command. I am
> editing some web pages using web pages many a times I have to edit web
> pages. Here is what I want:
>
> ______________________________
> <p>Mike
> Gilbert
> Senior</p>
> _____________________________
>
> I need a command that selects the whole html code including the
> newline character.

Tim gave you one possible answer, with how to match it with a pattern.

Often more useful are the 'tag block' motions.

e.g. with the cursor anywhere inside your example HTML, you can type

'dat' in normal mode to 'd'elete 'a' 't'ag. (includes the <p> and </p>)
'dit' in normal mode to 'd'elete 'i'nner 't'ag. (just inside the tags)

the 'at' and 'it' are the motions. 'd' is just one example command that
takes a motion. Other particularly useful ones, 'y'ank, 'v'isually-select.

:help tag-blocks
:help {motion}

--
Best,
Ben

--
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

To unsubscribe, reply using "remove me" as the subject.

No comments:

Post a Comment