first commit
This commit is contained in:
commit
0610f4aeab
130 changed files with 9897 additions and 0 deletions
23
fn/-z4h-init-wsl
Normal file
23
fn/-z4h-init-wsl
Normal file
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
local cmd=${commands[cmd.exe]:-/mnt/c/Windows/System32/cmd.exe}
|
||||
[[ -x $cmd ]] || return
|
||||
|
||||
case "$(</proc/version)" in
|
||||
*Microsoft*) typeset -gi z4h_no_flock=1;;
|
||||
*microsoft*) ;;
|
||||
*) return ;;
|
||||
esac
|
||||
|
||||
local lines=("${(@f)${$(cd -q -- ${cmd:h} && ./${cmd:t} /c set 2>/dev/null)//$'\r'}}")
|
||||
local keys=(${lines%%=*}) vals=(${lines#*=})
|
||||
typeset -grA z4h_win_env=(${keys:^vals})
|
||||
local home=$z4h_win_env[USERPROFILE]
|
||||
[[ -n $home ]] || return
|
||||
if [[ $home != [a-zA-Z]':\'* ||
|
||||
( ! -d ${home::=/mnt/${(L)home[1]}/${${home:3}//\\//}} &&
|
||||
! -d ${home::=${home#/mnt}} ) ]]; then
|
||||
home=$(command wslpath -- $z4h_win_env[USERPROFILE] 2>/dev/null) || return
|
||||
[[ -d $home ]] || return
|
||||
fi
|
||||
typeset -gr z4h_win_home=$home
|
Loading…
Add table
Add a link
Reference in a new issue