action

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusYanked            i18n.Key = "status.yanked"
	StatusYankedToClipboard i18n.Key = "status.yankedToClipboard"
)
View Source
const (
	StatusNoMoreMatches i18n.Key = "status.noMoreMatches"
	StatusSearchWrapped i18n.Key = "status.searchWrapped"
	StatusRegisterSet   i18n.Key = "status.registerSet"
)
View Source
const StatusDiffUnavailable i18n.Key = "status.diffUnavailable"

Variables

View Source
var (
	// ErrNoFilePath is returned when no file path is found under the cursor
	ErrNoFilePath = errors.New("no file path under cursor")
	// ErrDocumentLinkTarget is returned when a caller needs a local path but
	// the document link points elsewhere
	ErrDocumentLinkTarget = errors.New("document link target unsupported")
	// ErrExternalURLOpener is returned when no external URL opener is available
	ErrExternalURLOpener = errors.New("external URL opener unavailable")
)
View Source
var (
	ErrDiffUnavailable      = errors.New("diff unavailable in this buffer")
	ErrNoChangesInSelection = errors.New("no changes under any selection")
)
View Source
var (
	ErrNoClipboardProvider = errors.New("no clipboard provider found")
)
View Source
var ErrShellCommand = errors.New("shell command failed")

Functions

func AddNewlineAbove

func AddNewlineAbove(e *view.Editor)

AddNewlineAbove inserts blank lines above each selection's first line. Repeats count times using the document line ending

func AddNewlineBelow

func AddNewlineBelow(e *view.Editor)

AddNewlineBelow inserts blank lines below each selection's last line. Repeats count times using the document line ending

func AlignSelections

func AlignSelections(e *view.Editor)

AlignSelections inserts spaces before each cursor so all cursors sit at the same visual column (the maximum column among all cursors). Only operates when there are multiple selection ranges, all on different lines

func AlignViewBottom

func AlignViewBottom(e *view.Editor)

AlignViewBottom scrolls the viewport so the cursor line is at the bottom

func AlignViewCenter

func AlignViewCenter(e *view.Editor)

AlignViewCenter scrolls the viewport so the cursor line is at the center

func AlignViewTop

func AlignViewTop(e *view.Editor)

AlignViewTop scrolls the viewport so the cursor line is at the top

func AppendMode

func AppendMode(e *view.Editor)

AppendMode enters insert mode with cursors one grapheme past the end of each selection

func AppendToLine

func AppendToLine(e *view.Editor)

AppendToLine moves each cursor to the end of its current line and enters insert mode (append after last char)

func ApplySelection

func ApplySelection(e *view.Editor, sel core.Selection)

ApplySelection applies sel to the focused document as a selection-only transaction, so cursor moves driven by input (mouse, jumps) go through the same insert-group and history bookkeeping as an edit

func ChangeSelection

func ChangeSelection(e *view.Editor)

ChangeSelection yanks all selections into the active register, deletes them, and enters insert mode. For linewise selections, opens a blank line above

func ChangeSelectionNoYank

func ChangeSelectionNoYank(e *view.Editor)

ChangeSelectionNoYank deletes each selection without yanking and enters insert mode

func CharInfo

func CharInfo(e *view.Editor) string

CharInfo returns a string describing the grapheme at the primary cursor. Format: "<printable>" (U+XXXX ...) [Dec N] Hex xx [+xx ...]

func CloseCurrentView

func CloseCurrentView(e *view.Editor)

CloseCurrentView closes the focused view. If the document has unsaved changes and there are other views, the close is blocked

func CollapseSelection

func CollapseSelection(e *view.Editor)

CollapseSelection collapses every selection to its cursor position

func CopyOnNextLine

func CopyOnNextLine(e *view.Editor)

CopyOnNextLine duplicates each selection range to the same column on the next line (count times)

func CopyOnPrevLine

func CopyOnPrevLine(e *view.Editor)

CopyOnPrevLine duplicates each selection range to the same column on the previous line (count times)

func Decrement

func Decrement(e *view.Editor)

Decrement decrements the integer in each selection range by count

func DeleteCharBackward

func DeleteCharBackward(e *view.Editor)

DeleteCharBackward deletes the character before each cursor in insert mode Dedents when the cursor is at the end of leading whitespace; otherwise deletes an auto-pair if applicable, or one grapheme backward

