Tech and travel

Substituting from this line to the end of the file (in Vim)

2007-08-07

In vim, if you want to change something from the current line until the end of the line, you can use .,$ as the range segment of the s command.

:.,$s/COMPILE/COMPILE BODY/g

Substituting over the full file is done by using the % range, which is a shortcut for 1,$, ie from the first to the last line.

:%s/COMPILE/COMPILE BODY/g

Copyright (c) 2024 Michel Hollands