configs  Check-in [50621c3061]

Overview
Comment:Include user in prompt if not the normal user
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 50621c3061df06b9e83f2b03c456e777ecaf8e2792ce79bb550bf848a68eca8a
User & Date: js 2020-08-23 12:07:26
Context
2020-08-29
18:07
Add cvsrc check-in: b7f3b40f36 user: js tags: trunk
2020-08-23
12:07
Include user in prompt if not the normal user check-in: 50621c3061 user: js tags: trunk
2020-08-18
21:20
Add flgrep.fish check-in: 4c9e4c1a37 user: js tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to fish/config.fish.

18
19
20
21
22
23
24


25
26
27
28
29
30
31
set -g fish_color_selection c0c0c0
set -g fish_color_status --bold red
set -g fish_color_suffix 29bc7d
set -g fish_color_user 00ff00
set -g fish_color_valid_path normal
set -g fish_color_vcs 43d696
set -g fish_color_vcs_braces 29bc7d



test -n "$XDG_CONFIG_HOME"
or set -x XDG_CONFIG_HOME $HOME/.config
test -n "$XDG_CACHE_HOME"
or set -x XDG_CACHE_HOME $HOME/.cache
test -n "$XDG_DATA_HOME"
or set -x XDG_DATA_HOME $HOME/.local/share







>
>







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
set -g fish_color_selection c0c0c0
set -g fish_color_status --bold red
set -g fish_color_suffix 29bc7d
set -g fish_color_user 00ff00
set -g fish_color_valid_path normal
set -g fish_color_vcs 43d696
set -g fish_color_vcs_braces 29bc7d

set -g fish_normal_user js

test -n "$XDG_CONFIG_HOME"
or set -x XDG_CONFIG_HOME $HOME/.config
test -n "$XDG_CACHE_HOME"
or set -x XDG_CACHE_HOME $HOME/.cache
test -n "$XDG_DATA_HOME"
or set -x XDG_DATA_HOME $HOME/.local/share

Changes to fish/functions/fish_prompt.fish.

17
18
19
20
21
22
23
24
25
26

27
    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







|
|
|
>

17
18
19
20
21
22
23
24
25
26
27
28
    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_user) (prompt_hostname) \
               ' ' (set_color $fish_color_cwd) (prompt_pwd) \
               (string join '' $vcs) (set_color $fish_color_suffix) $suffix \
               (set_color normal) ' '
end

Added fish/functions/prompt_user.fish.











>
>
>
>
>
1
2
3
4
5
function prompt_user
    if test (whoami) != "$fish_normal_user"
        echo (whoami)"@"
    end
end

Changes to zshrc.

10
11
12
13
14
15
16

17
18
19
20
21
22
23
WORDCHARS="*?[];!#~"
local grep=""
local grep_color="auto"
local ls=""
local ls_color="auto"
local ls_on_cd="yes"
local ls_on_init="no"


if [ "$COLORTERM" = "24bit" -o "$COLORTERM" = "truecolor" \
    -o "$terminfo[colors]" = 16777216 ]; then
	local color_cwd="#209060"
	local color_host="#176945"
	local color_suffix="#29bc7d"
	local color_vcs="#43d696"







>







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
WORDCHARS="*?[];!#~"
local grep=""
local grep_color="auto"
local ls=""
local ls_color="auto"
local ls_on_cd="yes"
local ls_on_init="no"
local normal_user="js"

if [ "$COLORTERM" = "24bit" -o "$COLORTERM" = "truecolor" \
    -o "$terminfo[colors]" = 16777216 ]; then
	local color_cwd="#209060"
	local color_host="#176945"
	local color_suffix="#29bc7d"
	local color_vcs="#43d696"
95
96
97
98
99
100
101




102
103
104
105
106
107
108
109

set_prompt() {
	if [ -n "$1" ]; then
	       	local branch="%F{$color_vcs_braces}(%F{$color_vcs}$1"
		branch+="%F{$color_vcs_braces})"
	fi





	PS1="%F{$color_host}%m %F{$color_cwd}%c$branch"
	PS1+="%F{$color_suffix}%(!.#.>)%f "
	PS2="%B>%b "
	RPS1="%(1j.%F{$color_jobs}%B%j%b%f.)%(?..%(1j. .)"
	RPS1+="%F{$color_status}%B%?%b%f)"
	RPS2="%(1_.%F{black}%B(%_%)%b%f.)"
}
set_prompt







>
>
>
>
|







96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114

set_prompt() {
	if [ -n "$1" ]; then
	       	local branch="%F{$color_vcs_braces}(%F{$color_vcs}$1"
		branch+="%F{$color_vcs_braces})"
	fi

	if [ "$(whoami)" != "$normal_user" ]; then
		local user="%n@"
	fi

	PS1="%F{$color_host}$user%m %F{$color_cwd}%c$branch"
	PS1+="%F{$color_suffix}%(!.#.>)%f "
	PS2="%B>%b "
	RPS1="%(1j.%F{$color_jobs}%B%j%b%f.)%(?..%(1j. .)"
	RPS1+="%F{$color_status}%B%?%b%f)"
	RPS2="%(1_.%F{black}%B(%_%)%b%f.)"
}
set_prompt