func DeleteCharForward

func DeleteCharForward(e *view.Editor)

DeleteCharForward deletes the grapheme cluster under each cursor

func DeleteSelection

func DeleteSelection(e *view.Editor)

DeleteSelection yanks selections into the active register, then deletes them

func DeleteSelectionNoYank

func DeleteSelectionNoYank(e *view.Editor)

DeleteSelectionNoYank deletes each selection without yanking first

func DeleteWordBackward

func DeleteWordBackward(e *view.Editor)

DeleteWordBackward deletes from the cursor to the start of the previous word, for use in insert mode (C-w)

func DeleteWordForward

func DeleteWordForward(e *view.Editor)

DeleteWordForward deletes from the cursor to the end of the next word, for use in insert mode (A-d)

func EnsureForward

func EnsureForward(e *view.Editor)

EnsureForward forces all selection ranges to have a forward direction (anchor <= head)

func ExitSelectMode

func ExitSelectMode(e *view.Editor)

ExitSelectMode returns to normal mode from select mode without performing the insert-mode cleanup that NormalMode does

func ExtendCharLeft

func ExtendCharLeft(e *view.Editor)

ExtendCharLeft extends the selection one grapheme to the left

func ExtendCharRight

func ExtendCharRight(e *view.Editor)

ExtendCharRight extends the selection one grapheme to the right

func ExtendLineBelow

func ExtendLineBelow(e *view.Editor)

ExtendLineBelow selects the current line(s) inclusive of the trailing newline. If the range already spans the full line, extends one more line

func ExtendLineDown

func ExtendLineDown(e *view.Editor)

ExtendLineDown extends the selection down one visual line, respecting soft-wrap

func ExtendLineUp

func ExtendLineUp(e *view.Editor)

ExtendLineUp extends the selection up one visual line, respecting soft-wrap

func ExtendNextLongWordEnd

func ExtendNextLongWordEnd(e *view.Editor)

ExtendNextLongWordEnd extends the selection to the end of the next WORD

func ExtendNextLongWordStart

func ExtendNextLongWordStart(e *view.Editor)

ExtendNextLongWordStart extends the selection to the start of the next WORD

func ExtendNextSubWordEnd

func ExtendNextSubWordEnd(e *view.Editor)

ExtendNextSubWordEnd extends to the end of the next sub-word

func ExtendNextSubWordStart

func ExtendNextSubWordStart(e *view.Editor)

ExtendNextSubWordStart extends to the start of the next sub-word

func ExtendNextWordEnd

func ExtendNextWordEnd(e *view.Editor)

ExtendNextWordEnd extends the selection to the end of the next word

func ExtendNextWordStart

func ExtendNextWordStart(e *view.Editor)

ExtendNextWordStart extends the selection to the start of the next word

func ExtendPrevLongWordEnd

func ExtendPrevLongWordEnd(e *view.Editor)

ExtendPrevLongWordEnd extends the selection to the end of the previous WORD

func ExtendPrevLongWordStart

func ExtendPrevLongWordStart(e *view.Editor)

ExtendPrevLongWordStart extends to the start of the previous WORD

func ExtendPrevSubWordEnd

func ExtendPrevSubWordEnd(e *view.Editor)

ExtendPrevSubWordEnd extends to the end of the previous sub-word

func ExtendPrevSubWordStart

func ExtendPrevSubWordStart(e *view.Editor)

ExtendPrevSubWordStart extends to the start of the previous sub-word

func ExtendPrevWordEnd

func ExtendPrevWordEnd(e *view.Editor)

ExtendPrevWordEnd extends the selection to the end of the previous word

func ExtendPrevWordStart

func ExtendPrevWordStart(e *view.Editor)

ExtendPrevWordStart extends the selection to the start of the previous word

func ExtendSearchNext

func ExtendSearchNext(e *view.Editor)

ExtendSearchNext repeats the last search forward, extending the selection

func ExtendSearchPrev

func ExtendSearchPrev(e *view.Editor)

ExtendSearchPrev repeats the last search backward, extending the selection

func ExtendToColumn

func ExtendToColumn(e *view.Editor)

ExtendToColumn extends each selection to the Nth character column

