47 lines
929 B
Go
47 lines
929 B
Go
package core
|
|
|
|
// Mode constants for editor mode
|
|
type Mode int
|
|
|
|
const (
|
|
NormalMode Mode = iota
|
|
InsertMode
|
|
CommandMode
|
|
CommandOutputMode
|
|
VisualMode
|
|
VisualLineMode
|
|
VisualBlockMode
|
|
ReplaceMode
|
|
WaitingMode // Same as NORMAL output, but cursor is the REPLACE cursor
|
|
)
|
|
|
|
// Mode.ToString: Returns a human-readable string representation of the mode
|
|
// for display in the status bar.
|
|
func (m Mode) ToString() string {
|
|
switch m {
|
|
case NormalMode, WaitingMode:
|
|
return "NORMAL"
|
|
case InsertMode:
|
|
return "INSERT"
|
|
case CommandMode:
|
|
return "COMMAND"
|
|
case VisualMode:
|
|
return "VISUAL"
|
|
case VisualLineMode:
|
|
return "V-LINE"
|
|
case VisualBlockMode:
|
|
return "V-BLOCK"
|
|
case ReplaceMode:
|
|
return "REPLACE"
|
|
default:
|
|
return "-----"
|
|
}
|
|
}
|
|
|
|
// Mode.IsVisualMode: Returns true if the mode is any visual mode variant.
|
|
func (m Mode) IsVisualMode() bool {
|
|
return m == VisualMode ||
|
|
m == VisualLineMode ||
|
|
m == VisualBlockMode
|
|
}
|