Class Macro

java.lang.Object
org.jline.reader.Macro
All Implemented Interfaces:
Binding

public class Macro extends Object implements Binding
A macro that executes a sequence of keystrokes when invoked.

The Macro class is a type of Binding that represents a sequence of keystrokes to be executed when a key sequence bound to this macro is pressed. When triggered, the LineReader will process each keystroke in the macro's sequence as if they were typed by the user.

Macros are useful for automating repetitive sequences of editing operations by binding them to a single key combination. They can include any valid key sequence, including control characters and escape sequences.

For example, a macro might be used to:

  • Move the cursor to the beginning of the line and insert a specific prefix
  • Delete a word and replace it with another string
  • Execute a series of editing commands in sequence
See Also:
  • Constructor Details

    • Macro

      public Macro(String sequence)
  • Method Details

    • getSequence

      public String getSequence()
      Returns the keystroke sequence that this macro will execute.
      Returns:
      the keystroke sequence
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object