From 8dbb9f2aa30c6093bbdb80f9c3b25a13a465fe72 Mon Sep 17 00:00:00 2001 From: candifloss Date: Sun, 19 Jan 2025 16:03:57 +0530 Subject: [PATCH] Set prompts to prettyprompt binaries --- conf.d/fish_alias_arch.fish | 3 +++ conf.d/fish_alias_common.fish | 4 +--- conf.d/fish_prompt.fish | 40 +---------------------------------- conf.d/fish_right_prompt.fish | 38 ++------------------------------- config.fish | 7 ++++++ fish_variables | 4 ++-- 6 files changed, 16 insertions(+), 80 deletions(-) create mode 100644 conf.d/fish_alias_arch.fish diff --git a/conf.d/fish_alias_arch.fish b/conf.d/fish_alias_arch.fish new file mode 100644 index 0000000..bda2be4 --- /dev/null +++ b/conf.d/fish_alias_arch.fish @@ -0,0 +1,3 @@ +alias inst="sudo pacman -S" +alias systemctl="sudo systemctl" +alias updt="sudo pacman -Syuu --noconfirm && paru -Syu --noconfirm && rustup update" diff --git a/conf.d/fish_alias_common.fish b/conf.d/fish_alias_common.fish index 1e86fdb..469ea96 100644 --- a/conf.d/fish_alias_common.fish +++ b/conf.d/fish_alias_common.fish @@ -1,6 +1,4 @@ alias c="clear" -alias inst="sudo apt-get install -y" alias systemctl="sudo systemctl" alias ls="lsd" -alias bat="bat --paging=never -p" -alias updt="sudo apt-get update && sudo apt-get upgrade -y && sudo snap refresh && rustup update" +alias bat="bat -pP" diff --git a/conf.d/fish_prompt.fish b/conf.d/fish_prompt.fish index 64defdf..530d99c 100644 --- a/conf.d/fish_prompt.fish +++ b/conf.d/fish_prompt.fish @@ -1,41 +1,3 @@ function fish_prompt - # Check the last command status and set the error color - if test $status -eq 0 - set error_color "\033[38;2;0;255;180m" # rgb(0, 255, 180) for success - else - set error_color "\033[38;2;255;53;94m" # rgb(255, 53, 94) for error - end - - # Get SSH session status - if test -n "$SSH_CONNECTION" - set ssh_color "\033[38;2;255;149;0m" # rgb(255, 149, 0) for SSH - else - set ssh_color "\033[38;2;82;82;82m" # rgb(82, 82, 82) for non-SSH - end - - # Try to get the git branch, avoid error if not in a git repo - set git_color "\033[38;2;82;82;82m" # Default git color when not in a git repo - if test -d .git - set git_branch (git rev-parse --abbrev-ref HEAD) - if test -n "$git_branch" - switch $git_branch - case 'main' 'master' - set git_color "\033[38;2;178;98;44m" # rgb(178, 98, 44) for main/master - case 'dev' - set git_color "\033[38;2;54;159;150m" # rgb(54, 159, 150) for dev - case '*' - set git_color "\033[38;2;255;255;255m" # rgb(255, 255, 255) for other branches - end - end - end - - # Set the user color - if test $USER = "root" - set user_color "\033[38;2;255;53;94m" # rgb(255, 53, 94) for root - else - set user_color "\033[38;2;0;255;180m" # rgb(0, 255, 180) for non-root users - end - - # Print the custom prompt with the symbol and different colors - echo -n -e "$ssh_color❯$git_color❯$user_color❯$error_color❯\033[0m " + prettyprompt $status end diff --git a/conf.d/fish_right_prompt.fish b/conf.d/fish_right_prompt.fish index 5d156b9..ee7aca7 100644 --- a/conf.d/fish_right_prompt.fish +++ b/conf.d/fish_right_prompt.fish @@ -1,37 +1,3 @@ function fish_right_prompt - # Check if we're in a Git repo - set git_dir (git rev-parse --show-toplevel 2>/dev/null) - if test -n "$git_dir" - # Escape - set escaped_git_dir (string replace "/" "\\/" $git_dir) - - # Get the repo name - set repo_name (basename $git_dir) - - # Relative path in git - set relative_path (string replace -r "^$escaped_git_dir/" "" (pwd)) - - # RGB color codes - set repo_color "\033[38;2;55;120;130m" # RGB for repo name (dark cyan) - set separator_color "\033[38;2;178;98;44m" # RGB for separator (bronze) - set path_color "\033[38;2;82;82;82m" # RGB for path (gray) - set reset_color "\033[0m" # Reset color - - # Ensure the relative path starts with a single slash - if not string match -r "^/" $relative_path - set relative_path "/$relative_path" - end - - # Check if we're at the Git root or inside the repo - if test "$relative_path" = "" - # At the repo root - printf "$repo_color$repo_name$reset_color" - else - # Inside the repo, print the repo name, separator, and path - printf "$repo_color$repo_name$separator_color 󰊢 $path_color$relative_path$reset_color" - end - else - # Not in a Git repo, use the default prompt_pwd function - prompt_pwd - end -end \ No newline at end of file + prettyprompt-pwd +end diff --git a/config.fish b/config.fish index d714361..a9f05a3 100644 --- a/config.fish +++ b/config.fish @@ -1,3 +1,10 @@ if status is-interactive # Commands to run in interactive sessions can go here end + +if status is-login + if test -z "$DISPLAY" -a "$XDG_VTNR" = 1 + exec startx + end +end +#set -gx GTK_THEME WhiteSur-Dark-grey diff --git a/fish_variables b/fish_variables index 8724d6b..be1ff71 100644 --- a/fish_variables +++ b/fish_variables @@ -1,6 +1,6 @@ # This file contains fish universal variable definitions. # VERSION: 3.0 -SETUVAR __fish_initialized:3400 +SETUVAR __fish_initialized:3800 SETUVAR fish_color_autosuggestion:767676 SETUVAR fish_color_cancel:\x2d\x2dreverse SETUVAR fish_color_command:00d75f @@ -20,7 +20,7 @@ SETUVAR fish_color_option:\x1d SETUVAR fish_color_param:d7d7af SETUVAR fish_color_quote:d7d7d7 SETUVAR fish_color_redirection:cyan\x1e\x2d\x2dbold -SETUVAR fish_color_search_match:bryellow\x1e\x2d\x2dbackground\x3dbrblack +SETUVAR fish_color_search_match:white\x1e\x2d\x2dbackground\x3dbrblack SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack SETUVAR fish_color_status:red SETUVAR fish_color_user:brgreen