mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-23 01:46:18 +04:00
Merge 943ed5d7f8
into 6cca98264f
This commit is contained in:
commit
2bba3e4027
@ -284,6 +284,7 @@ #### Space mode
|
|||||||
| `f` | Open file picker | `file_picker` |
|
| `f` | Open file picker | `file_picker` |
|
||||||
| `F` | Open file picker at current working directory | `file_picker_in_current_directory` |
|
| `F` | Open file picker at current working directory | `file_picker_in_current_directory` |
|
||||||
| `b` | Open buffer picker | `buffer_picker` |
|
| `b` | Open buffer picker | `buffer_picker` |
|
||||||
|
| `B` | Open buffer picker for modified buffers only | `modified_buffer_picker` |
|
||||||
| `j` | Open jumplist picker | `jumplist_picker` |
|
| `j` | Open jumplist picker | `jumplist_picker` |
|
||||||
| `g` | Open changed file picker | `changed_file_picker` |
|
| `g` | Open changed file picker | `changed_file_picker` |
|
||||||
| `G` | Debug (experimental) | N/A |
|
| `G` | Debug (experimental) | N/A |
|
||||||
|
@ -377,6 +377,7 @@ pub fn doc(&self) -> &str {
|
|||||||
file_picker_in_current_directory, "Open file picker at current working directory",
|
file_picker_in_current_directory, "Open file picker at current working directory",
|
||||||
code_action, "Perform code action",
|
code_action, "Perform code action",
|
||||||
buffer_picker, "Open buffer picker",
|
buffer_picker, "Open buffer picker",
|
||||||
|
modified_buffer_picker, "Open buffer picker for modified buffers",
|
||||||
jumplist_picker, "Open jumplist picker",
|
jumplist_picker, "Open jumplist picker",
|
||||||
symbol_picker, "Open symbol picker",
|
symbol_picker, "Open symbol picker",
|
||||||
changed_file_picker, "Open changed file picker",
|
changed_file_picker, "Open changed file picker",
|
||||||
@ -2948,7 +2949,7 @@ fn file_picker_in_current_directory(cx: &mut Context) {
|
|||||||
cx.push_layer(Box::new(overlaid(picker)));
|
cx.push_layer(Box::new(overlaid(picker)));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn buffer_picker(cx: &mut Context) {
|
fn buffer_picker_impl(cx: &mut Context, only_modified: bool) {
|
||||||
let current = view!(cx.editor).doc;
|
let current = view!(cx.editor).doc;
|
||||||
|
|
||||||
struct BufferMeta {
|
struct BufferMeta {
|
||||||
@ -2972,8 +2973,14 @@ struct BufferMeta {
|
|||||||
.documents
|
.documents
|
||||||
.values()
|
.values()
|
||||||
.map(new_meta)
|
.map(new_meta)
|
||||||
|
.filter(|buf| if only_modified { buf.is_modified } else { true })
|
||||||
.collect::<Vec<BufferMeta>>();
|
.collect::<Vec<BufferMeta>>();
|
||||||
|
|
||||||
|
if only_modified && items.len() == 0 {
|
||||||
|
cx.editor.set_status("No buffers modified");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// mru
|
// mru
|
||||||
items.sort_unstable_by_key(|item| std::cmp::Reverse(item.focused_at));
|
items.sort_unstable_by_key(|item| std::cmp::Reverse(item.focused_at));
|
||||||
|
|
||||||
@ -3016,6 +3023,14 @@ struct BufferMeta {
|
|||||||
cx.push_layer(Box::new(overlaid(picker)));
|
cx.push_layer(Box::new(overlaid(picker)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn buffer_picker(cx: &mut Context) {
|
||||||
|
buffer_picker_impl(cx, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn modified_buffer_picker(cx: &mut Context) {
|
||||||
|
buffer_picker_impl(cx, true)
|
||||||
|
}
|
||||||
|
|
||||||
fn jumplist_picker(cx: &mut Context) {
|
fn jumplist_picker(cx: &mut Context) {
|
||||||
struct JumpMeta {
|
struct JumpMeta {
|
||||||
id: DocumentId,
|
id: DocumentId,
|
||||||
|
@ -222,6 +222,7 @@ pub fn default() -> HashMap<Mode, KeyTrie> {
|
|||||||
"f" => file_picker,
|
"f" => file_picker,
|
||||||
"F" => file_picker_in_current_directory,
|
"F" => file_picker_in_current_directory,
|
||||||
"b" => buffer_picker,
|
"b" => buffer_picker,
|
||||||
|
"B" => modified_buffer_picker,
|
||||||
"j" => jumplist_picker,
|
"j" => jumplist_picker,
|
||||||
"s" => symbol_picker,
|
"s" => symbol_picker,
|
||||||
"S" => workspace_symbol_picker,
|
"S" => workspace_symbol_picker,
|
||||||
|
Loading…
Reference in New Issue
Block a user