feat(config): fish
This commit is contained in:
parent
90fe253c51
commit
ab93bfa16d
7 changed files with 491 additions and 0 deletions
21
config/fish/functions/fish_greeting.fish
Normal file
21
config/fish/functions/fish_greeting.fish
Normal file
|
@ -0,0 +1,21 @@
|
|||
function fish_greeting
|
||||
if not set -q fish_greeting
|
||||
set -l line1 (printf (_ 'Welcome to %sanhgelus-void%s.') (set_color "#95d5b2" green) (set_color normal))
|
||||
set -l line2 \n(printf (_ 'Workstation powered by the %svoid%s.') (set_color green) (set_color normal))
|
||||
set -g fish_greeting "$line1$line2"
|
||||
end
|
||||
|
||||
if set -q fish_private_mode
|
||||
set -l line (_ "fish is running in private mode, history will not be persisted.")
|
||||
if set -q fish_greeting[1]
|
||||
set -g fish_greeting $fish_greeting\n$line
|
||||
else
|
||||
set -g fish_greeting $line
|
||||
end
|
||||
end
|
||||
|
||||
# The greeting used to be skipped when fish_greeting was empty (not just undefined)
|
||||
# Keep it that way to not print superfluous newlines on old configuration
|
||||
test -n "$fish_greeting"
|
||||
and echo $fish_greeting
|
||||
end
|
34
config/fish/functions/fish_prompt.fish
Normal file
34
config/fish/functions/fish_prompt.fish
Normal file
|
@ -0,0 +1,34 @@
|
|||
# name: Default
|
||||
# author: Lily Ballard
|
||||
|
||||
function fish_prompt --description 'Write out the prompt'
|
||||
set -l last_pipestatus $pipestatus
|
||||
set -lx __fish_last_status $status # Export for __fish_print_pipestatus.
|
||||
set -l normal (set_color normal)
|
||||
set -q fish_color_status
|
||||
or set -g fish_color_status red
|
||||
|
||||
# Color the prompt differently when we're root
|
||||
set -l color_cwd "#ffd6ff"
|
||||
set -l suffix '>'
|
||||
if functions -q fish_is_root_user; and fish_is_root_user
|
||||
if set -q fish_color_cwd_root
|
||||
set color_cwd $fish_color_cwd_root
|
||||
end
|
||||
set suffix '#'
|
||||
end
|
||||
|
||||
# Write pipestatus
|
||||
# If the status was carried over (if no command is issued or if `set` leaves the status untouched), don't bold it.
|
||||
set -l bold_flag --bold
|
||||
set -q __fish_prompt_status_generation; or set -g __fish_prompt_status_generation $status_generation
|
||||
if test $__fish_prompt_status_generation = $status_generation
|
||||
set bold_flag
|
||||
end
|
||||
set __fish_prompt_status_generation $status_generation
|
||||
set -l status_color (set_color $fish_color_status)
|
||||
set -l statusb_color (set_color $bold_flag $fish_color_status)
|
||||
set -l prompt_status (__fish_print_pipestatus "[" "]" "|" "$status_color" "$statusb_color" $last_pipestatus)
|
||||
|
||||
echo -n -s (prompt_login)' ' (set_color $color_cwd) (prompt_pwd) $normal (fish_vcs_prompt) $normal " "$prompt_status $suffix " "
|
||||
end
|
28
config/fish/functions/prompt_login.fish
Normal file
28
config/fish/functions/prompt_login.fish
Normal file
|
@ -0,0 +1,28 @@
|
|||
function prompt_login --description "display user name for the prompt"
|
||||
if not set -q __fish_machine
|
||||
set -g __fish_machine
|
||||
set -l debian_chroot $debian_chroot
|
||||
|
||||
if test -r /etc/debian_chroot
|
||||
set debian_chroot (cat /etc/debian_chroot)
|
||||
end
|
||||
|
||||
if set -q debian_chroot[1]
|
||||
and test -n "$debian_chroot"
|
||||
set -g __fish_machine "(chroot:$debian_chroot)"
|
||||
end
|
||||
end
|
||||
|
||||
# Prepend the chroot environment if present
|
||||
if set -q __fish_machine[1]
|
||||
echo -n -s (set_color yellow) "$__fish_machine" (set_color normal) ' '
|
||||
end
|
||||
|
||||
# If we're running via SSH, change the host color.
|
||||
set -l color_host "#95d5b2"
|
||||
if set -q SSH_TTY; and set -q fish_color_host_remote
|
||||
set color_host $fish_color_host_remote
|
||||
end
|
||||
|
||||
echo -n -s (set_color "#ffd6ff" green) "$USER" (set_color normal) @ (set_color $color_host) (prompt_hostname) (set_color normal)
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue