macro

package
v0.0.0-...-8aadb99 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RecordKeys

func RecordKeys(eng *Engine)

RecordKeys is being passed every key read by the shell, and will save those entered while the engine is in record mode. All others are ignored.

Types

type Engine

type Engine struct {
	// contains filtered or unexported fields
}

Engine manages all things related to keyboard macros: recording, dumping and feeding (running) them to the shell.

func NewEngine

func NewEngine(keys *core.Keys, hint *ui.Hint) *Engine

NewEngine is a required constructor to setup a working macro engine.

func (*Engine) PrintAllMacros

func (e *Engine) PrintAllMacros()

PrintAllMacros dumps all macros to the screen, which one line per saved macro sequence, next to its corresponding key ID.

func (*Engine) PrintLastMacro

func (e *Engine) PrintLastMacro()

PrintLastMacro dumps the last recorded macro sequence to the screen.

func (*Engine) Recording

func (e *Engine) Recording() bool

Recording returns true if the macro engine is recording the keys for a macro.

func (*Engine) RunLastMacro

func (e *Engine) RunLastMacro()

RunLastMacro feeds keys the last recorded macro to the shell's key stack, so that the macro is replayed. Note that this function only feeds the keys of the macro back into the key stack: it does not dispatch them to commands, therefore not running any.

func (*Engine) RunMacro

func (e *Engine) RunMacro(key rune)

RunMacro runs a given macro, injecting its key sequence back into the shell key stack. The key argument should either be one of the valid alphanumeric macro identifiers, or a nil rune (in which case the last recorded macro is ran). Note that this function only feeds the keys of the macro back into the key stack: it does not dispatch them to commands, therefore not running any.

func (*Engine) StartRecord

func (e *Engine) StartRecord(key rune)

StartRecord starts saving all user key input to record a macro. If the key parameter is an alphanumeric character, the macro recorded will be stored and used through this letter argument, just like macros work in Vim. If the key is neither valid nor the null value, the engine does not start. A notification containing the saved sequence is given through the hint section.

func (*Engine) StopRecord

func (e *Engine) StopRecord(keys ...rune)

StopRecord stops using key input as part of a macro. The hint section displaying the currently saved sequence is cleared.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL