From ac9c3664186f68d576e062923175bef961db591e Mon Sep 17 00:00:00 2001 From: Toby Vincent Date: Mon, 29 Aug 2022 13:10:10 -0500 Subject: feat(wsl): add wsl alias function --- wsl/.local/share/zsh-wsl/zsh-wsl.plugin.zsh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'wsl/.local') diff --git a/wsl/.local/share/zsh-wsl/zsh-wsl.plugin.zsh b/wsl/.local/share/zsh-wsl/zsh-wsl.plugin.zsh index 69a3441..70236cf 100644 --- a/wsl/.local/share/zsh-wsl/zsh-wsl.plugin.zsh +++ b/wsl/.local/share/zsh-wsl/zsh-wsl.plugin.zsh @@ -22,10 +22,16 @@ alias pip3.7="DISPLAY= pip3.7" alias pip3.10="DISPLAY= pip3.10" alias pip="DISPLAY= pip3" -wt() { - powershell.exe -NoProfile -c "wt $*" +wsl_path() { + win_path="$(powershell.exe "(get-command $1 -ErrorAction SilentlyContinue).Source")" + if [ ! -z "$win_path" ]; then + echo "$(wslpath "$win_path" | sed 's/\s/\\\ /g' | sed 's/\\\s*$//')" + fi } +alias alacritty="$(wsl_path "alacritty")" +alias pwsh="$(wsl_path "pwsh")" + wsl_cmd_proxy() { exe="$1" shift # past exe @@ -55,6 +61,3 @@ wsl_cmd_proxy() { winget() { wsl_cmd_proxy "winget.exe" "$@"; } scoop() { wsl_cmd_proxy "scoop" "$@"; } -alacritty() { wsl_cmd_proxy "alacritty.exe" "$@"; } -pwsh() { alacritty --working-directory "c:\\Users\\${USER}" -e "pwsh.exe $@"; } - -- cgit v1.2.3-70-g09d2