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 Sep 13, 2024
1 parent e2a7c48 commit 5695166
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 @@ -2867,8 +2867,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 5695166

Please sign in to comment.