← All lessons

8. Searching

Step 4 of 7

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:

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

Let’s try this in the editor. There’s a special string hidden 300 lines above the NEEDLE in the editor. See if you can find it using a search offset!

Loading editor…