formatter

package
v0.0.0-...-256bffb Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Formatter

type Formatter interface {
	Run()
	ExecCmds(event event.Event, cmds []gen.Command, ext string) error
	WriteMenu(w *event.Win) error
	SetupFormatting(*event.Win, gen.Spec) error
	Refmt(event.Event, gen.Command, string) ([]byte, error)
}

Formatter listens for Acme events and applies formatting rules to the active buffer

func New

func New() Formatter

New constructs a Formatter that uses $NYNERULES for formatting

type Keymap

type Keymap struct {
	GetWinFn    func(int) (*event.Win, error)
	GetIndentFn func(event.Event) int
}

Keymap contains parameters for constructing a custom keymap

func (*Keymap) Tabexpand

func (k *Keymap) Tabexpand(condition event.Condition) event.KeyCmdHook

Tabexpand expands tabs to spaces

type Nyne

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

Nyne implements the Formatter inferface for $NYNERULES

func (*Nyne) ExecCmds

func (n *Nyne) ExecCmds(evt event.Event, cmds []gen.Command, ext string) error

ExecCmds executes commands that operate on stdin/stdout against the Acme buffer

func (*Nyne) Refmt

func (n *Nyne) Refmt(evt event.Event, cmd gen.Command, ext string) ([]byte, error)

Refmt executes a command to the Acme buffer and refreshes the buffer with updated contents

func (*Nyne) Run

func (n *Nyne) Run()

Run tells the Formatter to begin listening for Acme events

func (*Nyne) SetupFormatting

func (n *Nyne) SetupFormatting(w *event.Win, spec gen.Spec) error

SetupFormatting opens the Acme buffer for writing and applies the indentation and tab expansion options provided in $NYNERULES

func (*Nyne) WriteMenu

func (n *Nyne) WriteMenu(w *event.Win) error

WriteMenu writes the specified menu options to the Acme buffer

func (*Nyne) WriteUpdates

func (n *Nyne) WriteUpdates(evt event.Event, updates [][]byte) error

WriteUpdates writes the updated contents to the file

Jump to

Keyboard shortcuts

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