configs  Check-in [7348743dfc]

Overview
Comment:Prefer Fossil branch over Git branch in prompt
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 7348743dfc2aead23601f583316dff15c0d926c709db94cbe2956ee865e01f11
User & Date: js on 2020-05-28 23:17:45
Other Links: manifest | tags
Context
2020-05-30
09:53
tmux.conf: Remove terminal-overrides check-in: 4407278004 user: js tags: trunk
2020-05-28
23:17
Prefer Fossil branch over Git branch in prompt check-in: 7348743dfc user: js tags: trunk
2020-05-26
20:05
zshrc: Check if --color is supported by ls & grep check-in: 34edc39a9a user: js tags: trunk
Changes

Modified fish/functions/fish_prompt.fish from [6f18624903] to [1ec6189097].

1
2
3
4
5
6
7
8
9
10

11
12
13
14


15
16
17
18
19
20
21
22
23
24
25
26
27
1
2
3
4
5
6
7
8
9

10

11
12

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27









-
+
-


-
+
+













function fish_prompt --description 'Write out the prompt'
    set -l suffix
    switch "$USER"
        case root toor
            set suffix (set_color $fish_color_cwd_root)'#'
        case '*'
            set suffix '>'
    end

    set -l branch (git symbolic-ref HEAD 2>/dev/null)
    set -l branch (fossil branch current 2>/dev/null)
    set branch (string replace -r "^refs/heads/" "" $branch)
    
    if test -z "$branch"
        set branch (fossil branch current 2>/dev/null)
        set branch (git symbolic-ref HEAD 2>/dev/null)
        set branch (string replace -r "^refs/heads/" "" $branch)
    end

    set -l vcs
    if test -n "$branch"
        set vcs (set_color $fish_color_vcs_braces)"(" \
                (set_color $fish_color_vcs)"$branch" \
                (set_color $fish_color_vcs_braces)")"
    end

    echo -n -s (set_color $fish_color_host) (prompt_hostname) ' ' \
               (set_color $fish_color_cwd) (prompt_pwd) (string join '' $vcs) \
               (set_color $fish_color_suffix) $suffix (set_color normal) ' '
end

Modified zshrc from [fe781ffd61] to [3cd7cd8b4c].

99
100
101
102
103
104
105
106

107
108
109
110


111
112
113
114
115
116
117
99
100
101
102
103
104
105

106

107
108

109
110
111
112
113
114
115
116
117







-
+
-


-
+
+







	}
fi
set_prompt

__precmd() {
	__update_terminal_cwd

	local branch=$(git symbolic-ref HEAD 2>/dev/null)
	local branch=$(fossil branch current 2>/dev/null)
	branch=${branch##refs/heads/}

	if [ -z "$branch" ]; then
		branch=$(fossil branch current 2>/dev/null)
		branch=$(git symbolic-ref HEAD 2>/dev/null)
		branch=${branch##refs/heads/}
	fi

	set_prompt $branch
}

case $TERM in
	aterm|Eterm|rxvt*|uxterm*|xterm*)