trim fish
This commit is contained in:
@@ -107,24 +107,12 @@
|
|||||||
set -l realhome (string escape --style=regex -- ~)
|
set -l realhome (string escape --style=regex -- ~)
|
||||||
set -l tmp (string replace -r '^'"$realhome"'($|/)' '~$1' $path)
|
set -l tmp (string replace -r '^'"$realhome"'($|/)' '~$1' $path)
|
||||||
|
|
||||||
if test "$fish_prompt_pwd_dir_length" -eq 0
|
set -l full
|
||||||
echo $tmp
|
set -l all (string split -m (math $fish_prompt_pwd_full_dirs - 1) -r / $tmp)
|
||||||
else
|
set tmp $all[1]
|
||||||
# Shorten to at most 100 characters per directory
|
set full $all[2..]
|
||||||
# with full-length-dirs components left at full length.
|
|
||||||
set -l full
|
|
||||||
if test $fish_prompt_pwd_full_dirs -gt 0
|
|
||||||
set -l all (string split -m (math 100 - 1) -r / $tmp)
|
|
||||||
set tmp $all[1]
|
|
||||||
set full $all[2..]
|
|
||||||
else if test $fish_prompt_pwd_full_dirs -eq 0
|
|
||||||
# 0 means not even the last component is kept
|
|
||||||
string replace -ar '(\.?[^/]{'"100"'})[^/]*' '$1' $tmp
|
|
||||||
continue
|
|
||||||
end
|
|
||||||
|
|
||||||
string join / -- (string replace -ar -- '(\.?[^/]{'"100"'})[^/]*/' '$1/' $tmp) $full
|
string join / -- (string replace -ar -- '(\.?[^/]{'"100"'})[^/]*/' '$1/' $tmp) $full
|
||||||
end
|
|
||||||
end
|
end
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user