Vim is a highly configurable text editor built to enable efficient text editing. It is an improved version of the vi editor distributed with most UNIX systems. Vim is often called a "programmer’s editor," and so useful for programming that many consider it an entire IDE. It’s not just for programmers, though. Vim is perfect for all kinds of text editing, from composing email to editing configuration files.

2019-05-09
Vim tips: The basics of search and replace

Let’s start by looking at searches and doing search and replace operations within Vim. You can do a search in normal mode by using /searchstring . This will search forward through the file for searchstring . Likewise, running ?searchstring will search backwards through the file. After running a search once, you can repeat it by using n in command mode, or N to reverse direction.

When you want to search for a string of text and replace it with another string of text, you can use the syntax :[range]s/search/replace/. The range is optional; if you just run :s/search/replace/, it will search only the current line and match only the first occurrence of a term.