30 lines
599 B
Go
30 lines
599 B
Go
package main
|
|
|
|
import tea "github.com/charmbracelet/bubbletea"
|
|
|
|
// Action is the base interface - anything executable
|
|
type Action interface {
|
|
Execute(m *model) tea.Cmd
|
|
}
|
|
|
|
// Motion moves the cursor and returns the range covered
|
|
type Motion interface {
|
|
Action
|
|
}
|
|
|
|
// Operator acts on a range (delete, yank, change)
|
|
type Operator interface {
|
|
Operate(m *model, start, end Position) tea.Cmd
|
|
// DoublePress handles dd, yy, cc (line-wise)
|
|
DoublePress(m *model) tea.Cmd
|
|
}
|
|
|
|
// Repeatable actions track count
|
|
type Repeatable interface {
|
|
WithCount(n int) Action
|
|
}
|
|
|
|
type Position struct {
|
|
Line, Col int
|
|
}
|