From b12ac895c25e1c88311975218b2836468e441157 Mon Sep 17 00:00:00 2001 From: Never Gude Date: Wed, 5 Nov 2025 14:30:26 +0100 Subject: [PATCH] configure fish prompt --- .config/fish/fish_variables | 35 ++++++------ .config/fish/functions/fish_prompt.fish | 56 +++++++++---------- .config/fish/functions/fish_right_prompt.fish | 9 +++ test | 5 ++ 4 files changed, 59 insertions(+), 46 deletions(-) create mode 100644 .config/fish/functions/fish_right_prompt.fish create mode 100644 test diff --git a/.config/fish/fish_variables b/.config/fish/fish_variables index 02af6df..46c7e8a 100644 --- a/.config/fish/fish_variables +++ b/.config/fish/fish_variables @@ -2,42 +2,43 @@ # VERSION: 3.0 SETUVAR --export EDITOR:nvim SETUVAR __fish_initialized:3800 -SETUVAR fish_color_autosuggestion:586e75 +SETUVAR fish_color_autosuggestion:brblack SETUVAR fish_color_cancel:\x2d\x2dreverse -SETUVAR fish_color_command:93a1a1 -SETUVAR fish_color_comment:586e75 +SETUVAR fish_color_command:normal +SETUVAR fish_color_comment:red SETUVAR fish_color_cwd:green SETUVAR fish_color_cwd_root:red -SETUVAR fish_color_end:268bd2 -SETUVAR fish_color_error:dc322f -SETUVAR fish_color_escape:00a6b2 +SETUVAR fish_color_end:green +SETUVAR fish_color_error:brred +SETUVAR fish_color_escape:brcyan SETUVAR fish_color_history_current:\x2d\x2dbold SETUVAR fish_color_host:normal SETUVAR fish_color_host_remote:yellow -SETUVAR fish_color_keyword:93a1a1 +SETUVAR fish_color_keyword:normal SETUVAR fish_color_match:\x2d\x2dbackground\x3dbrblue SETUVAR fish_color_normal:normal -SETUVAR fish_color_operator:00a6b2 -SETUVAR fish_color_option:839496 -SETUVAR fish_color_param:839496 -SETUVAR fish_color_quote:657b83 -SETUVAR fish_color_redirection:6c71c4 -SETUVAR fish_color_search_match:bryellow\x1e\x2d\x2dbackground\x3dblack +SETUVAR fish_color_operator:brcyan +SETUVAR fish_color_option:cyan +SETUVAR fish_color_param:cyan +SETUVAR fish_color_quote:yellow +SETUVAR fish_color_redirection:cyan\x1e\x2d\x2dbold +SETUVAR fish_color_search_match:bryellow\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 SETUVAR fish_color_valid_path:\x2d\x2dunderline +SETUVAR fish_greeting:\x1d SETUVAR fish_key_bindings:fish_default_key_bindings SETUVAR fish_pager_color_background:\x1d -SETUVAR fish_pager_color_completion:B3A06D -SETUVAR fish_pager_color_description:B3A06D -SETUVAR fish_pager_color_prefix:cyan\x1e\x2d\x2dunderline +SETUVAR fish_pager_color_completion:normal +SETUVAR fish_pager_color_description:yellow\x1e\x2d\x2ditalics +SETUVAR fish_pager_color_prefix:normal\x1e\x2d\x2dbold\x1e\x2d\x2dunderline SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan SETUVAR fish_pager_color_secondary_background:\x1d SETUVAR fish_pager_color_secondary_completion:\x1d SETUVAR fish_pager_color_secondary_description:\x1d SETUVAR fish_pager_color_secondary_prefix:\x1d -SETUVAR fish_pager_color_selected_background:\x2d\x2dbackground\x3dbrblack +SETUVAR fish_pager_color_selected_background:\x2d\x2dreverse SETUVAR fish_pager_color_selected_completion:\x1d SETUVAR fish_pager_color_selected_description:\x1d SETUVAR fish_pager_color_selected_prefix:\x1d diff --git a/.config/fish/functions/fish_prompt.fish b/.config/fish/functions/fish_prompt.fish index c3f0f39..6d0f616 100644 --- a/.config/fish/functions/fish_prompt.fish +++ b/.config/fish/functions/fish_prompt.fish @@ -1,30 +1,28 @@ -function fish_prompt --description 'Write out the prompt' - set -l last_status $status - set -l normal (set_color normal) - set -l status_color (set_color brgreen) - set -l cwd_color (set_color $fish_color_cwd) - set -l vcs_color (set_color brpurple) - set -l prompt_status "" - - # Since we display the prompt on a new line allow the directory names to be longer. - set -q fish_prompt_pwd_dir_length - or set -lx fish_prompt_pwd_dir_length 0 - - # Color the prompt differently when we're root - set -l suffix '❯' - if functions -q fish_is_root_user; and fish_is_root_user - if set -q fish_color_cwd_root - set cwd_color (set_color $fish_color_cwd_root) - end - set suffix '#' - end - - # Color the prompt in red on error - if test $last_status -ne 0 - set status_color (set_color $fish_color_error) - set prompt_status $status_color "[" $last_status "]" $normal - end - - echo -s (prompt_login) ' ' $cwd_color (prompt_pwd) $vcs_color (fish_vcs_prompt) $normal ' ' $prompt_status - echo -n -s $status_color $suffix ' ' $normal +function fish_prompt + if not set -q VIRTUAL_ENV_DISABLE_PROMPT + set -g VIRTUAL_ENV_DISABLE_PROMPT true + end + # set_color yellow + # printf '%s' $USER + # set_color normal + # printf ' at ' + # set_color magenta + # echo -n (prompt_hostname) + # set_color normal + # printf ' in ' + set -U fish_greeting + set_color $fish_color_cwd + printf '%s' (pwd) + + set_color magenta + set -g __fish_git_prompt_show_informative_status true + printf '%s' (fish_vcs_prompt) + set_color normal + # Line 2 + echo + if test -n "$VIRTUAL_ENV" + printf "(%s) " (set_color blue)(path basename $VIRTUAL_ENV)(set_color normal) + end + printf '↪ ' + set_color normal end diff --git a/.config/fish/functions/fish_right_prompt.fish b/.config/fish/functions/fish_right_prompt.fish new file mode 100644 index 0000000..612df65 --- /dev/null +++ b/.config/fish/functions/fish_right_prompt.fish @@ -0,0 +1,9 @@ +function fish_right_prompt -d "Write out the right prompt" + if not set -q VIRTUAL_ENV_DISABLE_PROMPT + set -g VIRTUAL_ENV_DISABLE_PROMPT true + end + + set_color brblack + date '+%H:%M:%S' +end + diff --git a/test b/test new file mode 100644 index 0000000..3ae8e54 --- /dev/null +++ b/test @@ -0,0 +1,5 @@ +dsad +dsadsa +dsa +dsadsad +ds