mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 04:43:10 +00:00
Stop caching set_color output in rest of prompts
No more __fish_prompt_* variables.
This commit is contained in:
parent
5f7f4c638f
commit
3b97e2d7ec
4 changed files with 11 additions and 44 deletions
|
@ -2,14 +2,6 @@
|
|||
# author: Maurizio De Santis
|
||||
|
||||
function fish_prompt --description 'Write out the prompt, prepending the Debian chroot environment if present'
|
||||
if not set -q __fish_prompt_normal
|
||||
set -g __fish_prompt_normal (set_color normal)
|
||||
end
|
||||
|
||||
if not set -q __fish_prompt_chroot_env
|
||||
set -g __fish_prompt_chroot_env (set_color yellow)
|
||||
end
|
||||
|
||||
# Set variable identifying the chroot you work in (used in the prompt below)
|
||||
if not set -q debian_chroot
|
||||
and test -r /etc/debian_chroot
|
||||
|
@ -23,27 +15,19 @@ function fish_prompt --description 'Write out the prompt, prepending the Debian
|
|||
|
||||
# Prepend the chroot environment if present
|
||||
if set -q __fish_debian_chroot_prompt
|
||||
echo -n -s "$__fish_prompt_chroot_env" "$__fish_debian_chroot_prompt" "$__fish_prompt_normal" ' '
|
||||
echo -n -s (set_color yellow) "$__fish_debian_chroot_prompt" (set_color normal) ' '
|
||||
end
|
||||
|
||||
switch "$USER"
|
||||
case root toor
|
||||
if not set -q __fish_prompt_cwd
|
||||
if set -q fish_color_cwd_root
|
||||
set -g __fish_prompt_cwd (set_color $fish_color_cwd_root)
|
||||
else
|
||||
set -g __fish_prompt_cwd (set_color $fish_color_cwd)
|
||||
end
|
||||
end
|
||||
|
||||
echo -n -s "$USER" @ (prompt_hostname) ' ' "$__fish_prompt_cwd" (prompt_pwd) "$__fish_prompt_normal" '# '
|
||||
echo -n -s "$USER" @ (prompt_hostname) ' ' (set -q fish_color_cwd_root
|
||||
and set_color $fish_color_cwd_root
|
||||
or set_color $fish_color_cwd) (prompt_pwd) \
|
||||
(set_color normal) '# '
|
||||
|
||||
case '*'
|
||||
if not set -q __fish_prompt_cwd
|
||||
set -g __fish_prompt_cwd (set_color $fish_color_cwd)
|
||||
end
|
||||
|
||||
echo -n -s "$USER" @ (prompt_hostname) ' ' "$__fish_prompt_cwd" (prompt_pwd) "$__fish_prompt_normal" '> '
|
||||
echo -n -s "$USER" @ (prompt_hostname) ' ' (set_color $fish_color_cwd) (prompt_pwd) \
|
||||
(set_color normal) '> '
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -15,9 +15,9 @@ function fish_prompt --description 'Informative prompt'
|
|||
|
||||
switch "$USER"
|
||||
case root toor
|
||||
printf '%s@%s %s%s%s# ' $USER (prompt_hostname) (set -q fish_color_cwd_root && \
|
||||
set_color $fish_color_cwd_root || \
|
||||
set_color $fish_color_cwd) \
|
||||
printf '%s@%s %s%s%s# ' $USER (prompt_hostname) (set -q fish_color_cwd_root
|
||||
and set_color $fish_color_cwd_root
|
||||
or set_color $fish_color_cwd) \
|
||||
(prompt_pwd) (set_color normal)
|
||||
case '*'
|
||||
set -l pipestatus_string (__fish_print_pipestatus "[" "] " "|" (set_color yellow) \
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
# name: Informative Vcs
|
||||
# author: Mariusz Smykula <mariuszs at gmail.com>
|
||||
|
||||
|
||||
|
||||
function fish_prompt --description 'Write out the prompt'
|
||||
set -l last_pipestatus $pipestatus
|
||||
set -l last_status $status
|
||||
|
@ -13,7 +11,6 @@ function fish_prompt --description 'Write out the prompt'
|
|||
if not set -q __fish_git_prompt_hide_untrackedfiles
|
||||
set -g __fish_git_prompt_hide_untrackedfiles 1
|
||||
end
|
||||
|
||||
if not set -q __fish_git_prompt_color_branch
|
||||
set -g __fish_git_prompt_color_branch magenta --bold
|
||||
end
|
||||
|
@ -29,7 +26,6 @@ function fish_prompt --description 'Write out the prompt'
|
|||
if not set -q __fish_git_prompt_char_upstream_prefix
|
||||
set -g __fish_git_prompt_char_upstream_prefix ""
|
||||
end
|
||||
|
||||
if not set -q __fish_git_prompt_char_stagedstate
|
||||
set -g __fish_git_prompt_char_stagedstate "●"
|
||||
end
|
||||
|
@ -45,7 +41,6 @@ function fish_prompt --description 'Write out the prompt'
|
|||
if not set -q __fish_git_prompt_char_cleanstate
|
||||
set -g __fish_git_prompt_char_cleanstate "✔"
|
||||
end
|
||||
|
||||
if not set -q __fish_git_prompt_color_dirtystate
|
||||
set -g __fish_git_prompt_color_dirtystate blue
|
||||
end
|
||||
|
@ -62,10 +57,6 @@ function fish_prompt --description 'Write out the prompt'
|
|||
set -g __fish_git_prompt_color_cleanstate green --bold
|
||||
end
|
||||
|
||||
if not set -q __fish_prompt_normal
|
||||
set -g __fish_prompt_normal (set_color normal)
|
||||
end
|
||||
|
||||
set -l color_cwd
|
||||
set -l prefix
|
||||
set -l suffix
|
||||
|
|
|
@ -2,13 +2,5 @@
|
|||
# author: Steve
|
||||
|
||||
function fish_prompt --description 'Write out the prompt'
|
||||
if not set -q __fish_prompt_normal
|
||||
set -g __fish_prompt_normal (set_color normal)
|
||||
end
|
||||
|
||||
if not set -q __fish_prompt_cwd
|
||||
set -g __fish_prompt_cwd (set_color $fish_color_cwd)
|
||||
end
|
||||
|
||||
echo -n -s "$USER" @ (prompt_hostname) ' ' "$__fish_prompt_cwd" (prompt_pwd) (fish_vcs_prompt) "$__fish_prompt_normal" '> '
|
||||
echo -n -s "$USER" @ (prompt_hostname) ' ' (set_color $fish_color_cwd) (prompt_pwd) (fish_vcs_prompt) (set_color normal) '> '
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue