configs  Check-in [9fabec2218]

Overview
Comment:prompt_pwd.fish: Keep the initial / for dirs in /

This makes it behave like in zsh.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 9fabec22184e0c943826ab99e554595cb34213938392efc67a5d7d35050fe3dd
User & Date: js 2020-02-12 21:54:30
Context
2020-02-14
01:40
zshrc: Modernize and backport a bunch from fish check-in: c3587c83a7 user: js tags: trunk
2020-02-12
21:54
prompt_pwd.fish: Keep the initial / for dirs in / check-in: 9fabec2218 user: js tags: trunk
2020-02-08
21:51
fish: Remove MAKEFLAGS for pkg_chk check-in: ff4b2a1bdc user: js tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to config/fish/functions/prompt_pwd.fish.

1
2
3
4
5
6
7
8
9
10
11
12
13

14



15
16
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)





	basename $tmp
end













>

>
>
>
|

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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