The plugin emmet provides the mapping
<C-y>j to split or join tags. The help section explains what emmet does when using this mapping:
12. Split/join tag *emmet-split-join-tag* *<C-y>j*
To join block, type '<C-y>j'.
cursor is here
Type '<C-y>j' in insert mode. Then,
<div class="foo" />
And type '<C-y>j' in there again.
Sometimes you have to modify many tags individually because you have to insert different content between the tags which makes a global substitution not perfect. However, a global substitution could still be the first step.
Following steps achieve the change described in the question:
Modify single tag
/<item to move to tag
<item ... />
text specific for this line<Esc>
n jump to next
<item which should be changed
Modify all lines and insert the same text everywhere
In this case I would use the
:substitute command similar to you. However, I want to show that it is also be possible to use the plugin in combination with
:normal (or with a macro not shown here). I assume that all
<item .../> are placed on separate lines
:g/item/exec "norm f<\<C-y>jcitsomething\<C-y>;text"
To format your xml source code, you can consider using
formatprg by placing following into
setlocal formatprg=tidy\ -xml\ -quiet\ --indent\ auto\ --tidy-mark\ no\ --indent-spaces\ 2\ --vertical-space\ yes
Now you can format the whole xml file afterwards with
Furthermore, if you like to combine
formatprg=tidy ... with
$VIMRUNTIME/indent/xml.vim, have a look at following question Automatically reindent lines filtered through formatprg.