Vim Tips Wiki
Register
Advertisement
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Tip 1153 Printable Monobook Previous Next

created 2006 · complexity basic · author Yakov Lerner · version 6.0


Some commands do not accept ranges, but you want to execute them for every line in the range.

This trick allows to apply the range to any command that does not accept range directly:

:n1,n2 g/^/ command

That is, you add g/^/ between the range and the command.

Comments

Advertisement