Skip to content

Commit

Permalink
feat(commands): add clear_registers command
Browse files Browse the repository at this point in the history
  • Loading branch information
Jorge committed Jan 30, 2023
1 parent 447909e commit 910de8f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions helix-core/src/register.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,8 @@ impl Registers {
pub fn inner(&self) -> &HashMap<char, Register> {
&self.inner
}

pub fn clear(&mut self) {
self.inner.clear();
}
}
7 changes: 7 additions & 0 deletions helix-term/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ impl MappableCommand {
wonly, "Close windows except current",
select_register, "Select register",
insert_register, "Insert register",
clear_registers, "Clear registers",
align_view_middle, "Align view middle",
align_view_top, "Align view top",
align_view_center, "Align view center",
Expand Down Expand Up @@ -4457,6 +4458,12 @@ fn insert_register(cx: &mut Context) {
})
}

fn clear_registers(cx: &mut Context) {
cx.editor.autoinfo = None;
cx.editor.registers.clear();
cx.editor.set_status("All registers cleared.")
}

fn align_view_top(cx: &mut Context) {
let (view, doc) = current!(cx.editor);
align_view(doc, view, Align::Top);
Expand Down

0 comments on commit 910de8f

Please sign in to comment.