Documentation
¶
Overview ¶
Movement and window related funcs
whichkey.go
Index ¶
- Constants
- Variables
- func ApplyBg(color string, style tcell.Style) tcell.Style
- func ApplyTheme(name string)
- func BufferReloadFile(buf *Buffer) error
- func CmdAppendLine(ctx Context)
- func CmdAutocompleteTrigger(ctx Context)
- func CmdBackwardChar(ctx Context) func(Context)
- func CmdBackwardWord(ctx Context)
- func CmdBufferCycle(ctx Context)
- func CmdBufferLast(ctx Context)
- func CmdBufferNext(ctx Context)
- func CmdBufferPrev(ctx Context)
- func CmdChangeBefore(_ Context) func(Context)
- func CmdChangeEndOfLine(ctx Context)
- func CmdChangeInsideBlock(ctx Context)
- func CmdChangeLine(ctx Context)
- func CmdChangeTo(_ Context) func(Context)
- func CmdChangeWORD(ctx Context)
- func CmdChangeWord(ctx Context)
- func CmdCursorBeginningOfTheLine(ctx Context)
- func CmdCursorCenter(ctx Context)
- func CmdCursorFirstNonBlank(ctx Context)
- func CmdCursorLeft(ctx Context)
- func CmdCursorLineDown(ctx Context)
- func CmdCursorLineUp(ctx Context)
- func CmdCursorRight(ctx Context)
- func CmdDeleteBefore(ctx Context) func(Context)
- func CmdDeleteCharBackward(ctx Context)
- func CmdDeleteCharForward(ctx Context)
- func CmdDeleteEndOfLine(ctx Context)
- func CmdDeleteLine(ctx Context)
- func CmdDeleteTo(_ Context) func(Context)
- func CmdDeleteWord(ctx Context)
- func CmdEnsureCursorVisible(ctx Context)
- func CmdEnterInsertMode(ctx Context)
- func CmdEnterInsertModeAppend(ctx Context)
- func CmdExit(ctx Context)
- func CmdExitInsertMode(ctx Context)
- func CmdForceExit(ctx Context)
- func CmdForwardBeforeChar(_ Context) func(Context)
- func CmdForwardToChar(_ Context) func(Context)
- func CmdForwardWord(ctx Context)
- func CmdGotoFile(ctx Context)
- func CmdGotoFileOtherWindow(ctx Context)
- func CmdGotoLine0(ctx Context)
- func CmdGotoLineEnd(ctx Context)
- func CmdGotoLineEndOfFile(ctx Context)
- func CmdGotoMark(ctx Context)
- func CmdIndentLine(ctx Context)
- func CmdIndentLines(ctx Context, startLine, endLine int)
- func CmdIndentOrComplete(ctx Context)
- func CmdJoinNextLine(ctx Context)
- func CmdJumpBack(ctx Context)
- func CmdJumpForward(ctx Context)
- func CmdJumpToggle(ctx Context)
- func CmdKillBuffer(ctx Context)
- func CmdLineOpenAbove(ctx Context)
- func CmdLineOpenBelow(ctx Context)
- func CmdMacroPlay(ctx Context) func(Context)
- func CmdMacroRecord(ctx Context) func(Context)
- func CmdMacroRepeat(ctx Context)
- func CmdMatchPair(ctx Context)
- func CmdNewBuffer(ctx Context)
- func CmdNormalMode(ctx Context)
- func CmdPaste(ctx Context)
- func CmdRedo(ctx Context)
- func CmdReplaceChar(ctx Context) func(Context)
- func CmdSaveFile(ctx Context)
- func CmdScrollDownLine(ctx Context)
- func CmdScrollDownPage(ctx Context)
- func CmdScrollUpLine(ctx Context)
- func CmdScrollUpPage(ctx Context)
- func CmdSearchNext(ctx Context)
- func CmdSearchPrev(ctx Context)
- func CmdSelectionBlockDelete(ctx Context)
- func CmdSelectionBlockYank(ctx Context)
- func CmdSelectionChange(ctx Context)
- func CmdSelectionDelete(ctx Context)
- func CmdSelectionIndent(ctx Context)
- func CmdSelectionUnindent(ctx Context)
- func CmdSetMark(ctx Context) func(Context)
- func CmdToggleComment(ctx Context)
- func CmdToggleIndentGuides(ctx Context)
- func CmdUndo(ctx Context)
- func CmdUnindentLine(ctx Context)
- func CmdUnindentLines(ctx Context, startLine, endLine int)
- func CmdVisitNextLine(ctx Context)
- func CmdVisitPrevLine(ctx Context)
- func CmdVisualBlockInsert(ctx Context)
- func CmdVisualBlockMode(ctx Context)
- func CmdVisualLineMode(ctx Context)
- func CmdVisualMode(ctx Context)
- func CmdWindowClose(ctx Context)
- func CmdWindowCloseAndKillBuffer(ctx Context)
- func CmdWindowCloseOther(ctx Context)
- func CmdWindowMoveToWorkspace_0(ctx Context)
- func CmdWindowMoveToWorkspace_1(ctx Context)
- func CmdWindowMoveToWorkspace_2(ctx Context)
- func CmdWindowMoveToWorkspace_3(ctx Context)
- func CmdWindowMoveToWorkspace_4(ctx Context)
- func CmdWindowMoveToWorkspace_5(ctx Context)
- func CmdWindowMoveToWorkspace_6(ctx Context)
- func CmdWindowMoveToWorkspace_7(ctx Context)
- func CmdWindowMoveToWorkspace_8(ctx Context)
- func CmdWindowMoveToWorkspace_9(ctx Context)
- func CmdWindowNext(ctx Context)
- func CmdWindowToggleLayout(ctx Context)
- func CmdWindowVSplit(ctx Context)
- func CmdWorkspaceSwitch_0(ctx Context)
- func CmdWorkspaceSwitch_1(ctx Context)
- func CmdWorkspaceSwitch_2(ctx Context)
- func CmdWorkspaceSwitch_3(ctx Context)
- func CmdWorkspaceSwitch_4(ctx Context)
- func CmdWorkspaceSwitch_5(ctx Context)
- func CmdWorkspaceSwitch_6(ctx Context)
- func CmdWorkspaceSwitch_7(ctx Context)
- func CmdWorkspaceSwitch_8(ctx Context)
- func CmdWorkspaceSwitch_9(ctx Context)
- func CmdYank(ctx Context)
- func CmdYankBeforeChar(ctx Context) func(Context)
- func CmdYankEol(ctx Context)
- func CmdYankPut(ctx Context)
- func CmdYankPutBefore(ctx Context)
- func CmdYankToChar(_ Context) func(Context)
- func Color(color string) tcell.Style
- func CursorChClass(buf *Buffer, cur *Cursor) chClass
- func CursorChar(buf *Buffer, cur *Cursor) rune
- func CursorDec(buf *Buffer, cur *Cursor) (moved bool)
- func CursorInc(buf *Buffer, cur *Cursor) (moved bool)
- func CursorNumByLine(buf *Buffer, lookie *Element[Line]) int
- func FindColor(color string) (s tcell.Style, found bool)
- func HandleInsertKey(ctx Context, ev *tcell.EventKey)
- func IndentGetNumber(line []rune, indentUnit []rune) int
- func IndentGuideColumns(lineRun []rune) []int
- func IndentGuideSet(lineRun []rune) map[int]bool
- func IndentGuideStyle() tcell.Style
- func MergeStyles(base tcell.Style, color string) tcell.Style
- func ParseFileLocation(text string, cursor int) (filename string, line, ch int)
- func ReloadBufferContent(ctx Context, content string)
- func RenderIndentGuidesForLine(view View, lineRun []rune, textX, scrollX, screenY, viewWidth int, ...)
- func RuneIndexFromVisualCol(line []rune, visCol int) int
- func SearchNext(ctx Context, pattern string)
- func SearchPrev(ctx Context, pattern string)
- func SelectionBlockBounds(sel *Selection) (minLine, maxLine, minChar, maxChar int)
- func SelectionCursorInRange(sel *Selection, c Cursor) bool
- func SelectionDelete(ctx Context)
- func SelectionStart(buf *Buffer, cur *Cursor)
- func SelectionStop(buf *Buffer, cur *Cursor)
- func SelectionToString(buf *Buffer, sel *Selection) string
- func SnippetParse(s string) (str string, cursorPos int)
- func TabstopActivate(ctx Context, pos []SnippetTabstopLocation)
- func TabstopNext(ctx Context)
- func Tabstopped(ctx Context) bool
- func TextDelete(buf *Buffer, selection *Selection)
- func TextInsert(buf *Buffer, line *Element[Line], pos int, text string)
- func TextObjectBlock(buf *Buffer, ch rune, include bool) (found bool, sel *Selection, cur Cursor)
- func TextObjectWord(ctx Context, bigword bool) (start, end int)
- func TreeSitterHighlighterGo(e *Editor)
- func VisitAtLine(ctx Context, sourceBuf *Buffer, opts VisitOptions) error
- func VisualCol(line []rune, char int) int
- func WindowCursorSet(win *Window, buf *Buffer, cur *Cursor)
- func WithSelection(fn func(Context)) func(Context)
- type AutocompleteFn
- type BlameInfo
- type Buffer
- func (b *Buffer) Append(s string)
- func (b *Buffer) CountLines() int
- func (b *Buffer) GetName() string
- func (buf *Buffer) GetRootRir() string
- func (b *Buffer) Mode() Mode
- func (b *Buffer) ResetLines()
- func (b *Buffer) Save() error
- func (buf *Buffer) SetMode(m Mode)
- func (b *Buffer) String() string
- func (b *Buffer) TxEnd()
- func (b *Buffer) TxStart() (started bool)
- type CmdDefinition
- type CommitItem
- type CompletionItems
- type CompletionTextEdit
- type ConfirmWidget
- type Context
- type Cursor
- type Documentation
- type Driver
- type EditDiff
- type Editor
- func (e *Editor) ActiveBuffer() *Buffer
- func (e *Editor) ActiveWindow() *Window
- func (e *Editor) BufferFindByFilePath(fp string, create bool) *Buffer
- func (e *Editor) EchoMessage(msg string)
- func (e *Editor) EnsureBufferIsVisible(b *Buffer)
- func (e *Editor) GetActiveWorkspace() *Workspace
- func (e *Editor) GetWorkspace(num int) *Workspace
- func (e *Editor) HandleInput(ev *tcell.EventKey)
- func (e *Editor) LogError(err error, echo ...bool)
- func (e *Editor) LogMessage(msg ...string)
- func (e *Editor) NewContext() Context
- func (e *Editor) OpenFile(path string) (*Buffer, error)
- func (e *Editor) PopUi()
- func (e *Editor) PopUiComponent(c UiComponent)
- func (e *Editor) PushUi(c UiComponent)
- func (e *Editor) ReadConfigFile()
- func (e *Editor) Redraw()
- func (e *Editor) RuntimeDir(elems ...string) string
- func (e *Editor) ScreenSync()
- func (e *Editor) SetActiveWindow(w *Window)
- func (e *Editor) SetWindows(w []*Window)
- func (e *Editor) Windows() []*Window
- type EditorConfig
- type Element
- type Event
- type EventBufferModeChange
- type EventBufferReloaded
- type EventKeyPressed
- type EventTextChange
- type EventsManager
- type GitViewItem
- type Highlighter
- type HighlighterCursor
- type HighlighterNode
- type Indent
- type Jump
- type Jumps
- type KeyFallbackFn
- type KeyHandler
- func (k *KeyHandler) Fallback(fn func(ctx Context, ev *tcell.EventKey))
- func (k *KeyHandler) GetCount() int
- func (k *KeyHandler) GetFallback() KeyFallbackFn
- func (k *KeyHandler) HandleKey(editor *Editor, ev *tcell.EventKey, mode Mode)
- func (k *KeyHandler) Map(mode Mode, newMappings KeyMap)
- func (k *KeyHandler) SetContextFn(fn func(editor *Editor) Context)
- type KeyMap
- type LangConfig
- type Language
- type LanguageServerConfig
- type Layout
- type Line
- type List
- type Location
- type LspManager
- func (l *LspManager) Completion(buf *Buffer) (res CompletionItems)
- func (l *LspManager) CompletionItemResolve(buf *Buffer, item any) (doc string, err error)
- func (l *LspManager) Definition(buf *Buffer, cursor Cursor) (filePath string, cur Cursor)
- func (m *LspManager) Diagnostics(buf *Buffer, lineNum int) []protocol.Diagnostic
- func (l *LspManager) DidChange(event EventTextChange)
- func (l *LspManager) DidClose(buf *Buffer)
- func (l *LspManager) DidOpen(buf *Buffer)
- func (l *LspManager) DidSave(buf *Buffer)
- func (l *LspManager) Hover(buf *Buffer, cursor Cursor) (sign string)
- func (l *LspManager) Signature(buf *Buffer, cursor Cursor) (sign string)
- type MacrosManager
- func (m *MacrosManager) Play(reg string)
- func (m *MacrosManager) Push(ev *tcell.EventKey)
- func (m *MacrosManager) Recording() bool
- func (m *MacrosManager) Reset()
- func (m *MacrosManager) Start(reg string)
- func (m *MacrosManager) StartRepeatRecording()
- func (m *MacrosManager) Stop()
- func (m *MacrosManager) StopRepeatRecording()
- type Mark
- type Mode
- type ModeKeyMap
- type Position
- type PositionCache
- type PositionEntry
- type ProjectManager
- type Range
- type RenderPlane
- type Selection
- type Snippet
- type SnippetTabstopLocation
- type SnippetsManager
- type Stack
- type Style
- type Theme
- type Transaction
- type TreeSitterHighlighter
- type UiComponent
- type UndoRedo
- type View
- type VisitOptions
- type VisualBlockInsertState
- type WhichKey
- type Window
- type Workspace
- type WorkspaceCache
- type WorkspaceCacheEntry
- type Yanks
Constants ¶
const IndentGuideGlyph = "│"
IndentGuideGlyph is the character used to draw vertical indent guides.
Variables ¶
var AllCommands = map[string]CmdDefinition{}
var EOL int = math.MinInt32
var LastSearchPattern string
var MarksPopupFactory func(ctx Context, marks map[rune]Mark)
MarksPopupFactory allows the `ui` package to register a popup for marks without causing a circular import.
Functions ¶
func ApplyTheme ¶
func ApplyTheme(name string)
func BufferReloadFile ¶
func CmdAppendLine ¶
func CmdAppendLine(ctx Context)
func CmdAutocompleteTrigger ¶
func CmdAutocompleteTrigger(ctx Context)
func CmdBackwardChar ¶
func CmdBackwardWord ¶
func CmdBackwardWord(ctx Context)
func CmdBufferLast ¶
func CmdBufferLast(ctx Context)
func CmdBufferNext ¶
func CmdBufferNext(ctx Context)
func CmdBufferPrev ¶
func CmdBufferPrev(ctx Context)
func CmdChangeBefore ¶
func CmdChangeEndOfLine ¶
func CmdChangeEndOfLine(ctx Context)
func CmdChangeInsideBlock ¶
func CmdChangeInsideBlock(ctx Context)
func CmdChangeLine ¶
func CmdChangeLine(ctx Context)
func CmdChangeTo ¶
func CmdChangeWORD ¶
func CmdChangeWORD(ctx Context)
func CmdChangeWord ¶
func CmdChangeWord(ctx Context)
func CmdCursorBeginningOfTheLine ¶
func CmdCursorBeginningOfTheLine(ctx Context)
func CmdCursorCenter ¶
func CmdCursorCenter(ctx Context)
func CmdCursorFirstNonBlank ¶
func CmdCursorFirstNonBlank(ctx Context)
func CmdCursorLeft ¶
func CmdCursorLeft(ctx Context)
func CmdCursorLineDown ¶
func CmdCursorLineDown(ctx Context)
func CmdCursorLineUp ¶
func CmdCursorLineUp(ctx Context)
func CmdCursorRight ¶
func CmdCursorRight(ctx Context)
func CmdDeleteBefore ¶
func CmdDeleteCharBackward ¶
func CmdDeleteCharBackward(ctx Context)
func CmdDeleteCharForward ¶
func CmdDeleteCharForward(ctx Context)
func CmdDeleteEndOfLine ¶
func CmdDeleteEndOfLine(ctx Context)
func CmdDeleteLine ¶
func CmdDeleteLine(ctx Context)
func CmdDeleteTo ¶
func CmdDeleteWord ¶
func CmdDeleteWord(ctx Context)
func CmdEnsureCursorVisible ¶
func CmdEnsureCursorVisible(ctx Context)
func CmdEnterInsertMode ¶
func CmdEnterInsertMode(ctx Context)
func CmdEnterInsertModeAppend ¶
func CmdEnterInsertModeAppend(ctx Context)
func CmdExitInsertMode ¶
func CmdExitInsertMode(ctx Context)
func CmdForceExit ¶
func CmdForceExit(ctx Context)
func CmdForwardBeforeChar ¶
func CmdForwardToChar ¶
func CmdForwardWord ¶
func CmdForwardWord(ctx Context)
func CmdGotoFile ¶
func CmdGotoFile(ctx Context)
func CmdGotoFileOtherWindow ¶
func CmdGotoFileOtherWindow(ctx Context)
func CmdGotoLine0 ¶
func CmdGotoLine0(ctx Context)
func CmdGotoLineEnd ¶
func CmdGotoLineEnd(ctx Context)
func CmdGotoLineEndOfFile ¶
func CmdGotoLineEndOfFile(ctx Context)
func CmdIndentLine ¶
func CmdIndentLine(ctx Context)
Get number if "indents" in provided line Indent unit can be \t, or any number of spaces. eg. 2 or 4.
func CmdIndentLines ¶
func CmdIndentOrComplete ¶
func CmdIndentOrComplete(ctx Context)
func CmdJoinNextLine ¶
func CmdJoinNextLine(ctx Context)
func CmdJumpBack ¶
func CmdJumpBack(ctx Context)
func CmdJumpForward ¶
func CmdJumpForward(ctx Context)
func CmdJumpToggle ¶
func CmdJumpToggle(ctx Context)
CmdJumpToggle toggles between the previous and current jump locations (pingpong).
func CmdKillBuffer ¶
func CmdKillBuffer(ctx Context)
func CmdLineOpenAbove ¶
func CmdLineOpenAbove(ctx Context)
func CmdLineOpenBelow ¶
func CmdLineOpenBelow(ctx Context)
func CmdMacroPlay ¶
func CmdMacroRecord ¶
func CmdMacroRepeat ¶
func CmdMacroRepeat(ctx Context)
func CmdMatchPair ¶
func CmdMatchPair(ctx Context)
func CmdNewBuffer ¶
func CmdNewBuffer(ctx Context)
func CmdNormalMode ¶
func CmdNormalMode(ctx Context)
func CmdReplaceChar ¶
func CmdSaveFile ¶
func CmdSaveFile(ctx Context)
func CmdScrollDownLine ¶
func CmdScrollDownLine(ctx Context)
func CmdScrollDownPage ¶
func CmdScrollDownPage(ctx Context)
func CmdScrollUpLine ¶
func CmdScrollUpLine(ctx Context)
func CmdScrollUpPage ¶
func CmdScrollUpPage(ctx Context)
func CmdSearchNext ¶
func CmdSearchNext(ctx Context)
func CmdSearchPrev ¶
func CmdSearchPrev(ctx Context)
func CmdSelectionBlockDelete ¶
func CmdSelectionBlockDelete(ctx Context)
CmdSelectionBlockDelete deletes the rectangular column range [minVisCol,maxVisCol] on every line in [minLine,maxLine], independently per line (ragged lines are clipped, never merged) — unlike SelectionDelete's single contiguous stream cut.
func CmdSelectionBlockYank ¶
func CmdSelectionBlockYank(ctx Context)
CmdSelectionBlockYank captures the rectangular column range [minVisCol,maxVisCol] on every line in [minLine,maxLine] as a single block register entry, one line per row (independent per-line clipping, no stream join).
func CmdSelectionChange ¶
func CmdSelectionChange(ctx Context)
func CmdSelectionDelete ¶
func CmdSelectionDelete(ctx Context)
func CmdSelectionIndent ¶
func CmdSelectionIndent(ctx Context)
func CmdSelectionUnindent ¶
func CmdSelectionUnindent(ctx Context)
func CmdSetMark ¶
CmdSetMark waits for a character input and sets a mark at the current cursor position.
func CmdToggleComment ¶
func CmdToggleComment(ctx Context)
TODO: implement correct toggle comment logic: check if all lines are commented - then uncomment. else, append comment to each uncommted line.
func CmdToggleIndentGuides ¶
func CmdToggleIndentGuides(ctx Context)
CmdToggleIndentGuides flips the IndentGuides config flag at runtime so you can show/hide virtual indent guides without restarting. The initial value comes from the "indent_guides" key in config.toml (default: true).
func CmdUnindentLine ¶
func CmdUnindentLine(ctx Context)
func CmdUnindentLines ¶
func CmdVisitNextLine ¶
func CmdVisitNextLine(ctx Context)
func CmdVisitPrevLine ¶
func CmdVisitPrevLine(ctx Context)
func CmdVisualBlockInsert ¶
func CmdVisualBlockInsert(ctx Context)
func CmdVisualBlockMode ¶
func CmdVisualBlockMode(ctx Context)
func CmdVisualLineMode ¶
func CmdVisualLineMode(ctx Context)
func CmdVisualMode ¶
func CmdVisualMode(ctx Context)
func CmdWindowClose ¶
func CmdWindowClose(ctx Context)
func CmdWindowCloseAndKillBuffer ¶
func CmdWindowCloseAndKillBuffer(ctx Context)
func CmdWindowCloseOther ¶
func CmdWindowCloseOther(ctx Context)
func CmdWindowMoveToWorkspace_0 ¶
func CmdWindowMoveToWorkspace_0(ctx Context)
func CmdWindowMoveToWorkspace_1 ¶
func CmdWindowMoveToWorkspace_1(ctx Context)
func CmdWindowMoveToWorkspace_2 ¶
func CmdWindowMoveToWorkspace_2(ctx Context)
func CmdWindowMoveToWorkspace_3 ¶
func CmdWindowMoveToWorkspace_3(ctx Context)
func CmdWindowMoveToWorkspace_4 ¶
func CmdWindowMoveToWorkspace_4(ctx Context)
func CmdWindowMoveToWorkspace_5 ¶
func CmdWindowMoveToWorkspace_5(ctx Context)
func CmdWindowMoveToWorkspace_6 ¶
func CmdWindowMoveToWorkspace_6(ctx Context)
func CmdWindowMoveToWorkspace_7 ¶
func CmdWindowMoveToWorkspace_7(ctx Context)
func CmdWindowMoveToWorkspace_8 ¶
func CmdWindowMoveToWorkspace_8(ctx Context)
func CmdWindowMoveToWorkspace_9 ¶
func CmdWindowMoveToWorkspace_9(ctx Context)
func CmdWindowNext ¶
func CmdWindowNext(ctx Context)
func CmdWindowToggleLayout ¶
func CmdWindowToggleLayout(ctx Context)
func CmdWindowVSplit ¶
func CmdWindowVSplit(ctx Context)
func CmdWorkspaceSwitch_0 ¶
func CmdWorkspaceSwitch_0(ctx Context)
func CmdWorkspaceSwitch_1 ¶
func CmdWorkspaceSwitch_1(ctx Context)
func CmdWorkspaceSwitch_2 ¶
func CmdWorkspaceSwitch_2(ctx Context)
func CmdWorkspaceSwitch_3 ¶
func CmdWorkspaceSwitch_3(ctx Context)
func CmdWorkspaceSwitch_4 ¶
func CmdWorkspaceSwitch_4(ctx Context)
func CmdWorkspaceSwitch_5 ¶
func CmdWorkspaceSwitch_5(ctx Context)
func CmdWorkspaceSwitch_6 ¶
func CmdWorkspaceSwitch_6(ctx Context)
func CmdWorkspaceSwitch_7 ¶
func CmdWorkspaceSwitch_7(ctx Context)
func CmdWorkspaceSwitch_8 ¶
func CmdWorkspaceSwitch_8(ctx Context)
func CmdWorkspaceSwitch_9 ¶
func CmdWorkspaceSwitch_9(ctx Context)
func CmdYankBeforeChar ¶
func CmdYankEol ¶
func CmdYankEol(ctx Context)
func CmdYankPut ¶
func CmdYankPut(ctx Context)
func CmdYankPutBefore ¶
func CmdYankPutBefore(ctx Context)
func CmdYankToChar ¶
func CursorChClass ¶
func HandleInsertKey ¶
func IndentGetNumber ¶
func IndentGuideColumns ¶
IndentGuideColumns returns the visual column positions (0-indexed from the start of the text content) where vertical indent guide lines should be drawn for the given line content.
A guide is placed at the first visual column of each tab-stop within the line's leading whitespace — one guide per indent level. For example, a line indented with two tabs (tab width 4) produces guides at visual columns 0 and 4 (i.e. "|\t|\tcode").
Lines with less than one tab-stop of leading whitespace produce no guides.
func IndentGuideSet ¶
IndentGuideSet returns a map of visual columns that have indent guides, suitable for O(1) lookup during per-character rendering. Returns nil if the line has no indent guides.
func IndentGuideStyle ¶
IndentGuideStyle returns the tcell style for indent guide lines. Configure the color via the "ui.indentguide" key in your theme.
func ParseFileLocation ¶
ParseFileLocation scans a line of text and extracts a filename under the cursor, optionally followed by :line or :line:column (both integers).
Example valid forms:
"main.go" "src/foo/bar.go:42" "app/server.go:101:8"
If line or column are missing, the returned values for line and ch will be -1.
func ReloadBufferContent ¶
ReloadBufferContent replaces the buffer's contents with the given text, recorded as a single undo/redo transaction. Use this instead of BufferReloadFile whenever the caller wants undo to work across the reload.
func RenderIndentGuidesForLine ¶
func RenderIndentGuidesForLine(view View, lineRun []rune, textX, scrollX, screenY, viewWidth int, style tcell.Style)
RenderIndentGuidesForLine draws indent guide characters for a single rendered line. Call this AFTER the line's text content has been rendered, as it overwrites whitespace cells with the guide glyph.
style is supplied by the caller rather than computed here so that lines with a background already painted over them (e.g. the cursorline) can pass a blended style (see ApplyBg("ui.cursorline", IndentGuideStyle())). Using a flat, backgroundless style unconditionally would reset those cells back to the default background, punching a solid block out of the cursorline highlight instead of drawing a thin guide over it.
Parameters:
- view: the render target
- lineRun: the rune content of the line being rendered
- textX: screen X where the first visible text column is drawn
- scrollX: horizontal scroll offset in visual columns (0 = no scroll)
- screenY: screen Y of this line
- viewWidth: number of columns available for text
- style: the style to draw the guide glyph with (see IndentGuideStyle)
func RuneIndexFromVisualCol ¶
RuneIndexFromVisualCol finds the rune index that corresponds to a given visual screen column.
func SearchNext ¶
Move cursor to the next search pattern match
func SearchPrev ¶
func SelectionBlockBounds ¶
SelectionBlockBounds returns the rectangular bounds of a block selection, independent per axis (unlike SelectionNormalize, which couples Line/Char).
func SelectionCursorInRange ¶
func SelectionDelete ¶
func SelectionDelete(ctx Context)
func SelectionStart ¶
func SelectionStop ¶
func SelectionToString ¶
func SnippetParse ¶
func TabstopActivate ¶
func TabstopActivate(ctx Context, pos []SnippetTabstopLocation)
func TabstopNext ¶
func TabstopNext(ctx Context)
func Tabstopped ¶
func TextDelete ¶
func TextObjectBlock ¶
Returns selection inside '(', '{', '[' as "Selection" range. This implementation is simple and does not check if open/close symbols are "balanced". TODO: rewrite
func TextObjectWord ¶
func TreeSitterHighlighterGo ¶
func TreeSitterHighlighterGo(e *Editor)
func VisitAtLine ¶
func VisitAtLine(ctx Context, sourceBuf *Buffer, opts VisitOptions) error
func WindowCursorSet ¶
func WithSelection ¶
Types ¶
type AutocompleteFn ¶
type Buffer ¶
type Buffer struct {
FilePath string
Lines List[Line]
Selection *Selection
Driver Driver
IndentCh []rune
Tx *Transaction
UndoRedo *UndoRedo
Highlighter Highlighter
KeyHandler *KeyHandler
GitSigns map[int]rune
BlameEnabled bool
BlameLines map[int]BlameInfo
BlameWidth int
VisualBlockInsert *VisualBlockInsertState
OpenCount int
Dirty bool
// contains filtered or unexported fields
}
func BufferReadFile ¶
func (*Buffer) CountLines ¶
func (*Buffer) GetRootRir ¶
type CmdDefinition ¶
type CmdDefinition struct {
Desc string
Fn interface{}
}
type CommitItem ¶
CommitItem represents a single commit entry in the git log.
type CompletionItems ¶
type CompletionItems struct {
IsIncomplete bool `json:"isIncomplete"`
Items []struct {
Label string `json:"label"`
InsertText string `json:"insertText"`
Kind int `json:"kind"`
Detail string `json:"detail"`
Documentation Documentation `json:"documentation"`
Preselect bool `json:"preselect,omitempty"`
SortText string `json:"sortText"`
FilterText string `json:"filterText,omitempty"`
InsertTextFormat int `json:"insertTextFormat"`
TextEdit *CompletionTextEdit `json:"textEdit,omitempty"`
AdditionalTextEdits []struct {
Range struct {
Start struct {
Line int `json:"line"`
Character int `json:"character"`
} `json:"start"`
End struct {
Line int `json:"line"`
Character int `json:"character"`
} `json:"end"`
} `json:"range"`
NewText string `json:"newText"`
} `json:"additionalTextEdits,omitempty"`
Data interface{} `json:"data,omitempty"`
} `json:"items"`
}
type CompletionTextEdit ¶
type CompletionTextEdit struct {
NewText string `json:"newText"`
Insert struct {
Start struct {
Line int `json:"line"`
Character int `json:"character"`
} `json:"start"`
End struct {
Line int `json:"line"`
Character int `json:"character"`
} `json:"end"`
} `json:"insert"`
Replace struct {
Start struct {
Line int `json:"line"`
Character int `json:"character"`
} `json:"start"`
End struct {
Line int `json:"line"`
Character int `json:"character"`
} `json:"end"`
} `json:"replace"`
}
type ConfirmWidget ¶
type ConfirmWidget struct {
// contains filtered or unexported fields
}
func ConfirmInit ¶
func ConfirmInit(ctx Context, prompt string, onYes func(), onNo func(), onCancel func()) *ConfirmWidget
func (*ConfirmWidget) Keymap ¶
func (u *ConfirmWidget) Keymap() *KeyHandler
func (*ConfirmWidget) Mode ¶
func (u *ConfirmWidget) Mode() Mode
func (*ConfirmWidget) Plane ¶
func (u *ConfirmWidget) Plane() RenderPlane
func (*ConfirmWidget) Render ¶
func (u *ConfirmWidget) Render(view View)
type Documentation ¶
func (*Documentation) UnmarshalJSON ¶
func (d *Documentation) UnmarshalJSON(data []byte) error
type Driver ¶
type Driver interface {
// Execute thing under cursor: line or seleciton
Exec(*Editor, *Buffer, *Element[Line])
// Execute whole buffer
ExecBuffer()
}
Driver represents anything that can run selected text. it can be sql connection, or rest client.
type Editor ¶
type Editor struct {
View View
Keys *KeyHandler
Buffers []*Buffer
UiComponents []UiComponent
ExitCh chan int
RedrawCh chan int
ScreenSyncCh chan int
Layout Layout
Yanks List[yank]
Projects ProjectManager
Message string // display in echo area
Lsp *LspManager
Events *EventsManager
AutocompleteTrigger AutocompleteFn
Snippets *SnippetsManager
Config EditorConfig
Workspaces []Workspace
ActiveWorkspace int
}
var EditorInst *Editor
func NewEditor ¶
func NewEditor( view View, keys *KeyHandler, ) *Editor
func (*Editor) ActiveBuffer ¶
Returns active window buffer. May return nil when the active workspace has no active window/buffer, e.g. transiently after ":q" closed the last window.
func (*Editor) ActiveWindow ¶
func (*Editor) BufferFindByFilePath ¶
Find or create new buffer by its full file path
func (*Editor) EchoMessage ¶
func (*Editor) EnsureBufferIsVisible ¶
func (*Editor) GetActiveWorkspace ¶
func (*Editor) GetWorkspace ¶
func (*Editor) HandleInput ¶
func (*Editor) LogMessage ¶
func (*Editor) NewContext ¶
func (*Editor) PopUiComponent ¶
func (e *Editor) PopUiComponent(c UiComponent)
PopUiComponent removes a specific UI component from the stack. This is required for WhichKey because commands executed from WhichKey can push their own UI components (Picker, CommandLine, etc.) before WhichKey.Close is called. Using PopUi in that case removes the newly pushed component instead of WhichKey, leaving WhichKey stuck on screen.
func (*Editor) PushUi ¶
func (e *Editor) PushUi(c UiComponent)
func (*Editor) ReadConfigFile ¶
func (e *Editor) ReadConfigFile()
func (*Editor) RuntimeDir ¶
func (*Editor) ScreenSync ¶
func (e *Editor) ScreenSync()
func (*Editor) SetActiveWindow ¶
func (*Editor) SetWindows ¶
type EditorConfig ¶
type EditorConfig struct {
Theme string
ShowLineNumbers bool
RelativeLineNumbers bool
CurrentLineAbsolute bool // If true, shows absolute line number on current line when relative is on
FormatOnSave bool
GitStatusView string // "full" or "split"
GitBlameView string // "full" or "split"
IndentGuides bool
FloatingWindowWidth float64
FloatingWindowHeight float64
}
type EventBufferModeChange ¶
type EventBufferReloaded ¶
type EventBufferReloaded struct {
Buf *Buffer
}
type EventKeyPressed ¶
type EventKeyPressed struct {
Key string
}
type EventTextChange ¶
type EventsManager ¶
type EventsManager struct {
// contains filtered or unexported fields
}
func NewEventsManager ¶
func NewEventsManager() *EventsManager
func (*EventsManager) Broadcast ¶
func (e *EventsManager) Broadcast(msg any)
this is very quick and dirty implementation. we need sync processing to not mess up lsp and treesitter. TODO: rewrite.
func (*EventsManager) Subscribe ¶
func (e *EventsManager) Subscribe() <-chan Event
func (*EventsManager) Unsubscribe ¶
func (e *EventsManager) Unsubscribe(ch <-chan Event)
type GitViewItem ¶
type GitViewItem struct {
Type string // "header", "separator", "empty", "blank", "file", "branch", "stash"
Label string
Status string // "staged", "unstaged", "untracked", "last_commit", "branch", "active_branch", "stash"
FilePath string
Code string
StashRef string
}
GitViewItem represents a single line in the git status view panel.
type Highlighter ¶
type Highlighter interface {
// Full document build/re-build/init
Build()
TextChanged(EventTextChange)
// Query syntax highlights for given range
ForRange(startLine, endLine uint32) *HighlighterCursor
}
type HighlighterCursor ¶
type HighlighterCursor struct {
Cursor *Element[HighlighterNode]
}
func (*HighlighterCursor) Seek ¶
func (c *HighlighterCursor) Seek(line, ch uint32) (node *Element[HighlighterNode], found bool)
type HighlighterNode ¶
type Jumps ¶
func (*Jumps) JumpForward ¶
func (j *Jumps) JumpForward()
type KeyFallbackFn ¶
type KeyHandler ¶
type KeyHandler struct {
// enable suppor for repeat counter.
EnableTimes bool
Macros *MacrosManager
// contains filtered or unexported fields
}
func DefaultKeyHandler ¶
func DefaultKeyHandler(mergeKeys ModeKeyMap) *KeyHandler
func NewKeyHandler ¶
func NewKeyHandler(mkeys ModeKeyMap) *KeyHandler
func (*KeyHandler) Fallback ¶
func (k *KeyHandler) Fallback(fn func(ctx Context, ev *tcell.EventKey))
func (*KeyHandler) GetCount ¶
func (k *KeyHandler) GetCount() int
func (*KeyHandler) GetFallback ¶
func (k *KeyHandler) GetFallback() KeyFallbackFn
func (*KeyHandler) HandleKey ¶
func (k *KeyHandler) HandleKey(editor *Editor, ev *tcell.EventKey, mode Mode)
func (*KeyHandler) Map ¶
func (k *KeyHandler) Map(mode Mode, newMappings KeyMap)
Map/merge keymap by selected mode
func (*KeyHandler) SetContextFn ¶
func (k *KeyHandler) SetContextFn(fn func(editor *Editor) Context)
type LangConfig ¶
type LangConfig struct {
Languages []Language `toml:"language,omitempty"`
LanguageServers map[string]LanguageServerConfig `toml:"language-server,omitempty"`
}
func LoadLanguagesConfig ¶
func LoadLanguagesConfig() LangConfig
type Language ¶
type Language struct {
Name string `toml:"name"`
FileTypes []any `toml:"file-types"`
LanguageServers []any `toml:"language-servers"`
Indent Indent `toml:"indent,omitempty"`
}
func (Language) GetFileTypes ¶
func (Language) GetLanguageServers ¶
type LanguageServerConfig ¶
type LanguageServerConfig struct {
Language Language
Command string `toml:"command"`
Args []string `toml:"args"`
}
func LspConfigByFileName ¶
func LspConfigByFileName(file string) (conf LanguageServerConfig, found bool)
type List ¶
the zero value is ready to use.
type LspManager ¶
type LspManager struct {
// contains filtered or unexported fields
}
func NewLspManager ¶
func NewLspManager(e *Editor) *LspManager
func (*LspManager) Completion ¶
func (l *LspManager) Completion(buf *Buffer) (res CompletionItems)
func (*LspManager) CompletionItemResolve ¶
func (l *LspManager) CompletionItemResolve(buf *Buffer, item any) (doc string, err error)
CompletionItemResolve requests the full documentation/detail for a completion item by calling completionItem/resolve on the language server. The item parameter should be the raw completion item (or a map containing at least label, kind, and data) received from a prior Completion call.
func (*LspManager) Definition ¶
func (l *LspManager) Definition(buf *Buffer, cursor Cursor) (filePath string, cur Cursor)
func (*LspManager) Diagnostics ¶
func (m *LspManager) Diagnostics(buf *Buffer, lineNum int) []protocol.Diagnostic
TODO: return copy of diagnostics
func (*LspManager) DidChange ¶
func (l *LspManager) DidChange(event EventTextChange)
func (*LspManager) DidClose ¶
func (l *LspManager) DidClose(buf *Buffer)
func (*LspManager) DidOpen ¶
func (l *LspManager) DidOpen(buf *Buffer)
func (*LspManager) DidSave ¶
func (l *LspManager) DidSave(buf *Buffer)
type MacrosManager ¶
type MacrosManager struct {
Register string
// contains filtered or unexported fields
}
func NewMacrosManager ¶
func NewMacrosManager(keyHandler *KeyHandler) *MacrosManager
func (*MacrosManager) Play ¶
func (m *MacrosManager) Play(reg string)
func (*MacrosManager) Push ¶
func (m *MacrosManager) Push(ev *tcell.EventKey)
func (*MacrosManager) Recording ¶
func (m *MacrosManager) Recording() bool
func (*MacrosManager) Reset ¶
func (m *MacrosManager) Reset()
func (*MacrosManager) Start ¶
func (m *MacrosManager) Start(reg string)
func (*MacrosManager) StartRepeatRecording ¶
func (m *MacrosManager) StartRepeatRecording()
func (*MacrosManager) Stop ¶
func (m *MacrosManager) Stop()
func (*MacrosManager) StopRepeatRecording ¶
func (m *MacrosManager) StopRepeatRecording()
type Mark ¶
Mark is a named cursor position bound to a specific buffer. When text is inserted or deleted in its buffer, the mark is adjusted so that it keeps pointing at the same text (vim-like behavior).
type ModeKeyMap ¶
type PositionCache ¶
type PositionCache struct {
Files map[string]PositionEntry `toml:"files"`
}
func LoadPositionCache ¶
func LoadPositionCache() *PositionCache
func (*PositionCache) Save ¶
func (c *PositionCache) Save()
type PositionEntry ¶
type ProjectManager ¶
type ProjectManager struct {
// contains filtered or unexported fields
}
func NewProjectManager ¶
func NewProjectManager() ProjectManager
func (ProjectManager) Dir ¶
func (p ProjectManager) Dir(buf *Buffer) (dir string)
Returns Dir of current buffer or working directory if buffer has no valid file path.
func (ProjectManager) FindRoot ¶
func (p ProjectManager) FindRoot(buf *Buffer) (root string, err error)
Find project root by file path. Project root must have .git directory in it. otherwise "working directory" will be returned.
func (ProjectManager) GetRoot ¶
func (p ProjectManager) GetRoot() (root string)
TODO: this must be also base on git dir
type RenderPlane ¶
type RenderPlane int
const ( PlaneWin RenderPlane = 0 PlaneEditor RenderPlane = 1 )
type Selection ¶
func SelectionNormalize ¶
type SnippetTabstopLocation ¶
func SnippetParseLocations ¶
func SnippetParseLocations(s string) (str string, pos []SnippetTabstopLocation)
type SnippetsManager ¶
type SnippetsManager struct {
// contains filtered or unexported fields
}
func NewSnippetsManager ¶
func NewSnippetsManager() *SnippetsManager
func (*SnippetsManager) Complete ¶
func (s *SnippetsManager) Complete(ctx Context) bool
type Transaction ¶
type Transaction struct {
// contains filtered or unexported fields
}
func NewTx ¶
func NewTx(b *Buffer) *Transaction
func (*Transaction) End ¶
func (tx *Transaction) End()
func (*Transaction) Start ¶
func (tx *Transaction) Start()
type TreeSitterHighlighter ¶
type TreeSitterHighlighter struct {
// contains filtered or unexported fields
}
func TreeSitterHighlighterInitBuffer ¶
func TreeSitterHighlighterInitBuffer(e *Editor, buf *Buffer) *TreeSitterHighlighter
func (*TreeSitterHighlighter) Build ¶
func (h *TreeSitterHighlighter) Build()
func (*TreeSitterHighlighter) ForRange ¶
func (h *TreeSitterHighlighter) ForRange(lineStart, lineEnd uint32) *HighlighterCursor
func (*TreeSitterHighlighter) TextChanged ¶
func (h *TreeSitterHighlighter) TextChanged(event EventTextChange)
type UiComponent ¶
type UiComponent interface {
Mode() Mode
Keymap() *KeyHandler
Render(view View)
Plane() RenderPlane
}
type UndoRedo ¶
type UndoRedo struct {
Buf *Buffer
History []EditDiff
Position int
// SavedAtPosition stores the UndoRedo Position at the moment the file was saved.
// If Position == SavedAtPosition, the buffer is not dirty.
SavedAtPosition int
}
func NewUndoRedo ¶
type VisitOptions ¶
type VisualBlockInsertState ¶
type WhichKey ¶
type WhichKey struct {
// contains filtered or unexported fields
}
func WhichKeyInit ¶
func WhichKeyInit(e *Editor, keymap *KeyHandler, mode Mode, items KeyMap) *WhichKey
func (*WhichKey) Keymap ¶
func (w *WhichKey) Keymap() *KeyHandler
func (*WhichKey) Plane ¶
func (w *WhichKey) Plane() RenderPlane
type Window ¶
func CreateWindow ¶
Specify parent window to inherit cursors
func (*Window) VisitBuffer ¶
Jump to buffer and location. Records jump history.
type WorkspaceCache ¶
type WorkspaceCache struct {
Workspaces map[int]WorkspaceCacheEntry `json:"workspaces"`
ActiveWorkspace int `json:"active_workspace"`
}
WorkspaceCache is the on-disk persistence store for workspace state. It is saved to ~/.config/wig/workspaces.json on exit and loaded on startup or when the workspace picker is opened.
func LoadWorkspaceCache ¶
func LoadWorkspaceCache() *WorkspaceCache
LoadWorkspaceCache reads the workspace cache from disk. If the file does not exist or is corrupt, an empty cache is returned.
func (*WorkspaceCache) CaptureAll ¶
func (c *WorkspaceCache) CaptureAll(editor *Editor)
CaptureAll captures the state of every workspace that has at least one window. Workspaces that were never used in this session are skipped so that their cached entries from a previous session are preserved.
func (*WorkspaceCache) CaptureWorkspace ¶
func (c *WorkspaceCache) CaptureWorkspace(num int, ws *Workspace, editor *Editor)
CaptureWorkspace records the file paths open in a workspace into the cache. Only real file-backed buffers are stored; special buffers like [Messages] or [git] are skipped. Duplicate paths are deduplicated.
Previously-cached files are preserved only when they still exist on disk AND are still open in the editor (some buffer holds the path). This keeps files that the user temporarily hid by opening another file in the same window, while dropping files whose buffers were killed. Files are fully cleared from a workspace only via Delete in the picker, or when the computed list is empty (protected below).
func (*WorkspaceCache) RestoreWorkspace ¶
func (c *WorkspaceCache) RestoreWorkspace(editor *Editor, num int)
RestoreWorkspace rebuilds the target workspace from cache if it is currently empty (no real file-backed buffers): every cached file gets its own window so the previous split layout is recreated. If the workspace already has file buffers, the cache is skipped to avoid duplicates.
func (*WorkspaceCache) Save ¶
func (c *WorkspaceCache) Save()
Save writes the workspace cache to disk.
type WorkspaceCacheEntry ¶
type WorkspaceCacheEntry struct {
Files []string `json:"files"`
ActiveFile string `json:"active_file"`
}
WorkspaceCacheEntry stores the file paths and active file for a single workspace so that the workspace layout can be restored in a later editor session.
Source Files
¶
- buffer.go
- buffer_lines.go
- command_registry.go
- confirm.go
- core.go
- cursor.go
- editor.go
- events.go
- git_view_types.go
- highlighter.go
- indent.go
- indent_guide.go
- insert.go
- keys.go
- languages.go
- lsp.go
- lsp_init_json.go
- macros.go
- marks.go
- movements_cmds.go
- position.go
- project.go
- search.go
- selection.go
- snippets.go
- stack.go
- textobject.go
- theme.go
- treesitter.go
- undoredo.go
- visit.go
- whichkey.go
- window.go
- workspace_cache.go
- yank.go
