Documentation
¶
Index ¶
- type CompletionDebounceMsg
- type CompletionRequestMsg
- type CompletionResponseMsg
- type CursorMode
- type DeleteFileMsg
- type DeleteMsg
- type ErrorMsg
- type Model
- func (m *Model) Blur()
- func (m *Model) CursorBlink() tea.Cmd
- func (m *Model) DisableCommandMode(disable bool)
- func (m *Model) DisableInsertMode(disable bool)
- func (m *Model) DisableSearchMode(disable bool)
- func (m *Model) DisableVimMode(disable bool)
- func (m *Model) DisableVisualLineMode(disable bool)
- func (m *Model) DisableVisualMode(disable bool)
- func (m *Model) DispatchError(err error, duration time.Duration) tea.Cmd
- func (m *Model) DispatchMessage(message string, duration time.Duration) tea.Cmd
- func (m *Model) Focus()
- func (m *Model) GetCurrentContent() string
- func (m Model) GetCursorPosition() core.Position
- func (m *Model) GetEditor() core.Editor
- func (m *Model) GetSavedContent() string
- func (m *Model) HasChanges() bool
- func (m *Model) HideLineNumbers(hide bool)
- func (m *Model) HideStatusLine(hide bool)
- func (m Model) Init() tea.Cmd
- func (m *Model) IsCommandMode() bool
- func (m *Model) IsEmpty() bool
- func (m *Model) IsFocused() bool
- func (m *Model) IsInsertMode() bool
- func (m *Model) IsNormalMode() bool
- func (m *Model) IsSearchMode() bool
- func (m *Model) IsVisualLineMode() bool
- func (m *Model) IsVisualMode() bool
- func (m *Model) SetBytes(content []byte)
- func (m *Model) SetCommandMode()
- func (m *Model) SetCompletionMenuMaxVisibleItems(max int)
- func (m Model) SetCompletions(completions []core.Completion, context core.CompletionContext)
- func (m *Model) SetContent(content string)
- func (m *Model) SetCursorMode(mode CursorMode)
- func (m *Model) SetCursorPosition(row, col int) error
- func (m *Model) SetCursorPositionEnd() error
- func (m *Model) SetExtraHighlightedContextLines(lines uint16)
- func (m *Model) SetExtraWordChars(chars ...rune)
- func (m *Model) SetHighlightedWords(words map[string]lipgloss.Style)
- func (m *Model) SetInsertMode()
- func (m *Model) SetLanguage(language string, theme string)
- func (m *Model) SetMaxHistory(max uint32)
- func (m *Model) SetNormalMode()
- func (m *Model) SetPlaceholder(placeholder string)
- func (m *Model) SetSize(width, height int)
- func (m *Model) SetVisualLineMode()
- func (m *Model) SetVisualMode()
- func (m *Model) ShowRelativeLineNumbers(show bool)
- func (m *Model) ShowTildeIndicator(show bool)
- func (m Model) Update(msg tea.Msg) (Model, tea.Cmd)
- func (m Model) View() string
- func (m *Model) WithCompletionAutoTrigger(enabled bool)
- func (m *Model) WithCompletionDebounce(duration time.Duration)
- func (m *Model) WithSearchInputCursorMode(mode cursor.Mode)
- func (m *Model) WithSearchOptions(options core.SearchOptions)
- func (m *Model) WithSyntaxHighlighter(highlighter *highlighter.Highlighter)
- func (m *Model) WithTheme(theme Theme)
- type PasteMsg
- type QuitMsg
- type RedoMsg
- type RelativeNumbersChangeMsg
- type RenameMsg
- type SaveMsg
- type SearchResultsMsg
- type Theme
- type UndoMsg
- type VisualLineInfo
- type YankMsg
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CompletionDebounceMsg ¶
type CompletionRequestMsg ¶
type CompletionRequestMsg struct {
Context core.CompletionContext
}
type CompletionResponseMsg ¶
type CompletionResponseMsg struct {
Completions []core.Completion
Context core.CompletionContext
}
type DeleteFileMsg ¶
type DeleteFileMsg struct{}
type Model ¶
type Model struct {
StatusLineFunc func() string
// contains filtered or unexported fields
}
func (*Model) CursorBlink ¶
CursorBlink is the main command for the blinking cursor effect (toggling visibility)
func (*Model) DisableCommandMode ¶
DisableCommandMode allows disabling command mode in the core. This will disable the command mode functionality, meaning the editor will not respond to command mode keybindings.
func (*Model) DisableInsertMode ¶
DisableInsertMode allows disabling insert mode in the core. This will disable the insert mode functionality, meaning the editor will not respond to insert mode keybindings and will prevent text modifications.
func (*Model) DisableSearchMode ¶
func (*Model) DisableVimMode ¶
DisableVimMode allows disabling Vim mode in the core. This will disable all Vim-specific features and revert to a simpler text editor mode. If Vim mode is disabled, the editor will not respond to Vim keybindings.
func (*Model) DisableVisualLineMode ¶
DisableVisualLineMode allows disabling visual line mode in the core. This will disable the visual line mode functionality, meaning the editor will not respond to visual line mode keybindings.
func (*Model) DisableVisualMode ¶
DisableVisualMode allows disabling visual mode in the core. This will disable the visual mode functionality, meaning the editor will not respond to visual mode keybindings.
func (*Model) DispatchError ¶
DispatchError allows setting an error to be displayed in the command line for a specified duration.
func (*Model) DispatchMessage ¶
DispatchMessage allows setting a message to be displayed in the command line for a specified duration.
func (*Model) GetCurrentContent ¶
GetCurrentContent returns the current content of the editor buffer. This content may not be saved yet, as it reflects the current state of the core.
func (Model) GetCursorPosition ¶
GetCursorPosition returns the current cursor position in the core.
func (*Model) GetSavedContent ¶
GetSavedContent returns the saved content of the editor buffer This content is what was last saved to disk, and may not reflect the current state of the core. It is useful for operations that require the last saved state, such as saving to a file.
func (*Model) HasChanges ¶
HasChanges checks if the editor has unsaved changes
func (*Model) HideLineNumbers ¶
HideLineNumbers controls whether to show line numbers in the viewport.
func (*Model) HideStatusLine ¶
HideStatusLine controls whether to show the status line at the bottom of the viewport. If Vim mode is disabled, this will not have any effect.
func (*Model) IsCommandMode ¶
IsCommandMode returns whether the editor is in command mode.
func (*Model) IsInsertMode ¶
IsInsertMode returns whether the editor is in insert mode.
func (*Model) IsNormalMode ¶
IsNormalMode returns whether the editor is in normal mode.
func (*Model) IsSearchMode ¶
IsSearchMode returns whether the editor is in search mode.
func (*Model) IsVisualLineMode ¶
IsVisualLineMode returns whether the editor is in visual line mode.
func (*Model) IsVisualMode ¶
IsVisualMode returns whether the editor is in visual mode.
func (*Model) SetCommandMode ¶
func (m *Model) SetCommandMode()
SetCommandMode sets the editor to command mode.
func (*Model) SetCompletionMenuMaxVisibleItems ¶ added in v0.4.10
SetCompletionMenuMaxVisibleItems sets the maximum number of visible items in the completion menu.
func (Model) SetCompletions ¶ added in v0.4.10
func (m Model) SetCompletions(completions []core.Completion, context core.CompletionContext)
SetCompletions sends completion results to the editor to be displayed in the completion menu.
func (*Model) SetContent ¶
SetContent sets the content of the editor from a string.
func (*Model) SetCursorMode ¶
func (m *Model) SetCursorMode(mode CursorMode)
SetCursorMode sets the cursor mode for the core. It can be either CursorSteady or CursorBlink.
Warning: Enabling CursorBlink may have performance implications.
func (*Model) SetCursorPosition ¶
SetCursorPosition sets the cursor position in the core.
func (*Model) SetCursorPositionEnd ¶
SetCursorPositionEnd sets the cursor position to the end of the editor buffer.
func (*Model) SetExtraHighlightedContextLines ¶
SetExtraHighlightedContextLines sets the number of extra lines to tokenise around the visible viewport. This is crucial for Markdown where code blocks need context (the opening ```) to highlight correctly.
PERFORMANCE TRADE-OFF: - Higher values: Better syntax highlighting for large code blocks, but slower scrolling - Lower values: Faster scrolling, but code blocks may lose highlighting when scrolling
Recommended values: - Small files (<5000 lines): 100-200 (default is 100) - Large files (5000-20000 lines): 50-100 - Very large files (>20000 lines): 20-50
When scrolling, if the new range overlaps with cached range, no re-tokenisation occurs (fast). When scrolling beyond cached range, the entire new range gets re-tokenised (slow if value is high).
func (*Model) SetExtraWordChars ¶ added in v0.4.3
SetExtraWordChars allows specifying additional characters to be considered part of words for cursor movement and selection. By default, the editor considers alphanumeric characters and underscores as part of words. This method allows to include additional characters (e.g., hyphens, dots).
func (*Model) SetHighlightedWords ¶
SetHighlightedWords allows setting highlighted words in the core. These words will be styled with the provided lipgloss styles. This is useful for highlighting specific keywords or phrases in the text.
func (*Model) SetInsertMode ¶
func (m *Model) SetInsertMode()
SetInsertMode sets the editor to insert mode.
func (*Model) SetLanguage ¶
SetLanguage sets the programming language for syntax highlighting.
If the language is empty, syntax highlighting will be disabled.
The theme parameter allows specifying a Chroma theme for the syntax highlighter. For a full list of available themes, see: https://github.com/alecthomas/chroma/blob/master/styles
func (*Model) SetMaxHistory ¶
SetMaxHistory sets the maximum number of history entries for undo/redo. This allows controlling how many undo steps are kept in memory. If set to 0, no history will be kept. The default value is 1000. If the number of history entries exceeds this limit, the oldest entries will be removed. This is useful for managing memory usage in the core.
func (*Model) SetNormalMode ¶
func (m *Model) SetNormalMode()
SetNormalMode sets the editor to normal mode.
func (*Model) SetPlaceholder ¶
SetPlaceholder sets the placeholder text for the core.
func (*Model) SetVisualLineMode ¶
func (m *Model) SetVisualLineMode()
SetVisualLineMode sets the editor to visual line mode.
func (*Model) SetVisualMode ¶
func (m *Model) SetVisualMode()
SetVisualMode sets the editor to visual mode.
func (*Model) ShowRelativeLineNumbers ¶
ShowLineNumbers controls whether to show relative line numbers in the viewport. If Vim mode is disabled, this will not have any effect. If line numbers are hidden, this will not have any effect.
func (*Model) ShowTildeIndicator ¶
ShowTildeIndicator controls whether to show the tilde indicator in the viewport. If line numbers are hidden, this will not have any effect.
func (*Model) WithCompletionAutoTrigger ¶ added in v0.4.10
WithCompletionAutoTrigger enables or disables auto-trigger completions.
func (*Model) WithCompletionDebounce ¶
WithCompletionDebounce sets the debounce time for auto-trigger completions.
func (*Model) WithSearchInputCursorMode ¶
WithSearchInputCursorMode allows setting the cursor mode for the search input. Default is CursorStatic.
func (*Model) WithSearchOptions ¶
func (m *Model) WithSearchOptions(options core.SearchOptions)
WithSearchOptions allows setting custom search options for the core.
func (*Model) WithSyntaxHighlighter ¶
func (m *Model) WithSyntaxHighlighter(highlighter *highlighter.Highlighter)
WithSyntaxHighlighter allows setting a custom syntax highlighter.
type RelativeNumbersChangeMsg ¶
type RelativeNumbersChangeMsg struct {
Enabled bool
}
type SearchResultsMsg ¶
type Theme ¶
type Theme struct {
NormalModeStyle lipgloss.Style
InsertModeStyle lipgloss.Style
VisualModeStyle lipgloss.Style
CommandModeStyle lipgloss.Style
SearchModeStyle lipgloss.Style
StatusLineStyle lipgloss.Style
CommandLineStyle lipgloss.Style
MessageStyle lipgloss.Style
LineNumberStyle lipgloss.Style
CurrentLineNumberStyle lipgloss.Style
CurrentLineStyle lipgloss.Style
SelectionStyle lipgloss.Style
ErrorStyle lipgloss.Style
HighlightYankStyle lipgloss.Style
PlaceholderStyle lipgloss.Style
SearchHighlightStyle lipgloss.Style
SearchInputPromptStyle lipgloss.Style
SearchInputTextStyle lipgloss.Style
SearchInputCursorStyle lipgloss.Style
CompletionMenuItemStyle lipgloss.Style
CompletionMenuSelectedItemStyle lipgloss.Style
CompletionMenuBorderStyle lipgloss.Style
CompletionMenuLabelStyle lipgloss.Style
CompletionMenuTypeStyle lipgloss.Style
}
func DefaultTheme ¶
DefaultTheme creates a theme with adaptive colors based on terminal background.
type VisualLineInfo ¶
Directories
¶
| Path | Synopsis |
|---|---|
|
adapter-bubbletea
module
|
|
|
editor/visual_line_mode.go
|
editor/visual_line_mode.go |
|
examples
|
|
|
basic
command
|
|
|
completion
command
|
|