go to first line and set the marker with mt ; go to the line till which you want range; issue the command :'t,.s/^/#/ Explanation. m#, where # denotes any letter, puts a marker at your current location. The location can later be referred to using '#, where # is the same letter as before. In our case we used the letter t

6927