Ranges with Offsets

range expressions can contain offsets, which define the number of lines above or below the preceding expression. If no expression is given, then the offset is taken relative to the current line.

Offsets are specified using either "+" or "-" followed by an optional number indicating the number of lines to add or subtract. If no number is specified, then 1 line is assumed.

Let's take a look at a few examples:

The range of lines from 2 rows above the current line, to 3 lines below it:

:-2,+3
Prior to Execution
"When·someone·is·searching,"·said·Siddhartha,·"then·it·might·easily
happen·that·the·only·thing·his·eyes·still·see·is·that·what·he·searches
for,·that·he·is·unable·to·find·anything,·to·let·anything·enter·his
mind,·because·he·always·thinks·of·nothing·but·the·object·of·his·search,
because·he·has·a·goal,·because·he·is·obsessed·by·the·goal.·Searching
means:·having·a·goal.·But·finding·means:·being·free,·being·open,·having
no·goal.·You,·oh·venerable·one,·are·perhaps·indeed·a·searcher,·because,
striving·for·your·goal,·there·are·many·things·you·don't·see,·which·are
directly·in·front·of·your·eyes."
COMMAND
40%
4:1
:-2,+3yank a
After Execution
"When·someone·is·searching,"·said·Siddhartha,·"then·it·might·easily
happen·that·the·only·thing·his·eyes·still·see·is·that·what·he·searches
for,·that·he·is·unable·to·find·anything,·to·let·anything·enter·his
mind,·because·he·always·thinks·of·nothing·but·the·object·of·his·search,
because·he·has·a·goal,·because·he·is·obsessed·by·the·goal.·Searching
means:·having·a·goal.·But·finding·means:·being·free,·being·open,·having
no·goal.·You,·oh·venerable·one,·are·perhaps·indeed·a·searcher,·because,
striving·for·your·goal,·there·are·many·things·you·don't·see,·which·are
directly·in·front·of·your·eyes."
NORMAL
40%
4:1
6 lines yanked into "a
Confirm Register Content
"When·someone·is·searching,"·said·Siddhartha,·"then·it·might·easily
happen·that·the·only·thing·his·eyes·still·see·is·that·what·he·searches
for,·that·he·is·unable·to·find·anything,·to·let·anything·enter·his
mind,·because·he·always·thinks·of·nothing·but·the·object·of·his·search,
because·he·has·a·goal,·because·he·is·obsessed·by·the·goal.·Searching
means:·having·a·goal.·But·finding·means:·being·free,·being·open,·having
no·goal.·You,·oh·venerable·one,·are·perhaps·indeed·a·searcher,·because,
striving·for·your·goal,·there·are·many·things·you·don't·see,·which·are
directly·in·front·of·your·eyes."
NORMAL
40%
4:1
 
:reg a
Type Name Content
  l  "a   happen that the only thing his eyes still see is that what he searche

Offsets can also be combined with other expressions. For example, the range containing all lines between the current line to the 1 line from the bottom:

:.,$-1
Prior to Execution
"When·someone·is·searching,"·said·Siddhartha,·"then·it·might·easily
happen·that·the·only·thing·his·eyes·still·see·is·that·what·he·searches
for,·that·he·is·unable·to·find·anything,·to·let·anything·enter·his
mind,·because·he·always·thinks·of·nothing·but·the·object·of·his·search,
because·he·has·a·goal,·because·he·is·obsessed·by·the·goal.·Searching
means:·having·a·goal.·But·finding·means:·being·free,·being·open,·having
no·goal.·You,·oh·venerable·one,·are·perhaps·indeed·a·searcher,·because,
striving·for·your·goal,·there·are·many·things·you·don't·see,·which·are
directly·in·front·of·your·eyes."
COMMAND
40%
4:1
:.,$-1yank b
After Execution
"When·someone·is·searching,"·said·Siddhartha,·"then·it·might·easily
happen·that·the·only·thing·his·eyes·still·see·is·that·what·he·searches
for,·that·he·is·unable·to·find·anything,·to·let·anything·enter·his
mind,·because·he·always·thinks·of·nothing·but·the·object·of·his·search,
because·he·has·a·goal,·because·he·is·obsessed·by·the·goal.·Searching
means:·having·a·goal.·But·finding·means:·being·free,·being·open,·having
no·goal.·You,·oh·venerable·one,·are·perhaps·indeed·a·searcher,·because,
striving·for·your·goal,·there·are·many·things·you·don't·see,·which·are
directly·in·front·of·your·eyes."
NORMAL
40%
4:1
5 lines yanked into "b
Confirm Register Content
"When·someone·is·searching,"·said·Siddhartha,·"then·it·might·easily
happen·that·the·only·thing·his·eyes·still·see·is·that·what·he·searches
for,·that·he·is·unable·to·find·anything,·to·let·anything·enter·his
mind,·because·he·always·thinks·of·nothing·but·the·object·of·his·search,
because·he·has·a·goal,·because·he·is·obsessed·by·the·goal.·Searching
means:·having·a·goal.·But·finding·means:·being·free,·being·open,·having
no·goal.·You,·oh·venerable·one,·are·perhaps·indeed·a·searcher,·because,
striving·for·your·goal,·there·are·many·things·you·don't·see,·which·are
directly·in·front·of·your·eyes."
NORMAL
40%
4:1
 
:reg b
Type Name Content
  l  "b   mind, because he always thinks of nothing but the object of his searc