fish: prompt changes
This commit is contained in:
parent
92c2c15d9f
commit
69915c06fe
@ -4,6 +4,7 @@ end
|
||||
|
||||
source ~/.config/fish/aliases.fish
|
||||
|
||||
source ~/.config/fish/functions/prompts.fish
|
||||
source ~/.config/fish/functions/extra_prompt.fish
|
||||
|
||||
# Set GPG_TTY
|
||||
@ -17,6 +18,9 @@ set -gx PATH "$PATH:$HOME/.local/bin/minrss-scripts:"
|
||||
|
||||
set -gx PATH "$PATH:$XDG_DATA_HOME/npm/bin"
|
||||
|
||||
# cppman can't set it itself for some reason
|
||||
set -gx MANPATH "$MANPATH:/home/dogeystamp/.cache/cppman/"
|
||||
|
||||
# Disable fish greeting
|
||||
set fish_greeting ""
|
||||
|
||||
|
@ -17,3 +17,12 @@ if set -q SSH_AGENT_PID
|
||||
ssha_old_fish_prompt
|
||||
end
|
||||
end
|
||||
|
||||
if set -q SSH_TTY
|
||||
functions -c fish_prompt ssh_old_fish_prompt
|
||||
|
||||
function fish_prompt
|
||||
printf "%s%s%s" (set_color 80809C) "(ssh) " (set_color normal)
|
||||
ssh_old_fish_prompt
|
||||
end
|
||||
end
|
||||
|
26
src/.config/fish/functions/prompts.fish
Normal file
26
src/.config/fish/functions/prompts.fish
Normal file
@ -0,0 +1,26 @@
|
||||
function fish_right_prompt
|
||||
set -l usercolor (set_color $fish_color_cwd)
|
||||
if command -sq cksum
|
||||
# randomised color for user/hostname based on disco.fish
|
||||
set -l shas (echo $USER@$hostname | cksum | string split -f1 ' ' | math --base=hex | string sub -s 3 | string pad -c 0 -w 6 | string match -ra ..)
|
||||
set -l col 0x$shas[1..3]
|
||||
|
||||
# ensure luminance is readable
|
||||
while test (math 0.2126 x $col[1] + 0.7152 x $col[2] + 0.0722 x $col[3]) -lt 120
|
||||
set col[1] (math --base=hex "min(255, $col[1] + 60)")
|
||||
set col[2] (math --base=hex "min(255, $col[2] + 60)")
|
||||
set col[3] (math --base=hex "min(255, $col[3] + 60)")
|
||||
end
|
||||
set -l col (string replace 0x '' $col | string pad -c 0 -w 2 | string join "")
|
||||
|
||||
set usercolor (set_color $col)
|
||||
end
|
||||
|
||||
printf '%s%s@%s%s' $usercolor \
|
||||
(echo $USER | string shorten -m 1 -c '') \
|
||||
(echo $hostname | string shorten -m 1 -c '') \
|
||||
(set_color normal)
|
||||
end
|
||||
function fish_prompt
|
||||
printf '%s%s%s> ' (set_color blue) (prompt_pwd) (set_color normal)
|
||||
end
|
Loading…
Reference in New Issue
Block a user