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
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
echo -ne "\r"(lean_pwd)(lean_git_prompt)" "

View File

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

View File

@ -4,7 +4,7 @@ function lean_pwd
if not test -w $PWD
set_color $lean_color_dark_blue
echo -n " " # Lock icon
echo -n "$lean_pwd_unwritable_icon "
set_color $fish_color_normal
end
@ -49,7 +49,7 @@ function _shorten_pwd
set -g fish_prompt_pwd_dir_length 0
set -l pwd (prompt_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
while test $lengthPromptPwd -gt $shortenPwdLength -a $promptPwdDirLength -gt 0

View File

@ -1,9 +1,9 @@
function lean_uninstall
if _user_confirm_defaultNo "Unininstall lean theme?"
set -l fishPrompt "$__fish_config_dir/functions/fish_prompt.fish"
echo "Uninstalling lean theme..."
# ------------------Remove Files------------------
rm -r "$__fish_config_dir/lean_theme"
@ -20,11 +20,11 @@ function lean_uninstall
# --------------Erase Theme Variables--------------
# --------------Prompt--------------
set -a rmVars lean_prompt_connection lean_prompt_connection_color
set -a rmVars lean_prompt_connection_{icon, color}
# --------------Colors--------------
set -a rmVars lean_color_{green, light_blue, dark_blue, gold}
# ---------------Pwd---------------
set -a rmVars fish_prompt_pwd_dir_length lean_shorten_pwd_margin
set -a rmVars lean_pwd_{shorten_margin, unwritable_icon}
# ------------Git prompt------------
set -a rmVars __fish_git_prompt_{show_informative_status, showstashstate}
# -------Symbols-------
@ -39,6 +39,8 @@ function lean_uninstall
set -a rmVars lean_timer_{color, decimals, duration}
# ---------------SSH---------------
set -a rmVars lean_context_{ssh_color, root_color}
# ---------------Jobs---------------
set -U lean_jobs_{icon, color}
for var in $rmVars
set -e $var

View File

@ -234,7 +234,7 @@ function _finish
switch (_menu "Choice" y/n)
case y
_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
case n
end

View File

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

View File

@ -1,5 +1,5 @@
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
echo -ne "\r"(lean_pwd)(lean_git_prompt)" "