func ExtendToFileEnd

func ExtendToFileEnd(e *view.Editor)

ExtendToFileEnd extends all selections to the absolute end of the document

func ExtendToFileStart

func ExtendToFileStart(e *view.Editor)

ExtendToFileStart extends the selection to the beginning of the document

func ExtendToLastLine

func ExtendToLastLine(e *view.Editor)

ExtendToLastLine extends to the start of the last non-blank line

func ExtendToLineBounds

func ExtendToLineBounds(e *view.Editor)

ExtendToLineBounds extends each selection range to cover complete lines (from line start to next-line start), preserving direction

func ExtendToLineEnd

func ExtendToLineEnd(e *view.Editor)

ExtendToLineEnd extends the selection to the end of the current line

func ExtendToLineEndNewline

func ExtendToLineEndNewline(e *view.Editor)

ExtendToLineEndNewline extends each selection to the end of its current line, landing on the newline character

func ExtendToLineStart

func ExtendToLineStart(e *view.Editor)

ExtendToLineStart extends the selection to the start of the current line

func ExtendToNonWhitespace

func ExtendToNonWhitespace(e *view.Editor)

ExtendToNonWhitespace extends the selection to the first non-whitespace character on the current line

func FindChar

func FindChar(args FindCharArgs)

FindChar moves (or extends) each cursor to the nth occurrence of ch in the given direction. inclusive=true lands on the char (f/F), false stops before/ after it (t/T). extend=true keeps the anchor (select mode)

func FlipSelections

func FlipSelections(e *view.Editor)

FlipSelections swaps anchor and head for every selection range

func GotoColumn added in v0.3.0

func GotoColumn(e *view.Editor)

GotoColumn moves each cursor to the Nth character column

func GotoFirstChange

func GotoFirstChange(e *view.Editor)

GotoFirstChange selects the first diff change in the document

func GotoLastAccessedFile

func GotoLastAccessedFile(e *view.Editor)

GotoLastAccessedFile switches to the most recently accessed alternate file

func GotoLastChange

func GotoLastChange(e *view.Editor)

GotoLastChange selects the last diff change in the document

func GotoLastModification

func GotoLastModification(e *view.Editor)

GotoLastModification moves each cursor to the position of the most recent committed change in the current document

func GotoLastModifiedFile

func GotoLastModifiedFile(e *view.Editor)

GotoLastModifiedFile switches focus to the most recently modified document that is not currently focused

func GotoLine

func GotoLine(e *view.Editor, n int)

GotoLine moves (or extends in select mode) the cursor to line n (1-based) If n is 0 the command is a no-op. Clamps to the last non-empty line

func GotoLineEndNewline

func GotoLineEndNewline(e *view.Editor)

GotoLineEndNewline moves each cursor to the end of its current line, landing on the newline character (for use in insert mode)

func GotoNextChange

func GotoNextChange(e *view.Editor)

GotoNextChange moves each cursor to the next diff change

func GotoNextParagraph

func GotoNextParagraph(e *view.Editor)

GotoNextParagraph moves (or extends in select mode) each cursor to the start of the next paragraph. A paragraph boundary is a blank line

func GotoPosition added in v0.1.6

func GotoPosition(e *view.Editor, at core.Position)

GotoPosition moves (or extends in select mode) the cursor to a 1-based line and column. A Col <= 1 lands on the line start; otherwise the cursor is clamped to the line end. A Line <= 0 is a no-op

func GotoPrevChange

func GotoPrevChange(e *view.Editor)

GotoPrevChange moves each cursor to the previous diff change

func GotoPrevParagraph

func GotoPrevParagraph(e *view.Editor)

GotoPrevParagraph moves (or extends in select mode) each cursor to the start of the previous paragraph

func GotoWindowBottom

func GotoWindowBottom(e *view.Editor)

GotoWindowBottom moves the cursor to the last visible line in the viewport

func GotoWindowCenter

func GotoWindowCenter(e *view.Editor)

GotoWindowCenter moves the cursor to the center visible line

func GotoWindowTop

func GotoWindowTop(e *view.Editor)

GotoWindowTop moves the cursor to the top of the viewport

func HalfPageDown

func HalfPageDown(e *view.Editor)

HalfPageDown scrolls the view down by half a page without moving the cursor

