diff options
author | Pascal Kuthe | 2023-11-30 23:03:26 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2024-01-23 02:20:19 +0000 |
commit | 13ed4f6c4748019787d24c2b686d417b71604242 (patch) | |
tree | 8263b77ee05a22dfc85410345069efb3668b1877 /helix-term/src/events.rs | |
parent | 7d7ace551cd58f0b6d65af7a6dfa8f896d94724a (diff) |
Add hook/event system
Diffstat (limited to 'helix-term/src/events.rs')
-rw-r--r-- | helix-term/src/events.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/helix-term/src/events.rs b/helix-term/src/events.rs new file mode 100644 index 00000000..49b44f77 --- /dev/null +++ b/helix-term/src/events.rs @@ -0,0 +1,20 @@ +use helix_event::{events, register_event}; +use helix_view::document::Mode; +use helix_view::events::{DocumentDidChange, SelectionDidChange}; + +use crate::commands; +use crate::keymap::MappableCommand; + +events! { + OnModeSwitch<'a, 'cx> { old_mode: Mode, new_mode: Mode, cx: &'a mut commands::Context<'cx> } + PostInsertChar<'a, 'cx> { c: char, cx: &'a mut commands::Context<'cx> } + PostCommand<'a, 'cx> { command: & 'a MappableCommand, cx: &'a mut commands::Context<'cx> } +} + +pub fn register() { + register_event::<OnModeSwitch>(); + register_event::<PostInsertChar>(); + register_event::<PostCommand>(); + register_event::<DocumentDidChange>(); + register_event::<SelectionDidChange>(); +} |