Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

btv.clipboard

btv.clipboard.read()

btv.clipboard.read() -> a promise of the system clipboard’s text ("" when it is empty). It rejects with a message when the editor has no clipboard, or when the browser won’t let the page read it.

btv.clipboard.read():next(function(text)
  btv.notify(("%d characters on the clipboard"):format(#text))
end)

Defined in state.lua.

btv.clipboard.write(text, opts)

btv.clipboard.write(text, opts) -> a promise that settles once text is on the system clipboard. opts.linewise marks it as whole lines, so a "+p puts it on lines of its own; it defaults to whether text ends in a newline. Rejects with a message when the editor has no clipboard. The unnamed register is left alone.

btv.clipboard.write(btv.buf.name(0))

Defined in state.lua.