wez / wezterm

A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust
https://wezfurlong.org/wezterm/
Other
14.85k stars 676 forks source link

Split Vertical/Horizontal with "CurrentPaneDomain" doesn't respect current working directory when you are using powershell. #5335

Open elbiazo opened 2 months ago

elbiazo commented 2 months ago

What Operating System(s) are you seeing this problem on?

Windows

Which Wayland compositor or X11 Window manager(s) are you using?

No response

WezTerm version

20240203-110809-5046fc22

Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?

Yes, and I updated the version box above to show the version of the nightly that I tried

Describe the bug

splitting doesn't respect current working directory. When you split current pane domain, it should use cwd as new path. This works on cmd but not with powershell. Alot of times it would land me on ~/ but sometimes, it lands me on weird places like ~/.ssh.

To Reproduce

No response

Configuration

local wezterm = require("wezterm")
local config = wezterm.config_builder()

-- Windows Option
if wezterm.target_triple == "x86_64-pc-windows-msvc" then
        config.default_prog = { "pwsh.exe", "-NoLogo" }
end

config.check_for_updates = true
config.color_scheme = "Dracula"
config.font_size = 10.0
config.hide_tab_bar_if_only_one_tab = true
config.leader = { key = "a", mods = "CTRL" }
config.keys = {
        { key = "a", mods = "LEADER|CTRL", action = wezterm.action({ SendString = "\x01" }) },
        { key = "s", mods = "LEADER", action = wezterm.action({ SplitVertical = { domain = "CurrentPaneDomain" } }) },
        { key = "v", mods = "LEADER", action = wezterm.action({ SplitHorizontal = { domain = "CurrentPaneDomain" } }) },
        { key = "z", mods = "LEADER", action = "TogglePaneZoomState" },
        { key = "c", mods = "LEADER", action = wezterm.action({ SpawnTab = "CurrentPaneDomain" }) },
        { key = "h", mods = "LEADER", action = wezterm.action({ ActivatePaneDirection = "Left" }) },
        { key = "j", mods = "LEADER", action = wezterm.action({ ActivatePaneDirection = "Down" }) },
        { key = "k", mods = "LEADER", action = wezterm.action({ ActivatePaneDirection = "Up" }) },
        { key = "l", mods = "LEADER", action = wezterm.action({ ActivatePaneDirection = "Right" }) },
        { key = "H", mods = "LEADER|SHIFT", action = wezterm.action({ AdjustPaneSize = { "Left", 5 } }) },
        { key = "J", mods = "LEADER|SHIFT", action = wezterm.action({ AdjustPaneSize = { "Down", 5 } }) },
        { key = "K", mods = "LEADER|SHIFT", action = wezterm.action({ AdjustPaneSize = { "Up", 5 } }) },
        { key = "L", mods = "LEADER|SHIFT", action = wezterm.action({ AdjustPaneSize = { "Right", 5 } }) },
        { key = "1", mods = "LEADER", action = wezterm.action({ ActivateTab = 0 }) },
        { key = "2", mods = "LEADER", action = wezterm.action({ ActivateTab = 1 }) },
        { key = "3", mods = "LEADER", action = wezterm.action({ ActivateTab = 2 }) },
        { key = "4", mods = "LEADER", action = wezterm.action({ ActivateTab = 3 }) },
        { key = "5", mods = "LEADER", action = wezterm.action({ ActivateTab = 4 }) },
        { key = "6", mods = "LEADER", action = wezterm.action({ ActivateTab = 5 }) },
        { key = "7", mods = "LEADER", action = wezterm.action({ ActivateTab = 6 }) },
        { key = "8", mods = "LEADER", action = wezterm.action({ ActivateTab = 7 }) },
        { key = "9", mods = "LEADER", action = wezterm.action({ ActivateTab = 8 }) },
        { key = "n", mods = "LEADER", action = wezterm.action.ActivateTabRelative(1) },
        { key = "p", mods = "LEADER", action = wezterm.action.ActivateTabRelative(-1) },
        { key = "&", mods = "LEADER|SHIFT", action = wezterm.action({ CloseCurrentTab = { confirm = true } }) },
        { key = "x", mods = "LEADER", action = wezterm.action({ CloseCurrentPane = { confirm = true } }) },
}

return config

Expected Behavior

No response

Logs

No response

Anything else?

No response

wez commented 1 month ago

FWIW, I'd recommend configuring powershell to emit Shell Integration escape sequences for the best experience with this sort of thing.

https://wezfurlong.org/wezterm/shell-integration.html#osc-7-on-windows-with-powershell-with-starship

tommdq commented 1 month ago

FWIW, I'd recommend configuring powershell to emit Shell Integration escape sequences for the best experience with this sort of thing.

https://wezfurlong.org/wezterm/shell-integration.html#osc-7-on-windows-with-powershell-with-starship

Hey! I have the same issue and this config worked for powershell. The thing is that prompt function is disabling the Oh my posh theme for some reason I'm still trying to figure it out but it's too complex for me. Did you mean this link instead of starship ? https://wezfurlong.org/wezterm/shell-integration.html#osc-7-on-windows-with-powershell

tommdq commented 1 month ago

update: I managed to solve the entire issue by following this solution: https://github.com/JanDeDobbeleer/oh-my-posh/issues/2515#issuecomment-1374322136