From b3aa5acea465ea72477f3d825405a3694652bf9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rn=20=C3=85ne?= Date: Tue, 13 Sep 2016 21:53:54 +0200 Subject: [PATCH] Show fuller path in fish prompt. --- dot.config/fish/config.fish | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/dot.config/fish/config.fish b/dot.config/fish/config.fish index 0c68159..6c86ed3 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 -- GitLab