func HalfPageUp

func HalfPageUp(e *view.Editor)

HalfPageUp scrolls the view up by half a page without moving the cursor

func InLeadingWhitespace added in v0.1.13

func InLeadingWhitespace(e *view.Editor) bool

InLeadingWhitespace reports whether every cursor has only whitespace between it and the start of its line

func Increment

func Increment(e *view.Editor)

Increment increments the integer in each selection range by count

func Indent

func Indent(e *view.Editor)

Indent inserts one indentation unit at the start of each selected line

func InsertAtLineStart

func InsertAtLineStart(e *view.Editor)

InsertAtLineStart moves each cursor to the first non-whitespace char of its current line and enters insert mode

func InsertChar

func InsertChar(e *view.Editor, ch rune)

InsertChar inserts a character at every cursor position in insert mode Auto-pairs are applied when the character matches an opener or closer

func InsertMode

func InsertMode(e *view.Editor)

InsertMode enters insert mode with cursors at the start of each selection

func InsertNewline

func InsertNewline(e *view.Editor)

InsertNewline inserts a newline at every cursor in insert mode, then replicates the previous line's leading whitespace (auto-indent)

func InsertTab

func InsertTab(e *view.Editor)

InsertTab inserts one indentation unit (tab or spaces) at each cursor

func JoinSelections

func JoinSelections(e *view.Editor)

JoinSelections joins the lines within each selected line range by replacing each line ending (and surrounding whitespace) with nothing

func JoinSelectionsSpace

func JoinSelectionsSpace(e *view.Editor)

JoinSelectionsSpace joins the lines within each selected line range by replacing each line ending (and surrounding whitespace) with a single space

func JumpBackward

func JumpBackward(e *view.Editor)

JumpBackward navigates to the previous position in the view's jump list

func JumpForward

func JumpForward(e *view.Editor)

JumpForward navigates to the next position in the view's jump list

func KeepPrimarySelection

func KeepPrimarySelection(e *view.Editor)

KeepPrimarySelection discards all but the primary selection range

func KeepSelectionsMatching

func KeepSelectionsMatching(e *view.Editor, pattern string) error

KeepSelectionsMatching keeps only selection ranges whose text matches regex

func KillToLineEnd

func KillToLineEnd(e *view.Editor)

KillToLineEnd deletes from the cursor to the end of the current line. If the cursor is already at the line ending, the newline itself is deleted

func KillToLineStart

func KillToLineStart(e *view.Editor)

KillToLineStart deletes from the cursor to the start of the current line If the cursor is at the start, deletes the preceding newline (joins lines)

func MakeSearchWordBounded

func MakeSearchWordBounded(e *view.Editor)

MakeSearchWordBounded wraps the current search pattern with \b word-boundary anchors if they are not already present

func MergeConsecutive

func MergeConsecutive(e *view.Editor)

MergeConsecutive merges overlapping or adjacent selection ranges

func MergeSelections

func MergeSelections(e *view.Editor)

MergeSelections merges all selection ranges into one spanning range

func MoveDown

func MoveDown(e *view.Editor)

MoveDown moves all cursors down one visual line, respecting soft-wrap

func MoveFileEnd

func MoveFileEnd(e *view.Editor)

MoveFileEnd moves all cursors to the start of the last non-blank line

func MoveFileStart

func MoveFileStart(e *view.Editor)

MoveFileStart moves all cursors to the start of the document

func MoveLeft

func MoveLeft(e *view.Editor)

MoveLeft moves all cursors one grapheme to the left

func MoveLineEnd

func MoveLineEnd(e *view.Editor)

MoveLineEnd moves all cursors to the last non-newline character of their current line

func MoveLineNonWhitespace

func MoveLineNonWhitespace(e *view.Editor)

MoveLineNonWhitespace moves all cursors to the first non-whitespace character of their current line

func MoveLineStart

func MoveLineStart(e *view.Editor)

MoveLineStart moves all cursors to the start of their current line

func MoveLongWordBackward

func MoveLongWordBackward(e *view.Editor)

MoveLongWordBackward moves all cursors to the start of the previous WORD

func MoveLongWordEnd

func MoveLongWordEnd(e *view.Editor)

MoveLongWordEnd moves all cursors to the end of the current or next WORD

