I'd like to test the range pattern, same as Vim highlights the text while searching (e.g. :/), but for the range command instead.So in other words, instead of executing::/<head/,/\/head>/dI'd like to test only /<head/,/\/head>/ range pattern in form of highlight to check whether the pattern is correct, before I'm going to run any command on that range.Sample text to play with can be retrieved by: vim http://www.example.com/.
How to highlight a search range?
search;highlight;range
AIf you just want to quickly confirm the validity of the range (and it isn't too long), you can use the built-in :print or :number::/<head/,/\/head>/printBAnother idea would be (mis-)using the visual selection. The following custom command creates a linewise selection of the passed range::[range]SelectRange    Create a linewise visual selection of [range].command! -bar -range SelectRange execute normal! m' | call cursor(<line1>, 1) | execute 'normal! V' | call cursor(<line2>, 1):/<head/,/\/head>/SelectRangeCIf you really want some (semi-permanent) highlighting, you can use :match with one of the following custom commands:hi link Match Search:[range]MatchLines [{group}]           Highlight the lines in [range] with the Match group /           {group}. This only considers the line numbers, not their           contents.command! -bar -range -nargs=? MatchLines execute 'match' (empty(<q-args>) ? 'Match' : <q-args>) printf('/\%%>%dl\%%<%dl/', (<line1> - 1), (<line2> + 1)):[range]MatchRange [{group}]           Highlight the content of the lines in [range] with the           Match group / {group}. This considers the current           content of the lines (also elsewhere in the buffer).command! -bar -range -nargs=? MatchRange execute 'match' (empty(<q-args>) ? 'Match' : <q-args>) '/\V\^' . join(map(getline(<line1>, <line2>), 'escape(v:val, \\/)'), '\n') . '\$/'Clear with :match