diff --git a/book/src/keymap.md b/book/src/keymap.md index b1053255f32a..b979cfd89491 100644 --- a/book/src/keymap.md +++ b/book/src/keymap.md @@ -238,7 +238,6 @@ This layer is a kludge of mappings, mostly pickers. | ----- | ----------- | ------- | | `f` | Open file picker | `file_picker` | | `b` | Open buffer picker | `buffer_picker` | -| `m` | Open most recent used buffers picker | `mru_buffer_picker` | | `k` | Show documentation for item under cursor in a [popup](#popup) (**LSP**) | `hover` | | `s` | Open document symbol picker (**LSP**) | `symbol_picker` | | `S` | Open workspace symbol picker (**LSP**) | `workspace_symbol_picker` | diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 8adb12f1f4f2..9af3d5acb6a1 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -264,7 +264,6 @@ impl MappableCommand { file_picker_in_current_directory, "Open file picker at current working directory", code_action, "Perform code action", buffer_picker, "Open buffer picker", - mru_buffer_picker, "Open most recent used buffers picker", symbol_picker, "Open symbol picker", select_references_to_symbol_under_cursor, "Select symbol references", workspace_symbol_picker, "Open workspace symbol picker", @@ -2192,14 +2191,6 @@ fn file_picker_in_current_directory(cx: &mut Context) { } fn buffer_picker(cx: &mut Context) { - _buffer_picker(cx, false); -} - -fn mru_buffer_picker(cx: &mut Context) { - _buffer_picker(cx, true); -} - -fn _buffer_picker(cx: &mut Context, mru_sort: bool) { let current = view!(cx.editor).doc; struct BufferMeta { @@ -2255,18 +2246,13 @@ fn _buffer_picker(cx: &mut Context, mru_sort: bool) { .map(|(_, doc)| new_meta(doc)) .collect::>(); - if mru_sort { - items.sort_by(|a, b| b.used_at.cmp(&a.used_at)); - } + // mru + items.sort_by(|a, b| b.used_at.cmp(&a.used_at)); let picker = FilePicker::new( items, (), |cx, meta, action| { - // update used_at for mru sorting - if let Some(doc) = cx.editor.documents.get_mut(&meta.id) { - doc.used_at = std::time::Instant::now(); - } cx.editor.switch(meta.id, action); }, |editor, meta| { diff --git a/helix-term/src/keymap/default.rs b/helix-term/src/keymap/default.rs index 5004a334f76e..9b1447581b98 100644 --- a/helix-term/src/keymap/default.rs +++ b/helix-term/src/keymap/default.rs @@ -205,7 +205,6 @@ pub fn default() -> HashMap { "f" => file_picker, "F" => file_picker_in_current_directory, "b" => buffer_picker, - "m" => mru_buffer_picker, "s" => symbol_picker, "S" => workspace_symbol_picker, "g" => diagnostics_picker, diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index a2943af98182..ccbda28af59c 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -786,6 +786,7 @@ impl Editor { view.last_modified_docs = [Some(view.doc), view.last_modified_docs[0]]; } } + doc.used_at = std::time::Instant::now(); } self.replace_document_in_view(view_id, id); @@ -796,6 +797,7 @@ impl Editor { let view_id = view!(self).id; let doc = self.documents.get_mut(&id).unwrap(); doc.ensure_view_init(view_id); + doc.used_at = std::time::Instant::now(); return; } Action::HorizontalSplit | Action::VerticalSplit => { @@ -811,6 +813,7 @@ impl Editor { // initialize selection for view let doc = self.documents.get_mut(&id).unwrap(); doc.ensure_view_init(view_id); + doc.used_at = std::time::Instant::now(); } }