diff --git a/config/p10k-classic.zsh b/config/p10k-classic.zsh index 045eb4bc..f30db8b5 100644 --- a/config/p10k-classic.zsh +++ b/config/p10k-classic.zsh @@ -275,6 +275,13 @@ # the full directory that was used in previous commands. typeset -g POWERLEVEL9K_DIR_HYPERLINK=false + # If POWERLEVEL9K_DIR_HYPERLINK is true and using WSL, then set this to make the links work: + # You must also map this drive letter on the windows side: + # ``` + # net use L: \\wsl$\Ubuntu-20.04 /persistent:yes + # ``` + # typeset -g POWERLEVEL9K_WSL_NETWORK_DRIVE=L: + # Enable special styling for non-writable and non-existent directories. See POWERLEVEL9K_LOCK_ICON # and POWERLEVEL9K_DIR_CLASSES below. typeset -g POWERLEVEL9K_DIR_SHOW_WRITABLE=v3 diff --git a/config/p10k-lean-8colors.zsh b/config/p10k-lean-8colors.zsh index 948fd2f3..e9a84c21 100644 --- a/config/p10k-lean-8colors.zsh +++ b/config/p10k-lean-8colors.zsh @@ -269,6 +269,13 @@ # the full directory that was used in previous commands. typeset -g POWERLEVEL9K_DIR_HYPERLINK=false + # If POWERLEVEL9K_DIR_HYPERLINK is true and using WSL, then set this to make the links work: + # You must also map this drive letter on the windows side: + # ``` + # net use L: \\wsl$\Ubuntu-20.04 /persistent:yes + # ``` + # typeset -g POWERLEVEL9K_WSL_NETWORK_DRIVE=L: + # Enable special styling for non-writable directories. See POWERLEVEL9K_LOCK_ICON and # POWERLEVEL9K_DIR_CLASSES below. typeset -g POWERLEVEL9K_DIR_SHOW_WRITABLE=v2 diff --git a/config/p10k-lean.zsh b/config/p10k-lean.zsh index 6e022763..37c8119b 100644 --- a/config/p10k-lean.zsh +++ b/config/p10k-lean.zsh @@ -269,6 +269,13 @@ # the full directory that was used in previous commands. typeset -g POWERLEVEL9K_DIR_HYPERLINK=false + # If POWERLEVEL9K_DIR_HYPERLINK is true and using WSL, then set this to make the links work: + # You must also map this drive letter on the windows side: + # ``` + # net use L: \\wsl$\Ubuntu-20.04 /persistent:yes + # ``` + # typeset -g POWERLEVEL9K_WSL_NETWORK_DRIVE=L: + # Enable special styling for non-writable and non-existent directories. See POWERLEVEL9K_LOCK_ICON # and POWERLEVEL9K_DIR_CLASSES below. typeset -g POWERLEVEL9K_DIR_SHOW_WRITABLE=v3 diff --git a/config/p10k-rainbow.zsh b/config/p10k-rainbow.zsh index da1a0a49..32daae98 100644 --- a/config/p10k-rainbow.zsh +++ b/config/p10k-rainbow.zsh @@ -275,6 +275,13 @@ # the full directory that was used in previous commands. typeset -g POWERLEVEL9K_DIR_HYPERLINK=false + # If POWERLEVEL9K_DIR_HYPERLINK is true and using WSL, then set this to make the links work: + # You must also map this drive letter on the windows side: + # ``` + # net use L: \\wsl$\Ubuntu-20.04 /persistent:yes + # ``` + # typeset -g POWERLEVEL9K_WSL_NETWORK_DRIVE=L: + # Enable special styling for non-writable and non-existent directories. See POWERLEVEL9K_LOCK_ICON # and POWERLEVEL9K_DIR_CLASSES below. typeset -g POWERLEVEL9K_DIR_SHOW_WRITABLE=v3 diff --git a/internal/p10k.zsh b/internal/p10k.zsh index 350290d7..f8e3a713 100644 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -2119,7 +2119,17 @@ prompt_dir() { local content="${(pj.$sep.)parts}" if (( _POWERLEVEL9K_DIR_HYPERLINK && _p9k_term_has_href )) && [[ $_p9k__cwd == /* ]]; then - _p9k_href $'file://'${${_p9k__cwd//\%/%%25}//'#'/%%23} $content $expand + local dirpath=${${_p9k__cwd//\%/%%25}//'#'/%%23} + + if (( $+commands[wslpath] )); then + if [[ -n $_POWERLEVEL9K_WSL_NETWORK_DRIVE && $(wslpath -w ${_p9k__cwd}) == \\\\* ]]; then + dirpath=$_POWERLEVEL9K_WSL_NETWORK_DRIVE$dirpath + elif [[ $dirpath =~ '^(/(mnt/)*(.))/' ]]; then + dirpath=$match[3]:${dirpath:${#match[1]}} + fi + fi + + _p9k_href $'file://'$dirpath $content $expand content=$_p9k__ret fi