Class Vi

java.lang.Object
org.aesh.readline.editing.Vi
All Implemented Interfaces:
EditMode

public class Vi extends Object implements EditMode
Vi-style line editing mode implementation.
Author:
Ståle W. Pedersen
  • Method Details

    • addAction

      public void addAction(int[] input, String action)
      Description copied from interface: EditMode
      Add an action mapping by key input and action name.
      Specified by:
      addAction in interface EditMode
      Parameters:
      input - the key input code points
      action - the action name
    • remapKeysFromDevice

      public void remapKeysFromDevice(Device device)
      Description copied from interface: EditMode
      Remap keys based on device capabilities.
      Specified by:
      remapKeysFromDevice in interface EditMode
      Parameters:
      device - the terminal device
    • prevKey

      public KeyAction prevKey()
      Description copied from interface: EditMode
      Get the previous key action.
      Specified by:
      prevKey in interface EditMode
      Returns:
      the previous key action
    • setPrevKey

      public void setPrevKey(KeyAction event)
      Description copied from interface: EditMode
      Set the previous key action.
      Specified by:
      setPrevKey in interface EditMode
      Parameters:
      event - the key action to set as previous
    • addVariable

      public void addVariable(Variable variable, String value)
      Description copied from interface: EditMode
      Add a variable with its value.
      Specified by:
      addVariable in interface EditMode
      Parameters:
      variable - the variable to set
      value - the value to assign
    • variableValue

      public String variableValue(Variable variable)
      Description copied from interface: EditMode
      Get the value of a variable.
      Specified by:
      variableValue in interface EditMode
      Parameters:
      variable - the variable to look up
      Returns:
      the variable's value, or null if not set
    • addAction

      public Vi addAction(Key key, String action)
      Add an action mapping for a key by action name.
      Parameters:
      key - the key to map
      action - the action name
      Returns:
      this Vi instance for chaining
    • addAction

      public Vi addAction(Key key, org.aesh.readline.editing.Vi.ActionStatus status)
      Add an action mapping for a key with action status.
      Parameters:
      key - the key to map
      status - the action status
      Returns:
      this Vi instance for chaining
    • addAction

      public Vi addAction(int[] input, org.aesh.readline.editing.Vi.ActionStatus status)
      Add an action mapping for input code points with action status.
      Parameters:
      input - the input code points
      status - the action status
      Returns:
      this Vi instance for chaining
    • addAction

      public Vi addAction(Key key, String action, EditMode.Status status)
      Add an action mapping for a key with action name and status.
      Parameters:
      key - the key to map
      action - the action name
      status - the status when this action is active
      Returns:
      this Vi instance for chaining
    • addAction

      public Vi addAction(Key key, String action, EditMode.Status status, EditMode.Status after)
      Add an action mapping for a key with action name, current and next status.
      Parameters:
      key - the key to map
      action - the action name
      status - the current status when this action is active
      after - the status to transition to after the action
      Returns:
      this Vi instance for chaining
    • addAction

      public Vi addAction(Key key, Action action)
      Add an action mapping for a key.
      Specified by:
      addAction in interface EditMode
      Parameters:
      key - the key to map
      action - the action to perform
      Returns:
      this Vi instance for chaining
    • addAction

      public Vi addAction(Key key, Action action, EditMode.Status status)
      Add an action mapping for a key with status.
      Parameters:
      key - the key to map
      action - the action to perform
      status - the status when this action is active
      Returns:
      this Vi instance for chaining
    • addAction

      public Vi addAction(Key key, Action action, EditMode.Status status, EditMode.Status after)
      Add an action mapping for a key with current and next status.
      Parameters:
      key - the key to map
      action - the action to perform
      status - the current status when this action is active
      after - the status to transition to after the action
      Returns:
      this Vi instance for chaining
    • addAction

      public Vi addAction(Key key, Action action, EditMode.Status status, EditMode.Status after, EditMode.Status actionStatus)
      Add an action mapping for a key with full status configuration.
      Parameters:
      key - the key to map
      action - the action to perform
      status - the current status when this action is active
      after - the status to transition to after the action
      actionStatus - the action's internal status
      Returns:
      this Vi instance for chaining
    • addActionGroup

      public Vi addActionGroup(Key key, org.aesh.readline.editing.Vi.ActionStatusGroup group)
      Add an action group mapping for a key.
      Parameters:
      key - the key to map
      group - the action status group
      Returns:
      this Vi instance for chaining
    • addActionGroup

      public Vi addActionGroup(int[] input, org.aesh.readline.editing.Vi.ActionStatusGroup group)
      Add an action group mapping for input code points.
      Parameters:
      input - the input code points
      group - the action status group
      Returns:
      this Vi instance for chaining
    • updateIgnoreEOF

      public void updateIgnoreEOF(int eof)
      Description copied from interface: EditMode
      Update the ignore-EOF counter.
      Specified by:
      updateIgnoreEOF in interface EditMode
      Parameters:
      eof - the EOF value to update
    • mode

      public EditMode.Mode mode()
      Description copied from interface: EditMode
      Get the editing mode type.
      Specified by:
      mode in interface EditMode
      Returns:
      the mode (EMACS or VI)
    • keys

      public KeyAction[] keys()
      Description copied from interface: EditMode
      Get the key actions for this mode.
      Specified by:
      keys in interface EditMode
      Returns:
      the key actions array
    • status

      public EditMode.Status status()
      Description copied from interface: EditMode
      Get the current edit status.
      Specified by:
      status in interface EditMode
      Returns:
      the current status
    • setStatus

      public void setStatus(EditMode.Status status)
      Description copied from interface: EditMode
      Set the edit status.
      Specified by:
      setStatus in interface EditMode
      Parameters:
      status - the new status
    • parse

      public Action parse(KeyAction event)
      Description copied from interface: EditMode
      Parse a key event and return the corresponding action.
      Specified by:
      parse in interface EditMode
      Parameters:
      event - the key event to parse
      Returns:
      the action for this key event, or null if none
    • isInChainedAction

      public boolean isInChainedAction()
      Description copied from interface: EditMode
      Check if currently in a chained action sequence.
      Specified by:
      isInChainedAction in interface EditMode
      Returns:
      true if in a chained action