Implement Helix Support (WIP) (#19175)

Closes #4642 

- Added the ability to switch to helix normal mode, with an additional
helix visual mode.
- <kbd>ctrl</kbd><kbd>h</kbd> from Insert mode goes to Helix Normal
mode. <kbd> i </kbd> and <kbd> a </kbd> to go back.
- Need to find a way to perform the helix normal mode selection with
<kbd> w </kbd>, <kbd>e </kbd>, <kbd> b </kbd> as a first step. Need to
figure out how the mode will interoperate with the VIM mode as the new
additions are in the same crate.
This commit is contained in:
Waleed Dahshan 2024-12-04 17:19:52 +11:00 committed by GitHub
parent c5d15fd065
commit 8f08787cf0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 444 additions and 12 deletions

View file

@ -6,6 +6,7 @@ mod test;
mod change_list;
mod command;
mod digraph;
mod helix;
mod indent;
mod insert;
mod mode_indicator;
@ -337,6 +338,7 @@ impl Vim {
normal::register(editor, cx);
insert::register(editor, cx);
helix::register(editor, cx);
motion::register(editor, cx);
command::register(editor, cx);
replace::register(editor, cx);
@ -631,7 +633,9 @@ impl Vim {
}
}
Mode::Replace => CursorShape::Underline,
Mode::Visual | Mode::VisualLine | Mode::VisualBlock => CursorShape::Block,
Mode::HelixNormal | Mode::Visual | Mode::VisualLine | Mode::VisualBlock => {
CursorShape::Block
}
Mode::Insert => CursorShape::Bar,
}
}
@ -645,9 +649,12 @@ impl Vim {
true
}
}
Mode::Normal | Mode::Replace | Mode::Visual | Mode::VisualLine | Mode::VisualBlock => {
false
}
Mode::Normal
| Mode::HelixNormal
| Mode::Replace
| Mode::Visual
| Mode::VisualLine
| Mode::VisualBlock => false,
}
}
@ -657,9 +664,12 @@ impl Vim {
pub fn clip_at_line_ends(&self) -> bool {
match self.mode {
Mode::Insert | Mode::Visual | Mode::VisualLine | Mode::VisualBlock | Mode::Replace => {
false
}
Mode::Insert
| Mode::Visual
| Mode::VisualLine
| Mode::VisualBlock
| Mode::Replace
| Mode::HelixNormal => false,
Mode::Normal => true,
}
}
@ -670,6 +680,7 @@ impl Vim {
Mode::Visual | Mode::VisualLine | Mode::VisualBlock => "visual",
Mode::Insert => "insert",
Mode::Replace => "replace",
Mode::HelixNormal => "helix_normal",
}
.to_string();
@ -998,7 +1009,7 @@ impl Vim {
})
});
}
Mode::Insert | Mode::Replace => {}
Mode::Insert | Mode::Replace | Mode::HelixNormal => {}
}
}