mod keymap;
mod vim;
pub use keymap::simple_keymap;
pub use vim::{Vim, VimAction, VimMode};
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Key {
Char(char),
Enter,
Tab,
BackTab,
Backspace,
Delete,
Esc,
Left,
Right,
Up,
Down,
Home,
End,
PageUp,
PageDown,
F(u8),
}
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub struct Mods {
pub ctrl: bool,
pub alt: bool,
pub shift: bool,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct KeyEvent {
pub key: Key,
pub mods: Mods,
}
impl KeyEvent {
pub fn plain(key: Key) -> Self {
Self {
key,
mods: Mods::default(),
}
}
pub fn ctrl(c: char) -> Self {
Self {
key: Key::Char(c),
mods: Mods {
ctrl: true,
..Mods::default()
},
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum MouseKind {
Left,
Middle,
Right,
Up,
Drag,
Move,
ScrollUp,
ScrollDown,
ScrollLeft,
ScrollRight,
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct MouseEvent {
pub kind: MouseKind,
pub x: u16,
pub y: u16,
pub fine_x: f32,
pub mods: Mods,
}
#[derive(Clone, Debug, PartialEq)]
pub enum Event {
Key(KeyEvent),
Mouse(MouseEvent),
Paste(String),
Resize(u16, u16),
Tick,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Format {
Bold,
Italic,
Code,
Heading,
Bullet,
Task,
Quote,
Strikethrough,
PlainText,
CodeBlock,
Table,
Numbered,
Level(u8),
Rule,
Link,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Command {
Move(Direction, bool),
Newline,
Type(char),
Indent,
Outdent,
DeleteBackward,
DeleteForward,
Undo,
Redo,
Copy,
Cut,
Paste,
SelectAll,
SelectNextMatch,
Save,
CloseTab,
NextTab,
PreviousTab,
SplitPane,
FocusNextPane,
ToggleSidebar,
QuickOpen,
CommandPalette,
FindInProject,
OpenDiff,
AddComment,
BlameLine,
ReplaceInProject,
MarkdownPreview,
OpenInBrowser,
FocusAgent,
BuildPdf,
ExportPdf,
ComparePlanVersions,
ShowInPdf,
MaximizePane,
MaximizeEditor,
ToggleComment,
MoveLineUp,
MoveLineDown,
DuplicateLine,
DeleteLine,
InsertLineBelow,
InsertLineAbove,
SelectAllMatches,
AddCursorAbove,
AddCursorBelow,
NextChange,
PreviousChange,
NextProblem,
PreviousProblem,
GoToLine,
DeleteWordLeft,
DeleteWordRight,
DeleteToLineStart,
DeleteToLineEnd,
FindInFile,
ReplaceInFile,
Format(Format),
SendToAgent,
MentionSelection,
AcceptProposal,
RejectProposal,
ApprovePlan,
SendBackPlan,
ShowAgents,
CloseDock,
ShowOutline,
ShowSourceControl,
ToggleTerminal,
NewTerminal,
ShowComments,
ShowBrowser,
ListAgents,
RunCell,
ClearOutputs,
RunAllCells,
InterruptKernel,
RestartKernel,
ShowGuide,
NewDocument,
ToggleTracking,
AcceptChange,
RejectChange,
ToggleSpelling,
AcceptAllChanges,
RejectAllChanges,
ReviewPreviousTurn,
UndoTurn,
Commit,
OpenClaude,
OpenCodex,
OpenGemini,
OpenSettings,
SwitchBranch,
GoToDefinition,
QuickFix,
ShowHover,
GoBack,
GoForward,
GoToReferences,
FormatDocument,
Complete,
RenameSymbol,
SelectLines(usize),
PasteLine,
Cancel,
Quit,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Direction {
Left,
Right,
Up,
Down,
WordLeft,
WordRight,
LineStart,
LineColumnZero,
LineEnd,
Top,
Bottom,
PageUp,
PageDown,
NextWordStart,
FindChar(char, bool, bool),
}