Skip to content

Commit

Permalink
Open file browser in cwd when no buffer path
Browse files Browse the repository at this point in the history
  • Loading branch information
drybalka committed Oct 3, 2024
1 parent f32ea55 commit b743ff3
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions helix-term/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
};

Expand Down

0 comments on commit b743ff3

Please sign in to comment.