func MoveLongWordForward

func MoveLongWordForward(e *view.Editor)

MoveLongWordForward moves all cursors to the start of the next WORD

func MoveNextSubWordEnd

func MoveNextSubWordEnd(e *view.Editor)

MoveNextSubWordEnd moves to the end of the next sub-word

func MoveNextSubWordStart

func MoveNextSubWordStart(e *view.Editor)

MoveNextSubWordStart moves to the start of the next sub-word

func MovePrevLongWordEnd

func MovePrevLongWordEnd(e *view.Editor)

MovePrevLongWordEnd moves all cursors to the end of the previous WORD

func MovePrevSubWordEnd

func MovePrevSubWordEnd(e *view.Editor)

MovePrevSubWordEnd moves to the end of the previous sub-word

func MovePrevSubWordStart

func MovePrevSubWordStart(e *view.Editor)

MovePrevSubWordStart moves to the start of the previous sub-word

func MovePrevWordEnd

func MovePrevWordEnd(e *view.Editor)

MovePrevWordEnd moves all cursors to the end of the previous word

func MoveRight

func MoveRight(e *view.Editor)

MoveRight moves all cursors one grapheme to the right

func MoveUp

func MoveUp(e *view.Editor)

MoveUp moves all cursors up one visual line, respecting soft-wrap

func MoveWordBackward

func MoveWordBackward(e *view.Editor)

MoveWordBackward moves all cursors to the start of the previous word

func MoveWordEnd

func MoveWordEnd(e *view.Editor)

MoveWordEnd moves all cursors to the end of the current or next word

func MoveWordForward

func MoveWordForward(e *view.Editor)

MoveWordForward moves all cursors to the start of the next word

func NewOSC52Clipboard

func NewOSC52Clipboard(inner view.Clipboard) view.Clipboard

NewOSC52Clipboard layers OSC 52 terminal writes over inner, so a copy also reaches the clipboard of a terminal reached over ssh

func NormalMode

func NormalMode(e *view.Editor)

NormalMode returns to normal mode, running cleanup like stripping blank-line auto-indent and moving the cursor off the past-end position

func OpenAbove

func OpenAbove(e *view.Editor)

OpenAbove opens a line above each cursor's line and enters insert mode

func OpenBelow added in v0.3.0

func OpenBelow(e *view.Editor)

OpenBelow opens a line below each cursor's line and enters insert mode

func OpenExternalURL

func OpenExternalURL(raw string) error

OpenExternalURL opens a URL with the platform default handler

func PageCursorHalfDown

func PageCursorHalfDown(e *view.Editor)

PageCursorHalfDown moves the cursor and scrolls the view down by half a page

func PageCursorHalfUp

func PageCursorHalfUp(e *view.Editor)

PageCursorHalfUp moves the cursor and scrolls the view up by half a page

func PageDown

func PageDown(e *view.Editor)

PageDown moves the cursor and scrolls the view down by one page

func PageUp

func PageUp(e *view.Editor)

PageUp moves the cursor and scrolls the view up by one page

func PasteAfter

func PasteAfter(e *view.Editor)

PasteAfter pastes the active register's contents after each selection

func PasteBefore

func PasteBefore(e *view.Editor)

PasteBefore pastes the active register's contents before each selection

func PastePrimaryClipboardAfter

func PastePrimaryClipboardAfter(e *view.Editor)

PastePrimaryClipboardAfter reads the primary clipboard and pastes after each selection

func PastePrimaryClipboardBefore

func PastePrimaryClipboardBefore(e *view.Editor)

PastePrimaryClipboardBefore reads the primary clipboard and pastes before each selection

func PasteRegisterAtCursor

func PasteRegisterAtCursor(e *view.Editor, reg rune)

PasteRegisterAtCursor inserts the contents of the given register at each cursor position (for use in insert mode)

func PrimaryClipboardReplace

func PrimaryClipboardReplace(e *view.Editor)

PrimaryClipboardReplace replaces each selection with the primary clipboard

func ReadFile

func ReadFile(e *view.Editor, path string) error

ReadFile inserts the contents of the given file before each cursor

func ReflowSelections

func ReflowSelections(e *view.Editor, width int)

ReflowSelections reflows the text of each selection range to the given column width. Mirrors :reflow in the reference

