configs  Check-in [aed8907a52]

Overview
Comment:Add Fossil branch to fish prompt

Also prefer Git over Fossil branch instead of showing both in zsh.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: aed8907a52752d059bf1a32e455b8dae981baa5a82b11037b651b8bb8b4e37d2
User & Date: js 2020-05-24 20:51:51
Context
2020-05-25
20:32
fish_prompt: Redirect fossil's stderr to /dev/null check-in: 46ef6bc803 user: js tags: trunk
2020-05-24
20:51
Add Fossil branch to fish prompt check-in: aed8907a52 user: js tags: trunk
17:30
Add flc as alias for "fossil changes --differ" check-in: 4ca56c47e1 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
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)





    set -l vcs
    if test -n "$branch" -a "$branch" != "master"
        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) \











>
>
>
>
>

|







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

Changes to zshrc.

95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
	}
fi
set_prompt

__precmd() {
	__update_terminal_cwd

	local branch=""

	local fossil_branch=$(fossil branch current 2>/dev/null)
	if [ -n "$fossil_branch" ]; then
		branch="$branch${branch:+ }f:$fossil_branch"
	fi
	
	local git_branch=$(git symbolic-ref HEAD 2>/dev/null)
	git_branch=${git_branch##refs/heads/}
	if [ -n "$git_branch" ]; then
		branch="$branch${branch:+ }g:$git_branch"
	fi

	set_prompt $branch
}

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







|
|
<
<
<
<
|
<
<
|
|







95
96
97
98
99
100
101
102
103




104


105
106
107
108
109
110
111
112
113
	}
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*)