diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cwd.rs | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -8,7 +8,11 @@ pub fn cwd() -> colored::ColoredString { | |||
8 | let tilde_expand = env::var("EXPAND_TILDE").unwrap_or("0".into()); | 8 | let tilde_expand = env::var("EXPAND_TILDE").unwrap_or("0".into()); |
9 | 9 | ||
10 | match tilde_expand.as_ref() { | 10 | match tilde_expand.as_ref() { |
11 | "0" => path = path.replace(&home[..], "~"), | 11 | "0" => { |
12 | if (&path[..]).starts_with(&home[..]) && home.len() > 0 { | ||
13 | path = path.replacen(&home[..], "~", 1); | ||
14 | } | ||
15 | } | ||
12 | _ => {} | 16 | _ => {} |
13 | }; | 17 | }; |
14 | 18 | ||