func RemovePrimarySelection

func RemovePrimarySelection(e *view.Editor)

RemovePrimarySelection removes the primary selection range. If only one range exists, the command is a no-op

func RemoveSelectionsMatching

func RemoveSelectionsMatching(e *view.Editor, pattern string) error

RemoveSelectionsMatching removes selection ranges whose text matches regex

func RepeatLastMotion

func RepeatLastMotion(e *view.Editor)

RepeatLastMotion replays the most recently recorded repeatable motion

func ReplaceChar

func ReplaceChar(e *view.Editor, ch rune)

ReplaceChar replaces every grapheme in each selection with ch and exits select mode

func ReplaceWithYanked

func ReplaceWithYanked(e *view.Editor)

ReplaceWithYanked replaces each selection with the corresponding value from the active register (default '"'). Exits select mode

func ResetDiffChange

func ResetDiffChange(e *view.Editor) (int, error)

ResetDiffChange reverts every diff hunk that intersects the selection back to the version-control base text. It returns how many hunks were reset

func ResizeViewDown

func ResizeViewDown(e *view.Editor)

ResizeViewDown pushes the focused split's border in the down direction by count cells (see view.Editor.ResizeFocusedSplit)

func ResizeViewLeft

func ResizeViewLeft(e *view.Editor)

ResizeViewLeft pushes the focused split's border in the left direction by count cells (see view.Editor.ResizeFocusedSplit)

func ResizeViewRight

func ResizeViewRight(e *view.Editor)

ResizeViewRight pushes the focused split's border in the right direction by count cells (see view.Editor.ResizeFocusedSplit)

func ResizeViewUp

func ResizeViewUp(e *view.Editor)

ResizeViewUp pushes the focused split's border in the up direction by count cells (see view.Editor.ResizeFocusedSplit)

func RotateContentsBackward

func RotateContentsBackward(e *view.Editor)

RotateContentsBackward rotates the text content of each selection range backward by count steps

func RotateContentsForward

func RotateContentsForward(e *view.Editor)

RotateContentsForward rotates the text content of each selection range forward by count steps

func RotateSelectionsBackward

func RotateSelectionsBackward(e *view.Editor)

RotateSelectionsBackward rotates the primary selection index backward by count steps (wrapping around)

func RotateSelectionsForward

func RotateSelectionsForward(e *view.Editor)

RotateSelectionsForward rotates the primary selection index forward by count steps (wrapping around)

func RunFormatter

func RunFormatter(a RunFormatterArgs) error

RunFormatter runs an external formatter as a subprocess over the document's text and applies its output as a single edit, replacing the document text only when the formatter changed it

func SaveSelection

func SaveSelection(e *view.Editor)

SaveSelection pushes the current cursor position to the view's jump list

func ScrollDown

func ScrollDown(e *view.Editor)

ScrollDown scrolls the view down by count lines without moving the cursor

func ScrollUp

func ScrollUp(e *view.Editor)

ScrollUp scrolls the view up by count lines without moving the cursor

func ScrollViewColumns

func ScrollViewColumns(e *view.Editor, v *view.View, n int, left bool)

ScrollViewColumns scrolls a view horizontally by n columns without moving the cursor; scrolling right is clamped to keep one column of content visible

func ScrollViewLines

func ScrollViewLines(e *view.Editor, v *view.View, n int, up bool)

ScrollViewLines scrolls a specific view by n lines, not moving the cursor. Used for mouse-wheel events; the view remains free-scrolled until that view receives cursor-moving keyboard input

func SearchBackward

func SearchBackward(e *view.Editor, pattern string) error

SearchBackward executes a backward search with the given pattern, storing it in the '/' register, and moves each cursor to the previous match

func SearchForward

func SearchForward(e *view.Editor, pattern string) error

SearchForward executes a forward search with the given pattern, storing it in the '/' register, and moves each cursor to the first match

func SearchNext

func SearchNext(e *view.Editor)

SearchNext repeats the last search forward, moving the selection

func SearchPrev

func SearchPrev(e *view.Editor)

SearchPrev repeats the last search backward, moving the selection

func SearchSelection

func SearchSelection(e *view.Editor)

SearchSelection stores the joined selection text as the search pattern (no word-boundary detection) and sets it in the '/' register

