Open file browser in cwd when no buffer path

pull/11285/head
Denys Rybalka 2 months ago
parent f4fb8fa4ef
commit 7e58404172
No known key found for this signature in database
GPG Key ID: 1F6284E97DB46ED1

@ -2957,9 +2957,15 @@ fn file_browser(cx: &mut Context) {
let path = match doc_dir {
Some(path) => path,
None => {
cx.editor.set_error("Current buffer has no path or parent");
let cwd = helix_stdx::env::current_working_dir();
if !cwd.exists() {
cx.editor.set_error(
"Current buffer has no parent and current working directory does not exist",
);
return;
}
cwd
}
};
if let Ok(picker) = ui::file_browser(path) {

Loading…
Cancel
Save