src.elv.shsrc.elv.sh/pkg/edit Index | Files | Directories

package edit

import "src.elv.sh/pkg/edit"

Package edit implements the line editor for Elvish.

The line editor is based on the cli package, which implements a general, Elvish-agnostic line editor, and multiple "addon" packages. This package glues them together and provides Elvish bindings for them.

Index

Types

type Editor

type Editor struct {

	// Maybe move this to another type that represents the REPL cycle as a whole, not just the
	// read/edit portion represented by the Editor type.
	AfterCommand []func(src parse.Source, duration float64, err error)
	// contains filtered or unexported fields
}

Editor is the interactive line editor for Elvish.

func NewEditor

func NewEditor(tty cli.TTY, ev *eval.Evaler, st storedefs.Store) *Editor

NewEditor creates a new editor. The TTY is used for input and output. The Evaler is used for syntax highlighting, completion, and calling callbacks. The Store is used for saving and retrieving command and directory history.

func (*Editor) Notify

func (ed *Editor) Notify(note ui.Text)

Notify adds a note to the notification buffer.

func (*Editor) Ns

func (ed *Editor) Ns() *eval.Ns

Ns returns a namespace for manipulating the editor from Elvish code.

See https://elv.sh/ref/edit.html for the Elvish API.

func (*Editor) ReadCode

func (ed *Editor) ReadCode() (string, error)

ReadCode reads input from the user.

func (*Editor) RunAfterCommandHooks

func (ed *Editor) RunAfterCommandHooks(src parse.Source, duration float64, err error)

RunAfterCommandHooks runs callbacks involving the interactive completion of a command line.

Source Files

binding_map.go buffer_builtins.go builtins.go command_api.go complete_getopt.go completion.go config_api.go editor.go highlight.go hist_store.go histwalk.go insert_api.go instant.go key_binding.go listing.go listing_custom.go minibuf.go navigation.go prompt.go repl.go state_api.go store_api.go vars.go

Directories

PathSynopsis
pkg/edit/completePackage complete implements the code completion algorithm for Elvish.
pkg/edit/filterPackage filter implements the Elvish filter DSL.
pkg/edit/highlightPackage highlight provides an Elvish syntax highlighter.
Version
v0.21.0 (latest)
Published
Aug 13, 2024
Platform
linux/amd64
Imports
39 packages
Last checked
1 day ago

Tools for package owners.