diff --git a/dot.config/fish/config.fish b/dot.config/fish/config.fish index 0c68159153c8cd75c6d22668a3f0e35c98e79f24..6c86ed3f77c4e20437cbf8e47ca57e7fc41f1f19 100644 --- a/dot.config/fish/config.fish +++ b/dot.config/fish/config.fish @@ -1,5 +1,16 @@ +function prompt_pwd_full + set -q fish_prompt_pwd_dir_length; or set -l fish_prompt_pwd_dir_length 1 + + if [ $fish_prompt_pwd_dir_length -eq 0 ] + set -l fish_prompt_pwd_dir_length 99999 + end + + set -l realhome ~ + echo $PWD | sed -e "s|^$realhome|~|" -e 's-\([^/.]{'"$fish_prompt_pwd_dir_length"'}\)[^/]*/-\1/-g' +end + function fish_prompt -d "Write out the prompt" - printf '\n%s%s%s%s@%s:%s%s%s\n> ' (set_color normal) (set_color --bold) (whoami) (set_color normal) (hostname) (set_color --bold --background blue white) (prompt_pwd) (set_color normal) + printf '\n%s%s%s%s@%s:%s%s%s\n> ' (set_color normal) (set_color --bold) (whoami) (set_color normal) (hostname) (set_color --bold --background blue white) (prompt_pwd_full) (set_color normal) end export LC_ALL=C