Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions crates/forge_infra/src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,14 @@ impl ForgeEnvironmentInfra {
pid: std::process::id(),
cwd,
shell: self.get_shell_path(),
base_path: dirs::home_dir()
.map(|a| a.join("forge"))
.unwrap_or(PathBuf::from(".").join("forge")),
// Resolve base_path: FORGE_FOLDER_PATH env var takes priority, then default to ~/forge
base_path: parse_env::<String>("FORGE_FOLDER_PATH")
.map(PathBuf::from)
.unwrap_or_else(|| {
dirs::home_dir()
.map(|a| a.join("forge"))
.unwrap_or_else(|| PathBuf::from(".").join("forge"))
}),
home: dirs::home_dir(),
retry_config,
max_search_lines: 200,
Expand Down Expand Up @@ -297,7 +302,7 @@ mod tests {

use forge_domain::{TlsBackend, TlsVersion};
use serial_test::serial;
use tempfile::{TempDir, tempdir};
use tempfile::{tempdir, TempDir};

use super::*;

Expand Down
11 changes: 11 additions & 0 deletions shell-plugin/lib/bindings.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,14 @@ bindkey '^M' forge-accept-line
bindkey '^J' forge-accept-line
# Update the Tab binding to use the new completion widget
bindkey '^I' forge-completion # Tab for both @ and :command completion

# Fix: zsh-vi-mode plugin compatibility
# When zsh-vi-mode (jeffreytse/zsh-vi-mode) is active, Enter in vi-command mode
# does not trigger forge's colon commands. Fix by also binding Enter in vicmd.
# Detects both zsh-vi-mode plugin ($ZVM_MODE) and native vi mode (bindkey -v).
if [[ -n "$ZVM_MODE" ]] || bindkey -lL main 2>/dev/null | grep -q "bindkey -A viins main\|bindkey -A vicmd main"; then
bindkey -M vicmd '^M' forge-accept-line
bindkey -M vicmd '^J' forge-accept-line
# Also bind Tab in vicmd for @ and :command completion
bindkey -M vicmd '^I' forge-completion
fi
Loading