fish: replace pure prompt with lighter own prompt
This commit is contained in:
parent
f3305c291b
commit
609696a433
5 changed files with 60 additions and 39 deletions
1
stow/.config/fish/.gitignore
vendored
1
stow/.config/fish/.gitignore
vendored
|
|
@ -1,2 +1 @@
|
|||
fish_variables
|
||||
pure_prompt_colours
|
||||
|
|
|
|||
|
|
@ -1,31 +1,75 @@
|
|||
if status is-interactive
|
||||
# Commands to run in interactive sessions can go here
|
||||
|
||||
|
||||
#
|
||||
# shell prompt
|
||||
#
|
||||
|
||||
# match prompt symbol to OS logo
|
||||
if test -e /System
|
||||
set pure_symbol_prompt ""
|
||||
eval "$(/opt/homebrew/bin/brew shellenv)"
|
||||
else
|
||||
if test -e /etc/os-release
|
||||
posix-source /etc/os-release
|
||||
if [ "$ID" = "nixos" ]
|
||||
set pure_symbol_prompt ""
|
||||
else if [ "$ID" = "debian" ]
|
||||
set pure_symbol_prompt ""
|
||||
else if [ "$ID" = "fedora" ]
|
||||
set pure_symbol_prompt ""
|
||||
else if [ "$ID" = "arch" ]
|
||||
set pure_symbol_prompt ""
|
||||
end
|
||||
end
|
||||
|
||||
cat ~/.config/fish/pure_colours.fish | source
|
||||
if test -e /System
|
||||
set os_icon ""
|
||||
eval "$(/opt/homebrew/bin/brew shellenv)"
|
||||
else if [ "$ID" = "nixos" ]
|
||||
set os_icon ""
|
||||
else if [ "$ID" = "debian" ]
|
||||
set os_icon ""
|
||||
else if [ "$ID" = "fedora" ]
|
||||
set os_icon ""
|
||||
else if [ "$ID" = "arch" ]
|
||||
set os_icon ""
|
||||
else
|
||||
set os_icon "\$"
|
||||
end
|
||||
|
||||
# set prompt colours
|
||||
if test -e ~/.cache/zsh_colours.sh
|
||||
posix-source (string replace -fra "{|}|#|\"" "" (cat ~/.cache/zsh_colours.sh) | psub)
|
||||
else
|
||||
set PRIMARY_COLOUR blue
|
||||
set SECONDARY_COLOUR purple
|
||||
end
|
||||
|
||||
|
||||
# construct final prompt
|
||||
function fish_prompt
|
||||
# turn os_icon red if an error occurs
|
||||
set -l prompt_icon
|
||||
if test $status -ne 0
|
||||
set prompt_icon (set_color red)"$os_icon"(set_color normal)
|
||||
else
|
||||
set prompt_icon "$os_icon"
|
||||
end
|
||||
|
||||
# set ssh status
|
||||
set -l ssh_status
|
||||
if set -q SSH_CONNECTION
|
||||
set ssh_status (prompt_login)
|
||||
end
|
||||
|
||||
# concatenate $HOME to a ~ eg. /home/user to ~
|
||||
set shorten_path (string replace -r "^$HOME" "~" "$PWD")
|
||||
|
||||
echo (set_color $PRIMARY_COLOUR)$shorten_path $ssh_status (set_color $SECONDARY_COLOUR)$prompt_icon (set_color normal)
|
||||
end
|
||||
|
||||
#
|
||||
# shell intergration
|
||||
#
|
||||
|
||||
set pure_enable_single_line_prompt true
|
||||
set HOMEBREW_AUTO_UPDATE_SECS 86400
|
||||
zoxide init fish | source
|
||||
|
||||
#
|
||||
# environment variables
|
||||
#
|
||||
|
||||
set -gx EDITOR nvim
|
||||
set fish_greeting ""
|
||||
set HOMEBREW_AUTO_UPDATE_SECS 86400
|
||||
|
||||
# xdg variables
|
||||
set -gx XDG_CONFIG_HOME "$HOME/.config" # config
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue