Skip to main content

Relative scope

The iteration scope depends on the scope type. For example, functions iterate within a class, tokens within a line, and characters within a token.

Relative modifiers select scopes before or after the input target. Without "every", plural forms produce one contiguous range; prefix them with "every" to produce separate targets instead.

Cursorless ID: relativeScope

Syntax​

  • previous <scope> - Previous instance of <scope>.
  • <ordinal> previous <scope> - <ordinal> instance of <scope> before target.
  • next <scope> - Next instance of <scope>.
  • <ordinal> next <scope> - <ordinal> instance of <scope> after target.
  • <scope> backward - Single instance of <scope> including target, going backwards.
  • <scope> forward - Single instance of <scope> including target, going forwards.
  • <number> <scope>s backward - <number> instances of <scope> including target, going backwards, as contiguous range.
  • every <number> <scope>s backward - <number> instances of <scope> including target, going backwards, as individual targets.
  • <number> <scope>s - <number> instances of <scope> including target, going forwards, as contiguous range.
  • every <number> <scope>s - <number> instances of <scope> including target, going forwards, as individual targets.
  • previous <number> <scope>s - Previous <number> instances of <scope>, as contiguous range.
  • every previous <number> <scope>s - Previous <number> instances of <scope>, as individual targets.
  • next <number> <scope>s - Next <number> instances of <scope>, as contiguous range.
  • every next <number> <scope>s - Next <number> instances of <scope>, as individual targets.

Examples​

  • "take previous state blue air" - Selects the previous statement before the statement containing the token containing letter a with a blue hat.
  • "take third previous state blue air" - Selects the third statement before the statement containing the token containing letter a with a blue hat.
  • "take next state blue air" - Selects the next statement after the statement containing the token containing letter a with a blue hat.
  • "take third next state blue air" - Selects the third statement after the statement containing the token containing letter a with a blue hat.
  • "take state backward blue air" - Selects the statement containing the token containing letter a with a blue hat, searching backward.
  • "take state forward blue air" - Selects the statement containing the token containing letter a with a blue hat, searching forward.
  • "take three states backward blue air" - Selects three statements, including the statement containing the token containing letter a with a blue hat, searching backward, as a contiguous range.
  • "take every three states backward blue air" - Selects three statements, including the statement containing the token containing letter a with a blue hat, searching backward, as individual targets.
  • "take three states blue air" - Selects three statements, including the statement containing the token containing letter a with a blue hat, searching forward, as a contiguous range.
  • "take every three states blue air" - Selects three statements, including the statement containing the token containing letter a with a blue hat, searching forward, as individual targets.
  • "take previous three states blue air" - Selects the previous three statements before the statement containing the token containing letter a with a blue hat as a contiguous range.
  • "take every previous three states blue air" - Selects the previous three statements before the statement containing the token containing letter a with a blue hat as individual targets.
  • "take next three states blue air" - Selects the next three statements after the statement containing the token containing letter a with a blue hat as a contiguous range.
  • "take every next three states blue air" - Selects the next three statements after the statement containing the token containing letter a with a blue hat as individual targets.

Visualization​

"take next item"​

Before
After

"take previous item"​

Before
After

"take next two items"​

Before
After

"take previous two items"​

Before
After