cdh: Only replace home directory with ~ at the start of paths

This commit is contained in:
Riccardo Azzolini 2018-08-12 17:39:31 +02:00 committed by Fabian Homborg
parent fa66ac8d8c
commit c79db8ecf7

View File

@ -54,7 +54,7 @@ function cdh --description "Menu based cd command"
set dir_color (set_color $fish_color_history_current)
end
set -l home_dir (string match -r "$HOME(/.*|\$)" "$dir")
set -l home_dir (string match -r "^$HOME(/.*|\$)" "$dir")
if set -q home_dir[2]
set dir "~$home_dir[2]"
end