feat: add Windows Terminal helper function across all shells

Add `wt` function to launch Windows Terminal with WSL in current directory across Bash, Fish, Nushell, and PowerShell. The function supports passing additional arguments while maintaining the current working directory context.
This commit is contained in:
Ryan Walters
2025-11-01 11:08:32 -05:00
parent f4a4800af0
commit 9fb2c304f3
4 changed files with 42 additions and 1 deletions
+12 -1
View File
@@ -1044,4 +1044,15 @@ def maestroOn [] {
bluetoothctl unblock "AC:BF:71:66:FE:B2"
bluetoothctl connect "AC:BF:71:66:FE:B2"
}
{{ end }}
{{ end }}
{{- if .wsl }}
# Launch Windows Terminal in current directory
def wt [...args: string] {
if ($args | is-empty) {
^wt.exe -w 0 sp wsl --cd (pwd)
} else {
^wt.exe -w 0 ...$args wsl --cd (pwd)
}
}
{{- end }}
@@ -106,4 +106,13 @@ test -x /mnt/c/Users/Xevion/AppData/Local/Programs/cursor/resources/app/bin/curs
# Zed Editor CLI (Windows installation accessible from WSL)
test -x /mnt/c/Users/Xevion/AppData/Local/Programs/Zed/bin/zed && \
fish_add_path /mnt/c/Users/Xevion/AppData/Local/Programs/Zed/bin
# Launch Windows Terminal in current directory
function wt
if test (count $argv) -eq 0
wt.exe -w 0 sp wsl --cd (pwd)
else
wt.exe -w 0 $argv wsl --cd (pwd)
end
end
{{- end }}
@@ -109,6 +109,15 @@ export BROWSER='powershell.exe /c start'
# Zed Editor CLI (Windows installation accessible from WSL)
[ -x /mnt/c/Users/Xevion/AppData/Local/Programs/Zed/bin/zed ] && \
export PATH="$PATH:/mnt/c/Users/Xevion/AppData/Local/Programs/Zed/bin"
# Launch Windows Terminal in current directory
wt() {
if [ $# -eq 0 ]; then
wt.exe -w 0 sp wsl --cd "$(pwd)"
else
wt.exe -w 0 "$@" wsl --cd "$(pwd)"
fi
}
{{- end }}
# dotnet
@@ -39,6 +39,18 @@ Set-Alias -Name ch -Value chezmoi
function cha { chezmoi apply --interactive }
function chlg { lazygit --path {{ .chezmoi.config.sourceDir }} }
# ----------------------
# Windows Terminal
# ----------------------
# Launch Windows Terminal in current directory
function wt {
if ($args.Count -eq 0) {
wt.exe -w 0 sp wsl --cd $PWD.Path
} else {
wt.exe -w 0 $args wsl --cd $PWD.Path
}
}
# ----------------------
# Git Aliases
# ----------------------