func SearchSelectionWord

func SearchSelectionWord(e *view.Editor)

SearchSelectionWord stores the selection text as the search pattern, adding \b word-boundary anchors where the selection touches word boundaries

func SelectAll

func SelectAll(e *view.Editor)

SelectAll selects the entire document in the focused view

func SelectLineAbove

func SelectLineAbove(e *view.Editor)

SelectLineAbove selects current line(s) extending upward, direction-aware: backward selections grow at the head; forward selections shrink at the head

func SelectLineBelow

func SelectLineBelow(e *view.Editor)

SelectLineBelow selects current line(s) extending downward, direction-aware: forward selections grow at the head; backward selections shrink at the head

func SelectMode

func SelectMode(e *view.Editor)

SelectMode enters select mode, adjusting any empty end-of-document selection to be one grapheme wide so it is always visible

func SelectTextObjectAround

func SelectTextObjectAround(e *view.Editor, ch rune)

SelectTextObjectAround selects around the text object identified by ch Plaintext objects: w=word, W=WORD, p=paragraph, m or bracket = surround pair

func SelectTextObjectInside

func SelectTextObjectInside(e *view.Editor, ch rune)

SelectTextObjectInside selects inside the text object identified by ch Plaintext objects: w=word, W=WORD, p=paragraph, m or bracket = surround pair

func SelectWithinRegex

func SelectWithinRegex(e *view.Editor, pattern string) error

SelectWithinRegex keeps only the parts of each selection that match regex

func SetLineEnding

func SetLineEnding(e *view.Editor, le core.LineEnding) error

SetLineEnding changes the document line-ending style and rewrites existing line endings in the focused buffer to match

func ShellAppendOutput

func ShellAppendOutput(e *view.Editor, cmdStr string) error

ShellAppendOutput runs a shell command and appends its output after each selection

func ShellInsertOutput

func ShellInsertOutput(e *view.Editor, cmdStr string) error

ShellInsertOutput runs a shell command and inserts its output before each cursor position

func ShellKeepPipe

func ShellKeepPipe(e *view.Editor, cmdStr string) error

ShellKeepPipe pipes each selection through a shell command and keeps only selections for which the command exits with status 0

func ShellPipe

func ShellPipe(e *view.Editor, cmdStr string) error

ShellPipe pipes each selection through a shell command, replacing the selection with the command's stdout

func ShellPipeTo

func ShellPipeTo(e *view.Editor, cmdStr string) error

ShellPipeTo pipes each selection to a shell command, discarding output

func ShrinkToLineBounds

func ShrinkToLineBounds(e *view.Editor)

ShrinkToLineBounds shrinks each multi-line selection so that it no longer includes leading/trailing line endings. Single-line selections are unchanged

func SortSelections

func SortSelections(e *view.Editor, args SortSelectionsArgs) error

SortSelections sorts the text of each selection range lexicographically, replacing each range with the sorted text

func SplitSelectionByRegex

func SplitSelectionByRegex(e *view.Editor, pattern string) error

SplitSelectionByRegex splits each selection range at every regex match

func SplitSelectionOnNewline

func SplitSelectionOnNewline(e *view.Editor)

SplitSelectionOnNewline splits each selection range on line boundaries, producing one sub-range per line (excluding the line ending itself)

func SurroundAdd

func SurroundAdd(e *view.Editor, ch rune)

SurroundAdd wraps each selection with the pair that matches ch, then switches to normal mode. ch may be either the opening or closing bracket character

func SurroundDelete

func SurroundDelete(e *view.Editor, ch rune)

SurroundDelete removes the surrounding pair identified by ch around each selection, then switches to normal mode

func SurroundDeleteAt

func SurroundDeleteAt(e *view.Editor, text core.Rope, positions []int)

SurroundDeleteAt deletes the brackets at flat [open, close, ...] positions and switches to normal mode

func SurroundReplace

func SurroundReplace(args SurroundReplaceArgs)

SurroundReplace replaces the surrounding pair identified by Current with the pair matching Wanted. Called after two key prompts resolved by the model

func SurroundReplaceAt

func SurroundReplaceAt(
	e *view.Editor, text core.Rope, positions []int, to rune,
)

SurroundReplaceAt replaces brackets at flat [open, close, ...] positions with the pair matching to, then switches to normal mode

