Step 4 of 7

8. Searching

Search offsets

Sometimes, the line that you’re actually looking for is a few lines above or below the line that you’re searching for. If this is the case, you can use a search offset to change where you’ll land.

There are two types of search offsets: line offsets and character offsets. Line offsets are generally more useful, so we’ll focus on them for now. For line offsets, there are two things to remember:

  • prefixing your search with /+10 will offset your search by ten lines downwards
  • prefixing your search with /-10 will offset your search by ten lines upwards

For example, to land ten lines above the next line containing NEEDLE, you’d type /NEEDLE/-10, followed by enter, in normal mode.

Work through the checklist below. There’s a special string hidden 300 lines above the NEEDLE in the editor — find the needle first, then use a search offset to land right on the treasure.

  1. Find the needle You'll land on the lone NEEDLE line — type /NEEDLE and hit Enter.
  2. Search again with a line offset The treasure sits 300 lines above the needle — type /NEEDLE/-300 and hit Enter to land right on it.
Find the needle You'll land on the lone NEEDLE line — type /NEEDLE and hit Enter.

Next: Search again with a line offset

Loading editor…