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() editor.Position
- func (m *Model) GetEditor() editor.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) 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) 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) WithAutoTrigger(enabled bool)
- func (m *Model) WithCompletionDebounce(duration time.Duration)
- func (m *Model) WithSearchInputCursorMode(mode cursor.Mode)
- func (m *Model) WithSearchOptions(options editor.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 ¶ added in v0.3.0
type CompletionRequestMsg ¶ added in v0.3.0
type CompletionRequestMsg struct {
Context editor.CompletionContext
}
type CompletionResponseMsg ¶ added in v0.3.0
type CompletionResponseMsg struct {
Completions []editor.Completion
Context editor.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 editor. This will disable the command mode functionality, meaning the editor will not respond to command mode keybindings.
func (*Model) DisableInsertMode ¶ added in v0.1.16
DisableInsertMode allows disabling insert mode in the editor. 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 ¶ added in v0.2.5
func (*Model) DisableVimMode ¶
DisableVimMode allows disabling Vim mode in the editor. 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 ¶ added in v0.1.16
DisableVisualLineMode allows disabling visual line mode in the editor. This will disable the visual line mode functionality, meaning the editor will not respond to visual line mode keybindings.
func (*Model) DisableVisualMode ¶ added in v0.1.16
DisableVisualMode allows disabling visual mode in the editor. This will disable the visual mode functionality, meaning the editor will not respond to visual mode keybindings.
func (*Model) DispatchError ¶ added in v0.2.0
DispatchError allows setting an error to be displayed in the command line for a specified duration.
func (*Model) DispatchMessage ¶ added in v0.2.0
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 editor.
func (Model) GetCursorPosition ¶ added in v0.2.8
GetCursorPosition returns the current cursor position in the editor.
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 editor. 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 ¶ added in v0.2.5
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) 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 editor. It can be either CursorSteady or CursorBlink.
Warning: Enabling CursorBlink may have performance implications.
func (*Model) SetCursorPosition ¶
SetCursorPosition sets the cursor position in the editor.
func (*Model) SetCursorPositionEnd ¶
SetCursorPositionEnd sets the cursor position to the end of the editor buffer.
func (*Model) SetExtraHighlightedContextLines ¶ added in v0.1.13
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) SetHighlightedWords ¶
SetHighlightedWords allows setting highlighted words in the editor. 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 ¶ added in v0.1.3
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 ¶ added in v0.1.11
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 editor.
func (*Model) SetNormalMode ¶
func (m *Model) SetNormalMode()
SetNormalMode sets the editor to normal mode.
func (*Model) SetPlaceholder ¶
SetPlaceholder sets the placeholder text for the editor.
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) WithAutoTrigger ¶ added in v0.3.0
WithAutoTrigger enables or disables auto-trigger completions
func (*Model) WithCompletionDebounce ¶ added in v0.3.0
WithCompletionDebounce sets the debounce time for auto-trigger completions
func (*Model) WithSearchInputCursorMode ¶ added in v0.2.7
WithSearchInputCursorMode allows setting the cursor mode for the search input. Default is CursorStatic.
func (*Model) WithSearchOptions ¶ added in v0.2.4
func (m *Model) WithSearchOptions(options editor.SearchOptions)
WithSearchOptions allows setting custom search options for the editor.
func (*Model) WithSyntaxHighlighter ¶ added in v0.1.3
func (m *Model) WithSyntaxHighlighter(highlighter *highlighter.Highlighter)
WithSyntaxHighlighter allows setting a custom syntax highlighter.
type RelativeNumbersChangeMsg ¶ added in v0.2.0
type RelativeNumbersChangeMsg struct {
Enabled bool
}
type SearchResultsMsg ¶ added in v0.2.2
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.