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

@ -4632,7 +4632,7 @@ impl CharClassifier {
self.kind(c) == CharKind::Punctuation
}
pub fn kind(&self, c: char) -> CharKind {
pub fn kind_with(&self, c: char, ignore_punctuation: bool) -> CharKind {
if c.is_whitespace() {
return CharKind::Whitespace;
} else if c.is_alphanumeric() || c == '_' {
@ -4642,7 +4642,7 @@ impl CharClassifier {
if let Some(scope) = &self.scope {
if let Some(characters) = scope.word_characters() {
if characters.contains(&c) {
if c == '-' && !self.for_completion && !self.ignore_punctuation {
if c == '-' && !self.for_completion && !ignore_punctuation {
return CharKind::Punctuation;
}
return CharKind::Word;
@ -4650,12 +4650,16 @@ impl CharClassifier {
}
}
if self.ignore_punctuation {
if ignore_punctuation {
CharKind::Word
} else {
CharKind::Punctuation
}
}
pub fn kind(&self, c: char) -> CharKind {
self.kind_with(c, self.ignore_punctuation)
}
}
/// Find all of the ranges of whitespace that occur at the ends of lines