viinput

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: BSD-2-Clause, MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mode

type Mode int

Mode represents the current vi-style input state.

const (
	// ModeInsert accepts normal text entry and cursor editing keys.
	ModeInsert Mode = iota
	// ModeNormal accepts vi-style commands.
	ModeNormal
)

type Model

type Model struct {
	Prompt string
	// contains filtered or unexported fields
}

Model is the state container for the vi-style input component.

func New

func New() Model

New returns a Model initialized for insert mode.

func (*Model) Blur

func (m *Model) Blur()

Blur marks the model as inactive.

func (*Model) Focus

func (m *Model) Focus() tea.Cmd

Focus marks the model as active and returns a no-op command.

func (*Model) Mode

func (m *Model) Mode() Mode

Mode returns the current editing mode.

func (*Model) SetValue

func (m *Model) SetValue(value string)

SetValue replaces the current buffer contents.

func (*Model) Update

func (m *Model) Update(msg tea.Msg) (Model, tea.Cmd)

Update applies a key event to the model.

func (*Model) Value

func (m *Model) Value() string

Value returns the current buffer contents.

func (*Model) View

func (m *Model) View() string

View renders the prompt, value and cursor.

func (*Model) WantsExit

func (m *Model) WantsExit() bool

WantsExit reports whether normal mode requested that editing end.

Jump to

Keyboard shortcuts

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