Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is it possible to select an html tag's content in Vim? For example:

<p>I am a silly butterfly</p>

I would like to select "I am a silly butterfly"!

I know that you can use vi" to select text inside quotes, brackets, etc. The problem here is that the text inside html tags is not really within anything that I can use the i function for.

Thanks!

share|improve this question

1 Answer 1

up vote 33 down vote accepted

You can use vit to visually select text in a tag. See

:help v_it
share|improve this answer
    
Perfect! Gonna write a post about this in my blog, I couldn't find anything on Google with "Vim selecting html tag contents" and others. –  fholgado Aug 30 '10 at 2:48
    
You can also substitute v with many other commands, I often use c to change; > and < to fix indentation. –  dukedave Apr 19 '12 at 17:24
    
How do you select the tags as well? In this case the <p> tags. –  hobbes3 Apr 26 '13 at 18:35
3  
@hobbes3: To include the tags in the selection, use vat. I think of it as in a tag and at as a tag. See :help at. –  garyjohn Apr 26 '13 at 19:07
    
Ya, vat works. Thanks! –  hobbes3 Apr 26 '13 at 19:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.