Concepts

Let's take a look at a few basic concepts before we go into more depth on different commands.

Actions and Selectors

Nearly all Serenade commands take the same form:

<action> <selector>

An action describes something want to do. Common actions include:

  • go to
  • copy
  • cut
  • delete

A selector describes a block of code you want to manipulate. Common selectors include:

  • line
  • word
  • character
  • block
  • function
  • argument
  • parameter
  • class

Putting them together, some example Serenade commands include:

  • go to line three
  • copy word
  • delete function
  • cut if
  • go to for
  • copy argument
  • delete condition
  • cut character
  • go to method
  • copy block
  • delete return value
  • cut parameter

For a full list of selectors and actions, see the Command Reference.

Ordinals

Every selector can also specify an ordinal, either with a prefix like first, second, or third, or a postfix like one, two, or three. The most common use is to jump to a line number:

go to line fifty

You can also apply ordinals to other selectors, like:

delete second class

Or equivalently:

delete class two

Positions

You can also specify a start or end position for each selector. For instance, you can say:

end of block

You can also combine ordinals and positions with commands like:

end of third method

Repetition

You can also specify ranges of selectors to delete more than one selector at once. For instance, you can say:

delete lines three to five

Or:

delete two methods