diff --git a/src/shell/infer/windows.rs b/src/shell/infer/windows.rs index 24dbf07..3b78180 100644 --- a/src/shell/infer/windows.rs +++ b/src/shell/infer/windows.rs @@ -1,7 +1,6 @@ #![cfg(not(unix))] use crate::shell::Shell; -use log::debug; use std::ffi::OsStr; use sysinfo::{ProcessExt, System, SystemExt}; diff --git a/src/shell/powershell.rs b/src/shell/powershell.rs index 871f64a..d3c8817 100644 --- a/src/shell/powershell.rs +++ b/src/shell/powershell.rs @@ -36,11 +36,10 @@ impl Shell for PowerShell { }; Ok(formatdoc!( r#" - function Set-FnmOnLoad {{ {autoload_hook} }} - function Set-LocationWithFnm {{ param($path); Set-Location $path; Set-FnmOnLoad }} - Set-Alias cd_with_fnm Set-LocationWithFnm -Force - Remove-Item alias:\cd - New-Alias cd Set-LocationWithFnm + function global:Set-FnmOnLoad {{ {autoload_hook} }} + function global:Set-LocationWithFnm {{ param($path); if ($path -eq $null) {{Set-Location}} else {{Set-Location $path}}; Set-FnmOnLoad }} + Set-Alias -Scope global cd_with_fnm Set-LocationWithFnm + Set-Alias -Option AllScope -Scope global cd Set-LocationWithFnm Set-FnmOnLoad "#, autoload_hook = autoload_hook