📅 2014-Oct-31 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ replace, vim ⬩ 📚 Archive
The common command to search and replace text with confirmation in Vim is
:%s/old/new/c. But, this begins the search and replace operation from the beginning of the file. There might be times when you want to begin search and replace from the current line.
:%s/old/new/c is shortcut for
1,$, which means replace from first line to the last line. So, to search and replace from current line to end of file we can use
.,$. This can be shortened to
So, the command to search and replace from current line is
Tried with: Vim 7.4 and Ubuntu 14.04