Documentation
¶
Overview ¶
Package editor ties the buffer, command registry, keymap and highlighter into a running tcell application. It owns the single UI goroutine: all state that is not itself thread-safe is mutated only here. Plugins (running in other processes) reach in via the actions queue — see Do and Prompt — so the hot path (typing, cursor motion) never blocks on RPC.
Index ¶
- type Editor
- func (e *Editor) AddBeforeSaveHook(fn func())
- func (e *Editor) AddBuffer(b *buffer.Buffer)
- func (e *Editor) AddHook(event string, fn func(any))
- func (e *Editor) AfterEdit()
- func (e *Editor) BindKey(seq, cmd string)
- func (e *Editor) Buffer() *buffer.Buffer
- func (e *Editor) Do(fn func())
- func (e *Editor) Done() <-chan struct{}
- func (e *Editor) EnableLSP()
- func (e *Editor) EnableSystemClipboard()
- func (e *Editor) NoteOpened(buf *buffer.Buffer)
- func (e *Editor) OpenDir(dir string)
- func (e *Editor) Prompt(prompt string) string
- func (e *Editor) Quit()
- func (e *Editor) Registry() *command.Registry
- func (e *Editor) Run()
- func (e *Editor) SetConfig(c *config.Config)
- func (e *Editor) SetMessage(text string)
- func (e *Editor) SetMessagesBuffer(b *buffer.Buffer)
- func (e *Editor) SetState(s *state.State)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Editor ¶
type Editor struct {
// contains filtered or unexported fields
}
Editor is the top-level application state.
func (*Editor) AddBeforeSaveHook ¶
func (e *Editor) AddBeforeSaveHook(fn func())
AddBeforeSaveHook registers fn to run before every buffer save.
func (*Editor) AfterEdit ¶
func (e *Editor) AfterEdit()
AfterEdit re-highlights and fires the change hook; call on the UI goroutine after a plugin mutates the buffer.
func (*Editor) Do ¶
func (e *Editor) Do(fn func())
Do posts fn to run on the UI goroutine. Safe to call from any goroutine.
func (*Editor) EnableLSP ¶
func (e *Editor) EnableLSP()
EnableLSP turns on language-server integration (off by default so tests and headless use never spawn servers). Call once at startup.
func (*Editor) EnableSystemClipboard ¶
func (e *Editor) EnableSystemClipboard()
EnableSystemClipboard wires kill/copy and yank to the OS clipboard when a platform clipboard utility is available. Off by default (like EnableLSP) so tests stay hermetic. Call once at startup.
func (*Editor) NoteOpened ¶
NoteOpened records a freshly opened file as recent and restores its last cursor position. Exported for main to call for the startup buffer.
func (*Editor) OpenDir ¶
OpenDir opens dir in a *dired* buffer as the current buffer, without splitting the window. Used when moe is started with a directory argument.
func (*Editor) Prompt ¶
Prompt reads a line from the minibuffer, blocking the caller until the user answers or cancels (empty string on cancel). Call from a non-UI goroutine.
func (*Editor) Quit ¶
func (e *Editor) Quit()
Quit asks the editor to stop; safe to call from any goroutine.
func (*Editor) Run ¶
func (e *Editor) Run()
Run enters the main loop and returns when the user quits.
func (*Editor) SetConfig ¶
SetConfig replaces the editor configuration (tab width, indent style, ...).
func (*Editor) SetMessage ¶
SetMessage shows text in the echo area (thread-safe).
func (*Editor) SetMessagesBuffer ¶
SetMessagesBuffer designates b as the *messages* log target.
Source Files
¶
- agent.go
- clipboard.go
- comint.go
- commands.go
- comment.go
- convert.go
- describe.go
- dired.go
- disk.go
- draw.go
- edit.go
- editor.go
- errnav.go
- expand.go
- files.go
- indent.go
- json.go
- lsp.go
- macro.go
- mc.go
- menu.go
- minibuffer.go
- motion.go
- mouse.go
- navigation.go
- occur.go
- persist.go
- replace.go
- results.go
- search.go
- shell.go
- theme.go
- vc.go
- whitespace.go
- window.go
- word.go