Add background jobs right prompt item. Rename variables

This commit is contained in:
Ilan Cosman 2020-04-28 21:19:32 -07:00
parent 3caf26473e
commit 0dd773f302
7 changed files with 25 additions and 21 deletions

View File

@ -5,7 +5,7 @@ function fish_prompt --description 'Write out the prompt'
echo echo
set_color $lean_prompt_connection_color set_color $lean_prompt_connection_color
printf "%.s$lean_prompt_connection" (seq $COLUMNS) printf "%.s$lean_prompt_connection_icon" (seq $COLUMNS)
set_color $fish_color_normal set_color $fish_color_normal
echo -ne "\r"(lean_pwd)(lean_git_prompt)" " echo -ne "\r"(lean_pwd)(lean_git_prompt)" "

View File

@ -6,23 +6,22 @@ end
function _lean_timer function _lean_timer
if test (math $CMD_DURATION/1000) -gt $lean_timer_duration if test (math $CMD_DURATION/1000) -gt $lean_timer_duration
set -l lean_timer_output (math --scale=$lean_timer_decimals $CMD_DURATION/1000)"s" echo -n (math --scale=$lean_timer_decimals $CMD_DURATION/1000)"s"
echo -n $lean_timer_output
end end
end end
function _lean_context function _lean_context
if set -q SSH_TTY if set -q SSH_TTY
set -g lean_context_color $lean_context_ssh_color set -g lean_context_color $lean_context_ssh_color
set -g lean_context_color_bold false echo -n $USER'@'(prompt_hostname)
set -l lean_context_output $USER'@'(prompt_hostname)
echo -n $lean_context_output
else if test $USER = "root" else if test $USER = "root"
set -g lean_context_color $lean_context_root_color set -g lean_context_color $lean_context_root_color
set -g lean_context_color_bold true echo -n $USER'@'(prompt_hostname)
end
set -l lean_context_output $USER'@'(prompt_hostname) end
echo -n $lean_context_output
function _lean_jobs
if jobs -q
echo -n $lean_jobs_icon # Gear icon
end end
end end

View File

@ -4,7 +4,7 @@ function lean_pwd
if not test -w $PWD if not test -w $PWD
set_color $lean_color_dark_blue set_color $lean_color_dark_blue
echo -n " " # Lock icon echo -n "$lean_pwd_unwritable_icon "
set_color $fish_color_normal set_color $fish_color_normal
end end
@ -49,7 +49,7 @@ function _shorten_pwd
set -g fish_prompt_pwd_dir_length 0 set -g fish_prompt_pwd_dir_length 0
set -l pwd (prompt_pwd) set -l pwd (prompt_pwd)
set -l lengthPromptPwd (string length $pwd) set -l lengthPromptPwd (string length $pwd)
set -l shortenPwdLength (math $COLUMNS-$lean_shorten_pwd_margin) set -l shortenPwdLength (math $COLUMNS-$lean_pwd_shorten_margin)
set -l promptPwdDirLength 8 set -l promptPwdDirLength 8
while test $lengthPromptPwd -gt $shortenPwdLength -a $promptPwdDirLength -gt 0 while test $lengthPromptPwd -gt $shortenPwdLength -a $promptPwdDirLength -gt 0

View File

@ -20,11 +20,11 @@ function lean_uninstall
# --------------Erase Theme Variables-------------- # --------------Erase Theme Variables--------------
# --------------Prompt-------------- # --------------Prompt--------------
set -a rmVars lean_prompt_connection lean_prompt_connection_color set -a rmVars lean_prompt_connection_{icon, color}
# --------------Colors-------------- # --------------Colors--------------
set -a rmVars lean_color_{green, light_blue, dark_blue, gold} set -a rmVars lean_color_{green, light_blue, dark_blue, gold}
# ---------------Pwd--------------- # ---------------Pwd---------------
set -a rmVars fish_prompt_pwd_dir_length lean_shorten_pwd_margin set -a rmVars lean_pwd_{shorten_margin, unwritable_icon}
# ------------Git prompt------------ # ------------Git prompt------------
set -a rmVars __fish_git_prompt_{show_informative_status, showstashstate} set -a rmVars __fish_git_prompt_{show_informative_status, showstashstate}
# -------Symbols------- # -------Symbols-------
@ -39,6 +39,8 @@ function lean_uninstall
set -a rmVars lean_timer_{color, decimals, duration} set -a rmVars lean_timer_{color, decimals, duration}
# ---------------SSH--------------- # ---------------SSH---------------
set -a rmVars lean_context_{ssh_color, root_color} set -a rmVars lean_context_{ssh_color, root_color}
# ---------------Jobs---------------
set -U lean_jobs_{icon, color}
for var in $rmVars for var in $rmVars
set -e $var set -e $var

View File

@ -234,7 +234,7 @@ function _finish
switch (_menu "Choice" y/n) switch (_menu "Choice" y/n)
case y case y
_assemblePrompt fish _assemblePrompt fish
set -U lean_prompt_connection $fake_lean_prompt_connection set -U lean_prompt_connection_icon $fake_lean_prompt_connection
set -U lean_prompt_connection_color $fake_lean_prompt_connection_color set -U lean_prompt_connection_color $fake_lean_prompt_connection_color
case n case n
end end

View File

@ -26,8 +26,8 @@ function lean_install
set -U lean_color_dark_blue 0087AF set -U lean_color_dark_blue 0087AF
set -U lean_color_gold D7AF00 set -U lean_color_gold D7AF00
# ---------------Pwd--------------- # ---------------Pwd---------------
set -U fish_prompt_pwd_dir_length 0 set -U lean_pwd_shorten_margin 5
set -U lean_shorten_pwd_margin 5 set -U lean_pwd_unwritable_icon  # Lock
# ------------Git prompt------------ # ------------Git prompt------------
set -U __fish_git_prompt_show_informative_status true set -U __fish_git_prompt_show_informative_status true
set -U __fish_git_prompt_showstashstate true set -U __fish_git_prompt_showstashstate true
@ -49,7 +49,7 @@ function lean_install
set -U __fish_git_prompt_color_stashstate $lean_color_green set -U __fish_git_prompt_color_stashstate $lean_color_green
# ----------------Right Prompt Items---------------- # ----------------Right Prompt Items----------------
set -U lean_right_prompt_items timer context set -U lean_right_prompt_items timer context jobs
# --------------Timer-------------- # --------------Timer--------------
set -U lean_timer_color 87875F set -U lean_timer_color 87875F
set -U lean_timer_decimals 0 set -U lean_timer_decimals 0
@ -57,6 +57,9 @@ function lean_install
# -------------Context------------- # -------------Context-------------
set -U lean_context_ssh_color D7AF87 set -U lean_context_ssh_color D7AF87
set -U lean_context_root_color D7AF00 set -U lean_context_root_color D7AF00
# ---------------Jobs---------------
set -U lean_jobs_icon  # Gear
set -U lean_jobs_color 5FAF00
# -----------------------Finish----------------------- # -----------------------Finish-----------------------
source "$__fish_config_dir/functions/fish_prompt.fish" source "$__fish_config_dir/functions/fish_prompt.fish"

View File

@ -1,5 +1,5 @@
set_color $lean_prompt_connection_color set_color $lean_prompt_connection_color
printf "%.s$lean_prompt_connection" (seq $COLUMNS) printf "%.s$lean_prompt_connection_icon" (seq $COLUMNS)
set_color $fish_color_normal set_color $fish_color_normal
echo -ne "\r"(lean_pwd)(lean_git_prompt)" " echo -ne "\r"(lean_pwd)(lean_git_prompt)" "