Versions in this module Expand all Collapse all v0 v0.3.0 Sep 17, 2026 Changes in this version type Editor + func (e *Editor) ReplaceAtCursor(before, after int, text string) v0.2.0 Sep 16, 2026 v0.1.0 Sep 10, 2026 Changes in this version + var KeyBackspace = Special("backspace") + var KeyDelete = Special("delete") + var KeyDown = Special("down") + var KeyEnd = Special("end") + var KeyEnter = Special("enter") + var KeyEsc = Special("esc") + var KeyHome = Special("home") + var KeyLeft = Special("left") + var KeyPgDn = Special("pgdn") + var KeyPgUp = Special("pgup") + var KeyRight = Special("right") + var KeyShiftTab = Key + var KeyTab = Special("tab") + var KeyUp = Special("up") + func KeysString(keys []Key) string + type Buffer struct + func NewBuffer(text string) *Buffer + func (b *Buffer) DeleteLines(from, to int) []string + func (b *Buffer) DeleteRange(start, end Pos) string + func (b *Buffer) InsertLines(at int, lines []string) + func (b *Buffer) InsertText(p Pos, text string) Pos + func (b *Buffer) Line(i int) []rune + func (b *Buffer) LineCount() int + func (b *Buffer) LineLen(i int) int + func (b *Buffer) LineString(i int) string + func (b *Buffer) Lines() []string + func (b *Buffer) Range(start, end Pos) string + func (b *Buffer) ReplaceLine(i int, text []rune) + func (b *Buffer) ReplaceLines(from, to int, lines []string) + func (b *Buffer) Restore(lines [][]rune) + func (b *Buffer) SetText(text string) + func (b *Buffer) Snapshot() [][]rune + func (b *Buffer) Text() string + type Editor struct + func New(text string, opts Options, hooks Hooks) *Editor + func (e *Editor) BlockColumns() (left, right int, toEnd bool) + func (e *Editor) ClearMessage() + func (e *Editor) Cmdline() (kind rune, text string, cursor int, active bool) + func (e *Editor) Completions() ([]string, int) + func (e *Editor) Cursor() Pos + func (e *Editor) Dirty() bool + func (e *Editor) EnsureCursorVisible() + func (e *Editor) ExecuteEx(line string) + func (e *Editor) Feed(notation string) + func (e *Editor) Folds() map[int]int + func (e *Editor) GotoLine(line int) + func (e *Editor) HandleKey(k Key) bool + func (e *Editor) Hidden(line int) bool + func (e *Editor) HighlightOn() bool + func (e *Editor) IncrementalHighlights(line int) [][2]int + func (e *Editor) InsertAtCursor(text string) + func (e *Editor) IsFoldStart(line int) (int, bool) + func (e *Editor) LastSearch() string + func (e *Editor) Line(i int) string + func (e *Editor) LineCount() int + func (e *Editor) LineRunes(i int) []rune + func (e *Editor) Lines() []string + func (e *Editor) MarkSaved() + func (e *Editor) Marks() map[rune]Pos + func (e *Editor) Message() (string, bool) + func (e *Editor) Mode() Mode + func (e *Editor) OpenCmdline(kind rune, initial string) + func (e *Editor) Options() Options + func (e *Editor) Pending() string + func (e *Editor) PendingCount() (int, bool) + func (e *Editor) Recording() rune + func (e *Editor) Redo() + func (e *Editor) ReflowParagraph() + func (e *Editor) RegisterText(r rune) (Register, bool) + func (e *Editor) ReplaceLineText(line int, text string) + func (e *Editor) ReplaceLines(from, to int, lines []string) + func (e *Editor) ReplaceText(text string) + func (e *Editor) ResetPending() + func (e *Editor) Rows() int + func (e *Editor) ScrollTop() int + func (e *Editor) SearchHighlights(line int) [][2]int + func (e *Editor) SetCursor(p Pos) + func (e *Editor) SetHooks(h Hooks) + func (e *Editor) SetOptions(opts Options) + func (e *Editor) SetScrollTop(line int) + func (e *Editor) SetText(text string) + func (e *Editor) SetViewport(rows int) + func (e *Editor) StatusSuffix() string + func (e *Editor) Text() string + func (e *Editor) ToggleCheckboxAtCursor() + func (e *Editor) Undo() + func (e *Editor) Version() int + func (e *Editor) VisualRange() (start, end Pos, mode Mode, ok bool) + func (e *Editor) WordUnderCursor() string + type ExCommand struct + Args string + Bang bool + Name string + Range Range + Raw string + type Hooks struct + Changed func() + CopyLink func() + ExCommand func(cmd ExCommand) (handled bool, err error) + ExComplete func(text string) (keep string, candidates []string) + FollowLink func() + LineRows func(line int) int + OnJump func(from Pos) + OpenURL func() + ReadClipboard func() (string, bool) + WriteClipboard func(text string) bool + type Key struct + Alt bool + Ctrl bool + Name string + Rune rune + Shift bool + func Alt(r rune) Key + func Ctrl(r rune) Key + func ParseKeys(s string) []Key + func R(r rune) Key + func Special(name string) Key + func (k Key) Is(name string) bool + func (k Key) IsCtrl(r rune) bool + func (k Key) IsRune(r rune) bool + func (k Key) Printable() bool + func (k Key) String() string + type Mode int + const ModeCmdline + const ModeInsert + const ModeNormal + const ModeReplace + const ModeVisual + const ModeVisualBlock + const ModeVisualLine + func (m Mode) Label() string + type Options struct + AutoPairQuotes bool + AutoPairs bool + IgnoreCase bool + InsertEscape string + MarkdownLists bool + ScrollOff int + SmartCase bool + TabSize int + TextReplacements map[string]string + TextReplacementsEnabled bool + VimEnabled bool + WrapScan bool + YankToClipboard bool + func DefaultOptions() Options + type Pos struct + Col int + Line int + func (p Pos) Less(q Pos) bool + type Range struct + End int + Given bool + Start int + type Register struct + Blockwise bool + Linewise bool + Text string