Add namespace prefix to XML tags in Vim

It’s not perfect, but it works with tags that contain just a-z and dashes (the \([a-z-]*\) part):
:%s/<\(\/\?\)\([a-z-]*\)\(\s\|>\)/<\1namespace:\2\3/gc

Advertisements