mirror of
https://github.com/IlanCosman/tide.git
synced 2024-12-22 19:41:36 +03:00
Don't anchor the first directory
This commit is contained in:
parent
32e4b8dcf8
commit
d5cc473304
@ -98,7 +98,7 @@ The current working directory is the most important part of any shell prompt. Ti
|
||||
|
||||
![pwd][]
|
||||
|
||||
When the full directory doesn't fit, the leftmost segment is truncated to its shortest unique prefix. In the example above, `Documents` becomes `Doc` instead of `D` because that could be confused with `Downloads`. Important segments are bold and never truncated. These include the first and the last segments, roots of Git repositories etc.
|
||||
When the full directory doesn't fit, the leftmost segment is truncated to its shortest unique prefix. In the example above, `Documents` becomes `Doc` instead of `D` because that could be confused with `Downloads`. Important segments are bold and never truncated. These include the last segment, root of a Git repository etc.
|
||||
|
||||
<sup>_Tip_: If you copy-paste a truncated path and hit <kbd>tab</kbd>, it will complete to the original.</sup>
|
||||
|
||||
|
@ -13,10 +13,7 @@ eval "function _tide_pwd
|
||||
set -f icon $home_icon
|
||||
end
|
||||
|
||||
# Anchor first and last directories (which may be the same)
|
||||
test -n \"\$split_pwd[1]\" && # ~/foo/bar, hightlight ~ OR /foo/bar, hightlight foo not empty string
|
||||
set -l split_output \"$reset_to_color_dirs\$icon$color_anchors\$split_pwd[1]$reset_to_color_dirs\" \$split_pwd[2..] ||
|
||||
set -l split_output \"$reset_to_color_dirs\$icon\" \"$color_anchors\$split_pwd[2]$reset_to_color_dirs\" \$split_pwd[3..]
|
||||
set -l split_output \"\$icon\$split_pwd[1]\" \$split_pwd[2..]
|
||||
set split_output[-1] \"$color_anchors\$split_output[-1]$reset_to_color_dirs\"
|
||||
|
||||
string join / \$split_output | string length -V | read -g _tide_pwd_len
|
||||
@ -39,5 +36,5 @@ eval "function _tide_pwd
|
||||
end
|
||||
end
|
||||
|
||||
string join -- / \$split_output
|
||||
string join -- / \"$reset_to_color_dirs\$split_output[1]\" \$split_output[2..]
|
||||
end"
|
||||
|
Loading…
Reference in New Issue
Block a user