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 2020-05-28 23:17:45
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
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to fish/functions/fish_prompt.fish.

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

15
16
17
18
19
20
21
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 branch (string replace -r "^refs/heads/" "" $branch)
    
    if test -z "$branch"
        set branch (fossil branch current 2>/dev/null)

    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)")"









|
<


|
>







1
2
3
4
5
6
7
8
9
10

11
12
13
14
15
16
17
18
19
20
21
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 (fossil branch current 2>/dev/null)

    
    if test -z "$branch"
        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)")"

Changes to zshrc.

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)
	branch=${branch##refs/heads/}

	if [ -z "$branch" ]; then
		branch=$(fossil branch current 2>/dev/null)

	fi

	set_prompt $branch
}

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







|
<


|
>







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=$(fossil branch current 2>/dev/null)


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

	set_prompt $branch
}

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