|
|
@ -375,7 +375,7 @@ impl MappableCommand {
|
|
|
|
file_picker, "Open file picker",
|
|
|
|
file_picker, "Open file picker",
|
|
|
|
file_picker_in_current_buffer_directory, "Open file picker at current buffer's directory",
|
|
|
|
file_picker_in_current_buffer_directory, "Open file picker at current buffer's directory",
|
|
|
|
file_picker_in_current_directory, "Open file picker at current working directory",
|
|
|
|
file_picker_in_current_directory, "Open file picker at current working directory",
|
|
|
|
file_browser, "Open file browser at current working directory",
|
|
|
|
file_browser, "Open file browser at current buffer's directory",
|
|
|
|
code_action, "Perform code action",
|
|
|
|
code_action, "Perform code action",
|
|
|
|
buffer_picker, "Open buffer picker",
|
|
|
|
buffer_picker, "Open buffer picker",
|
|
|
|
jumplist_picker, "Open jumplist picker",
|
|
|
|
jumplist_picker, "Open jumplist picker",
|
|
|
@ -2950,13 +2950,19 @@ fn file_picker_in_current_directory(cx: &mut Context) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn file_browser(cx: &mut Context) {
|
|
|
|
fn file_browser(cx: &mut Context) {
|
|
|
|
let cwd = helix_stdx::env::current_working_dir();
|
|
|
|
let doc_dir = doc!(cx.editor)
|
|
|
|
if !cwd.exists() {
|
|
|
|
.path()
|
|
|
|
cx.editor
|
|
|
|
.and_then(|path| path.parent().map(|path| path.to_path_buf()));
|
|
|
|
.set_error("Current working directory does not exist");
|
|
|
|
|
|
|
|
|
|
|
|
let path = match doc_dir {
|
|
|
|
|
|
|
|
Some(path) => path,
|
|
|
|
|
|
|
|
None => {
|
|
|
|
|
|
|
|
cx.editor.set_error("Current buffer has no path or parent");
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if let Ok(picker) = ui::file_browser(cwd) {
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if let Ok(picker) = ui::file_browser(path) {
|
|
|
|
cx.push_layer(Box::new(overlaid(picker)));
|
|
|
|
cx.push_layer(Box::new(overlaid(picker)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|