Documentation
¶
Overview ¶
Package edit implements a command line editor.
Index ¶
- Constants
- Variables
- func CommandHistory(ec *eval.Frame, args []types.Value, opts map[string]types.Value)
- func InsertAtDot(ec *eval.Frame, args []types.Value, opts map[string]types.Value)
- func NarrowRead(ec *eval.Frame, args []types.Value, opts map[string]types.Value)
- func RegisterVariable(name string, maker func() vartypes.Variable) struct{}
- func ReplaceInput(ec *eval.Frame, args []types.Value, opts map[string]types.Value)
- func Wordify(ec *eval.Frame, args []types.Value, opts map[string]types.Value)
- type BindingTable
- type BuiltinFn
- type CursorOnModeLiner
- type Editor
- func (ed *Editor) Active() bool
- func (ed *Editor) ActiveMutex() *sync.Mutex
- func (ed *Editor) CallFn(fn eval.Fn, args ...types.Value)
- func (ed *Editor) Close()
- func (ed *Editor) Evaler() *eval.Evaler
- func (ed *Editor) Notify(format string, args ...interface{})
- func (ed *Editor) ReadLine() (string, error)
- func (ed *Editor) Variable(name string) vartypes.Variable
- type ListRenderer
- type Lister
- type Mode
Constants ¶
const PreviewBytes = 64 * 1024
PreviewBytes is the maximum number of bytes to preview a file.
Variables ¶
var ( // ErrCompleterMustBeFn is thrown if the user has put a non-function entry // in $edit:completer, and that entry needs to be used for completion. // TODO(xiaq): Detect the type violation when the user modifies // $edit:completer. ErrCompleterMustBeFn = errors.New("completer must be fn") // ErrCompleterArgMustBeString is thrown when a builtin argument completer // is called with non-string arguments. ErrCompleterArgMustBeString = errors.New("arguments to arg completers must be string") // ErrTooFewArguments is thrown when a builtin argument completer is called // with too few arguments. ErrTooFewArguments = errors.New("too few arguments") )
var ( ErrNotRegular = errors.New("no preview for non-regular file") ErrNotValidUTF8 = errors.New("no preview for non-utf8 file") )
Errors displayed in the preview area of navigation mode.
var ErrStoreOffline = errors.New("store offline")
ErrStoreOffline is thrown when an operation requires the storage backend, but it is offline.
var PinnedScore = math.Inf(1)
PinnedScore is a special value of Score in storedefs.Dir to represent that the directory is pinned.
Functions ¶
func CommandHistory ¶ added in v0.10.0
func InsertAtDot ¶ added in v0.10.0
func NarrowRead ¶ added in v0.10.0
func RegisterVariable ¶ added in v0.11.0
RegisterVariable registers a variable: its name and a func to derive a Variable instance. It is later to be used during Editor initialization to populate Editor.variables as well as the edit: namespace.
func ReplaceInput ¶ added in v0.10.0
Types ¶
type BindingTable ¶
BindingTable is a special Map that converts its key to ui.Key and ensures that its values satisfy eval.CallableValue.
func (BindingTable) Assoc ¶ added in v0.10.0
func (bt BindingTable) Assoc(k, v types.Value) types.Value
Assoc converts the index to ui.Key, ensures that the value is CallableValue, uses the Assoc of the inner Map and converts the result to a BindingTable.
func (BindingTable) IndexOne ¶
func (bt BindingTable) IndexOne(idx types.Value) types.Value
IndexOne converts the index to ui.Key and uses the IndexOne of the inner Map.
func (BindingTable) Repr ¶
func (bt BindingTable) Repr(indent int) string
Repr returns the representation of the binding table as if it were an ordinary map keyed by strings.
type BuiltinFn ¶ added in v0.4.0
type BuiltinFn struct {
// contains filtered or unexported fields
}
BuiltinFn represents an editor builtin.
type CursorOnModeLiner ¶ added in v0.6.0
type CursorOnModeLiner interface {
CursorOnModeLine() bool
}
CursorOnModeLiner is an optional interface that modes can implement. If a mode does and the method returns true, the cursor is placed on the modeline when that mode is active.
type Editor ¶
type Editor struct {
// contains filtered or unexported fields
}
Editor keeps the status of the line editor.
func NewEditor ¶
NewEditor creates an Editor. When the instance is no longer used, its Close method should be called.
func (*Editor) ActiveMutex ¶ added in v0.4.0
ActiveMutex returns a mutex that must be used when changing the activeness of the Editor.
func (*Editor) CallFn ¶ added in v0.3.0
CallFn calls an Fn, displaying its outputs and possible errors as editor notifications. It is the preferred way to call a Fn while the editor is active.
func (*Editor) Close ¶ added in v0.11.0
func (ed *Editor) Close()
Close releases resources used by the editor.
type ListRenderer ¶ added in v0.6.0
type ListRenderer interface {
// ListRender renders the listing under the given constraint of width and
// maximum height. It returns a rendered buffer.
ListRender(width, maxHeight int) *ui.Buffer
}
ListRenderer is a mode with a listing that handles the rendering itself. NOTE(xiaq): This interface is being deprecated in favor of Lister.
Source Files
¶
- abbr.go
- action.go
- api.go
- api_utils.go
- arg_completers.go
- binding_table.go
- candidate.go
- compl_getopt.go
- complete_arg.go
- complete_command.go
- complete_index.go
- complete_redir.go
- complete_variable.go
- completion.go
- completion_mode.go
- dump_buf.go
- edit.go
- highlight.go
- histlist.go
- history.go
- hooks.go
- insert.go
- lastcmd.go
- listing.go
- location.go
- matcher.go
- max_height.go
- minmax.go
- mode.go
- narrow.go
- navigation.go
- navigation_preview.go
- navigation_width.go
- nodeutil.go
- prompt_vars.go
- raw_insert.go
- registry.go
- render.go
- style.go
- styled.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package highlight implements syntax highlighting for Elvish code.
|
Package highlight implements syntax highlighting for Elvish code. |
|
Package history provides utilities for the command history.
|
Package history provides utilities for the command history. |
|
Package lscolors provides styling of filenames based on file features.
|
Package lscolors provides styling of filenames based on file features. |
|
Package prompt implements prompt-related functionalities of the editor.
|
Package prompt implements prompt-related functionalities of the editor. |
|
Package tty provides terminal functionality for the Elvish editor.
|
Package tty provides terminal functionality for the Elvish editor. |
|
Package ui contains types that may be used by different editor frontends.
|
Package ui contains types that may be used by different editor frontends. |