configs  Artifact [5e26245763]

Artifact 5e26245763520b5c643f6b0aea6481844cc97471295c9c1297dc830e04836fb2:

  • File config/fish/functions/prompt_pwd.fish — part of check-in [9fabec2218] at 2020-02-12 21:54:30 on branch trunk — prompt_pwd.fish: Keep the initial / for dirs in /

    This makes it behave like in zsh. (user: js size: 422)


function prompt_pwd --description 'Print the current working directory'
	set -l options 'h/help'
	argparse -n prompt_pwd --max-args=0 $options -- $argv
	or return

	if set -q _flag_help
		__fish_print_help prompt_pwd
		return 0
	end

	# Replace $HOME with "~"
	set realhome ~
	set -l tmp (string replace -r '^'"$realhome"'($|/)' '~$1' $PWD)
	set tmp (basename $tmp)

	test $PWD = "/$tmp"
	and set tmp $PWD

	echo $tmp
end