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,8 +2957,14 @@ 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");
return;
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
}
};

Loading…
Cancel
Save