Message

You can think of xplr as a server. Just like web servers listen to HTTP requests, xplr listens to messages.

A message is a sum type that can have these possible values.

You can send these messages to an xplr session in the following ways:

Format

To send messages using the key bindings or Lua function calls, messages are represented in Lua syntax.

For example:

  • "Quit"
  • { FocusPath = "/path/to/file" }
  • { Call = { command = "bash", args = { "-c", "read -p test" } } }

However, to send messages using the input pipe, they need to be represented using YAML (or JSON) syntax.

For example:

  • Quit
  • FocusPath: "/path/to/file"
  • Call: { command: bash, args: ["-c", "read -p test"] }

Use "$XPLR" -m TEMPLATE [VALUE]... command-line option to safely format TEMPLATE into a valid message. If uses jf to parse and render the template. And $XPLR (rather than xplr) makes sure that the correct version of the binary is being used.

For example:

  • "$XPLR" -m Quit
  • "$XPLR" -m 'FocusPath: %q' "/path/to/file"
  • "$XPLR" -m 'Call: { command: %q, args: [%*q] }' bash -c "read -p test"

Also See: