configs  Check-in [dc711ef8ab]

Overview
Comment:fish: Better prompt for root
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: dc711ef8ab8a4e80fe63420374c771b1a8a5c162c1b66d4525c7cd3c3dfaaf49
User & Date: js 2020-01-21 23:04:07
Context
2020-01-22
00:32
fish: Allow using make instead of bmake for pkgsrc check-in: a5517cfc6f user: js tags: trunk
2020-01-21
23:04
fish: Better prompt for root check-in: dc711ef8ab user: js tags: trunk
21:32
fish: Better colors check-in: 714fa0f964 user: js tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to config/fish/fish_variables.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
SETUVAR _fish_abbr_gpg:gpg2
SETUVAR _fish_abbr_vi:vim
SETUVAR fish_color_autosuggestion:4e4e4e
SETUVAR fish_color_cancel:normal
SETUVAR fish_color_command:003cb3
SETUVAR fish_color_comment:6600cc
SETUVAR fish_color_cwd:209060
SETUVAR fish_color_cwd_root:800000
SETUVAR fish_color_end:730099
SETUVAR fish_color_error:ff0000
SETUVAR fish_color_escape:00a6b2
SETUVAR fish_color_history_current:normal
SETUVAR fish_color_host:176945
SETUVAR fish_color_jobs:ffff00
SETUVAR fish_color_match:normal
SETUVAR fish_color_normal:normal
SETUVAR fish_color_operator:cc33ff
SETUVAR fish_color_param:3377ff
SETUVAR fish_color_quote:ff751a
SETUVAR fish_color_redirection:bf4080
SETUVAR fish_color_search_match:ffff00
SETUVAR fish_color_selection:c0c0c0
SETUVAR fish_color_suffix:6ddfad
SETUVAR fish_color_user:00ff00
SETUVAR fish_color_valid_path:normal
SETUVAR fish_color_vcs:43d696
SETUVAR fish_color_vcs_braces:29bc7d
SETUVAR fish_greeting:
SETUVAR fish_key_bindings:hybrid_bindings
SETUVAR fish_pager_color_completion:normal
SETUVAR fish_pager_color_description:B3A06D\x1eyellow
SETUVAR fish_pager_color_prefix:white\x1e\x2d\x2dbold\x1e\x2d\x2dunderline
SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan







<














|





|




9
10
11
12
13
14
15

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
SETUVAR _fish_abbr_gpg:gpg2
SETUVAR _fish_abbr_vi:vim
SETUVAR fish_color_autosuggestion:4e4e4e
SETUVAR fish_color_cancel:normal
SETUVAR fish_color_command:003cb3
SETUVAR fish_color_comment:6600cc
SETUVAR fish_color_cwd:209060

SETUVAR fish_color_end:730099
SETUVAR fish_color_error:ff0000
SETUVAR fish_color_escape:00a6b2
SETUVAR fish_color_history_current:normal
SETUVAR fish_color_host:176945
SETUVAR fish_color_jobs:ffff00
SETUVAR fish_color_match:normal
SETUVAR fish_color_normal:normal
SETUVAR fish_color_operator:cc33ff
SETUVAR fish_color_param:3377ff
SETUVAR fish_color_quote:ff751a
SETUVAR fish_color_redirection:bf4080
SETUVAR fish_color_search_match:ffff00
SETUVAR fish_color_selection:c0c0c0
SETUVAR fish_color_suffix:29bc7d
SETUVAR fish_color_user:00ff00
SETUVAR fish_color_valid_path:normal
SETUVAR fish_color_vcs:43d696
SETUVAR fish_color_vcs_braces:29bc7d
SETUVAR fish_greeting:
SETUVAR fish_key_bindings:fish_default_key_bindings
SETUVAR fish_pager_color_completion:normal
SETUVAR fish_pager_color_description:B3A06D\x1eyellow
SETUVAR fish_pager_color_prefix:white\x1e\x2d\x2dbold\x1e\x2d\x2dunderline
SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan

Changes to config/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
22
23
24
25
26
27
28
29
function fish_prompt --description 'Write out the prompt'
	set -l color_cwd
	set -l suffix
	switch "$USER"
		case root toor
			if set -q fish_color_cwd_root
				set color_cwd $fish_color_cwd_root
			else
				set color_cwd $fish_color_cwd
			end
			set suffix '#'
		case '*'
			set color_cwd $fish_color_cwd
			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 $color_cwd) (prompt_pwd) (string join "" $vcs) \
	    (set_color $fish_color_suffix) "$suffix "
end

<



<
<
<
<
<
|

<













|


1

2
3
4





5
6

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
function fish_prompt --description 'Write out the prompt'

	set -l suffix
	switch "$USER"
		case root toor





			set suffix (set_color ff0000)'#'
		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) \
	    (set_color $fish_color_suffix) "$suffix "
end

Changes to config/fish/functions/fish_right_prompt.fish.

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


14
function fish_right_prompt
	set -l code $status
	set -l jobs (jobs | wc -l)

	if test $jobs -gt 0
		set_color $fish_color_jobs
		echo "$jobs "
	end

	if test $code -gt 0
		set_color $fish_color_error
		echo "$code "
	end


end













>
>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
function fish_right_prompt
	set -l code $status
	set -l jobs (jobs | wc -l)

	if test $jobs -gt 0
		set_color $fish_color_jobs
		echo "$jobs "
	end

	if test $code -gt 0
		set_color $fish_color_error
		echo "$code "
	end

	set_color normal
end

Deleted config/fish/functions/hybrid_bindings.fish.

1
2
3
4
5
6
7
function hybrid_bindings --description 'Vi bindings with a bit of Emacs bindings'
	for mode in default insert visual
		fish_default_key_bindings -M $mode
	end

	fish_vi_key_bindings --no-erase
end
<
<
<
<
<
<
<