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
|
||||
|
|
|
|||
|
|
@ -64,11 +64,6 @@ post_hook = 'sh ~/.cache/matugen-jankyborders.sh & disown'
|
|||
input_path = './templates/zsh.sh'
|
||||
output_path = '~/.cache/zsh_colours.sh'
|
||||
|
||||
[templates.fish-pure]
|
||||
input_path = './templates/pure.fish'
|
||||
output_path = '~/.config/fish/pure_colours.fish'
|
||||
post_hook = 'fish ~/.config/fish/pure_colours.fish'
|
||||
|
||||
[templates.fuzzel]
|
||||
input_path = './templates/fuzzel.ini'
|
||||
output_path = '~/.config/fuzzel/colors.ini'
|
||||
|
|
|
|||
|
|
@ -1,15 +0,0 @@
|
|||
set pure_color_primary {{colors.primary.default.hex_stripped}}
|
||||
set pure_color_normal {{colors.on_primary.default.hex_stripped}}
|
||||
set pure_color_success {{colors.on_primary_container.default.hex_stripped}}
|
||||
set pure_color_warning {{colors.secondary_fixed_dim.default.hex_stripped}}
|
||||
|
||||
set pure_color_info {{colors.secondary.default.hex_stripped}}
|
||||
set pure_color_danger {{colors.error.default.hex_stripped}}
|
||||
set pure_color_mute {{colors.surface_bright.default.hex_stripped}}
|
||||
|
||||
set pure_color_light {{colors.secondary.default.hex_stripped}}
|
||||
set pure_color_dark {{colors.secondary.default.hex_stripped}}
|
||||
|
||||
set pure_color_git_unpushed_commits {{colors.tertiary.default.hex_stripped}}
|
||||
set pure_color_git_dirty {{colors.tertiary.default.hex_stripped}}
|
||||
set pure_color_git_stash {{colors.tertiary.default.hex_stripped}}
|
||||
Loading…
Add table
Add a link
Reference in a new issue