43
10
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 the HTML tags is not really within anything that I can use the i
function for.
1Am I the only one whose vim selects the opening tag with
vit
? It's been bothering me for years and have no idea why Vim does that. – Jonathan Dumaine – 2015-05-03T05:09:46.7772Note that you can also use both multiple times, eg.
vatat
– user1338062 – 2015-07-25T16:23:40.5002Perfect! 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 – 2010-08-30T02:48:43.617
You can also substitute
v
with many other commands, I often usec
toc
hange;>
and<
to fix indentation. – dukedave – 2012-04-19T17:24:32.570How do you select the tags as well? In this case the
<p>
tags. – hobbes3 – 2013-04-26T18:35:22.6738@hobbes3: To include the tags in the selection, use
vat
. I think ofit
as in a tag andat
as a tag. See:help at
. – garyjohn – 2013-04-26T19:07:33.850