Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to select the block of text between two tags (html, xml, ...) in vim?

Tags:

vim

select

I want to select the inner text between the xml tag. e.g., I want to select Default in this text:

<UserID>Default</UserID>

I know how to use Vi to select text in the quote and bracket delimiters (e.g., "", (), [], ...). I tried both Vi< and Vi>, and neither of them selected any text.

Is there any command to quickly do that?

like image 488
2power10 Avatar asked Jun 11 '13 08:06

2power10


1 Answers

In normal/command mode, type the commands vit while in the tag.

mnemonic: "visual in tag"

:help v
:help v_it (inner tag block)
:help text-objects

like image 80
hutchonoid Avatar answered Oct 20 '22 03:10

hutchonoid