Skip to content
This repository has been archived by the owner on Apr 24, 2020. It is now read-only.

[Bugfix] dir: fix tilde expansion in package_path #1307

Open
wants to merge 1 commit into
base: next
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions segments/dir/dir.p9k
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ prompt_dir() {
local -a markedFolders
markedFolders=( $(__p9k_upsearch "(${(j:|:)P9K_DIR_PACKAGE_FILES})") )
local package_path="${markedFolders[1]}"
[[ ${(L)P9K_DIR_PATH_ABSOLUTE} != "true" ]] && package_path=${package_path/$HOME/"~"}

# Replace the shortest possible match of the marked folder from
# the current path. Remove the amount of characters up to the
Expand All @@ -146,7 +145,9 @@ prompt_dir() {
# Then, find the length of the package_path string, and save the
# subdirectory path as a substring of the current directory's path from 0
# to the length of the package path's string
subdirectory_path=$(__p9k_truncate_path "${current_path:${#${(S%%)package_path//$~zero/}}}" $P9K_DIR_SHORTEN_LENGTH $P9K_DIR_SHORTEN_DELIMITER)
local package_trun_path="${package_path}"
[[ ${(L)P9K_DIR_PATH_ABSOLUTE} != "true" ]] && package_trunc_path=${package_path/$HOME/"~"}
subdirectory_path=$(__p9k_truncate_path "${current_path:${#${(S%%)package_trunc_path//$~zero/}}}" $P9K_DIR_SHORTEN_LENGTH $P9K_DIR_SHORTEN_DELIMITER)

local pkgFile="unknown"
for file in "${P9K_DIR_PACKAGE_FILES[@]}"; do
Expand Down