repl.lua

November 13, 2016 · View on GitHub

repl.lua is a REPL for mpv input commands. It is displayed on the video window. It also shows log messages.

screenshot

Keybindings

KeyAction
`Show the REPL
EscHide the REPL
EnterRun the typed command
Shift + EnterType a literal newline character
Ctrl + , Ctrl + Move cursor to previous/next word
, Navigate command history
PgUpGo to the first command in the history
PgDnStop navigating command history
InsertToggle insert mode
Shift + InsertPaste text (uses the primary selection on X11)
TabComplete the command or property name at the cursor
Ctrl + CClear current line
Ctrl + KDelete text from the cursor to the end of the line
Ctrl + LClear all log messages from the console
Ctrl + UDelete text from the cursor to the beginning of the line
Ctrl + VPaste text (uses the clipboard on X11)
Ctrl + WDelete text from the cursor to the beginning of the current word

Commands

CommandAction
script-message-to repl type "<text>"Show the REPL and pre-fill it with the provided text

Known issues

  • Pasting text is slow on Windows
  • Non-ASCII keyboard input doesn't work
  • The cursor keys move between Unicode code-points, not grapheme clusters

Disclaimer

This script was written with the hope that it would be useful, but the method of keyboard input is a bit of a hack (mpv wasn't designed to be a GUI toolkit,) so there are no guarantees that it will be useful or continue to work.

Copying

This script is released under the ISC licence.

The color scheme for log messages is Chris Kempson's Base16 Eighties