vim: Implement named registers (#12895)

Release Notes:

- vim: Add support for register selection `"a`-`"z`, `"0`-`"9`, `"-`.
`"_` and `"%`
([#11511](https://github.com/zed-industries/zed/issues/11511))

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
Paul Eguisier 2024-06-12 18:40:27 +02:00 committed by GitHub
parent 3c3dad6830
commit 001f17c011
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 454 additions and 66 deletions

View file

@ -63,10 +63,10 @@ pub enum Operator {
Jump { line: bool },
Indent,
Outdent,
Lowercase,
Uppercase,
OppositeCase,
Register,
}
#[derive(Default, Clone)]
@ -89,6 +89,8 @@ pub struct EditorState {
pub current_tx: Option<TransactionId>,
pub current_anchor: Option<Selection<Anchor>>,
pub undo_modes: HashMap<TransactionId, Mode>,
pub selected_register: Option<char>,
}
#[derive(Default, Clone, Debug)]
@ -123,7 +125,7 @@ pub struct WorkspaceState {
pub recorded_actions: Vec<ReplayableAction>,
pub recorded_selection: RecordedSelection,
pub registers: HashMap<String, String>,
pub registers: HashMap<char, String>,
}
#[derive(Debug)]
@ -277,6 +279,7 @@ impl Operator {
Operator::Uppercase => "gU",
Operator::Lowercase => "gu",
Operator::OppositeCase => "g~",
Operator::Register => "\"",
}
}
@ -287,6 +290,7 @@ impl Operator {
| Operator::Mark
| Operator::Jump { .. }
| Operator::FindBackward { .. }
| Operator::Register
| Operator::Replace
| Operator::AddSurrounds { target: Some(_) }
| Operator::ChangeSurrounds { .. }