func SwitchCase

func SwitchCase(e *view.Editor)

SwitchCase toggles the case of every character in each selection

func SwitchToLowercase

func SwitchToLowercase(e *view.Editor)

SwitchToLowercase converts every character in each selection to lowercase

func SwitchToUppercase

func SwitchToUppercase(e *view.Editor)

SwitchToUppercase converts every character in each selection to uppercase

func ToggleBlockComments

func ToggleBlockComments(e *view.Editor)

ToggleBlockComments toggles block comments on each selection range

func ToggleComments

func ToggleComments(e *view.Editor)

ToggleComments toggles the most appropriate comment style for the language: block comments if already block-commented, line comments otherwise

func ToggleLineComments

func ToggleLineComments(e *view.Editor)

ToggleLineComments toggles line comments on the selected lines

func TrimSelections

func TrimSelections(e *view.Editor)

TrimSelections trims leading and trailing whitespace from each selection range. Empty or all-whitespace ranges are dropped. When all ranges are dropped the selection falls back to a single cursor at the primary position

func Unindent

func Unindent(e *view.Editor)

Unindent removes one indentation unit from the start of each selected line

func Yank

func Yank(e *view.Editor)

Yank copies the text of every selection range to the active register (defaulting to '"') and exits select mode

func YankJoin

func YankJoin(e *view.Editor, sep string)

YankJoin yanks all selection text joined by a separator to the active register (default '"'). Mirrors :yank-join

func YankMain added in v0.3.0

func YankMain(e *view.Editor)

YankMain copies only the primary selection to the active register

func YankToClipboard

func YankToClipboard(e *view.Editor)

YankToClipboard copies all selection text to the system clipboard

func YankToPrimaryClipboard

func YankToPrimaryClipboard(e *view.Editor)

YankToPrimaryClipboard copies all selections to the primary clipboard

Types

type FindCharArgs

type FindCharArgs struct {
	Editor    *view.Editor
	Char      rune
	Forward   bool
	Inclusive bool
	Extend    bool
}

FindCharArgs holds the parameters for a FindChar operation

type GotoTarget

type GotoTarget struct {
	Path string
	URL  string
}

GotoTarget is the resolved target under the primary cursor

func GotoFileTarget

func GotoFileTarget(e *view.Editor) (GotoTarget, error)

GotoFileTarget resolves the file or URL target under the primary cursor

type RunFormatterArgs

type RunFormatterArgs struct {
	Editor  *view.Editor
	Doc     *view.Document
	ViewID  view.Id
	Command string
	Argv    []string
}

RunFormatterArgs is a parameter bundle for RunFormatter

type SortSelectionsArgs added in v0.2.0

type SortSelectionsArgs struct {
	Reverse     bool
	Insensitive bool
}

SortSelectionsArgs selects the sort order and whether case is ignored

type SurroundReplaceArgs added in v0.2.0

type SurroundReplaceArgs struct {
	Editor  *view.Editor
	Current rune
	Wanted  rune
}

SurroundReplaceArgs names the surrounding pair to replace and the pair to replace it with, each identified by either of its brackets

type SystemClipboard

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

SystemClipboard talks to the OS clipboard via an external command, detected once at construction and reused for every read and write

func NewSystemClipboard

func NewSystemClipboard() *SystemClipboard

NewSystemClipboard returns the host's clipboard provider

func (*SystemClipboard) Available

func (c *SystemClipboard) Available() bool

Available reports whether the host offers a clipboard

func (*SystemClipboard) Read

func (c *SystemClipboard) Read() (string, error)

Read returns the system clipboard contents

func (*SystemClipboard) ReadPrimary

func (c *SystemClipboard) ReadPrimary() (string, error)

ReadPrimary returns the primary selection contents

func (*SystemClipboard) Write

func (c *SystemClipboard) Write(text string) error

Write copies text to the system clipboard

func (*SystemClipboard) WritePrimary

func (c *SystemClipboard) WritePrimary(text string) error

WritePrimary copies text to the primary selection

type TTYWriter

type TTYWriter func(text string, primary bool) bool

TTYWriter writes text via OSC 52 to a bound device. Returns true if the write succeeded

Jump to

Keyboard shortcuts

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