2020-04-20 21:12:57 +03:00
|
|
|
function lean_install
|
|
|
|
echo "Installing lean theme..."
|
2020-04-03 03:12:55 +03:00
|
|
|
|
2020-04-20 21:12:57 +03:00
|
|
|
# -----------------Download Functions-----------------
|
|
|
|
set -l tempDir "/tmp/lean_theme"
|
2020-04-03 02:30:40 +03:00
|
|
|
|
2020-04-20 21:12:57 +03:00
|
|
|
# Clone repository into $tempDir
|
|
|
|
if test -e $tempDir
|
|
|
|
rm -rf $tempDir
|
|
|
|
end
|
|
|
|
git clone -q --depth=1 https://github.com/IlanCosman/lean.git $tempDir
|
|
|
|
|
|
|
|
# Remove unnecessary files
|
|
|
|
rm "$tempDir/install.fish"
|
2020-04-29 19:53:39 +03:00
|
|
|
rm "$tempDir/LICENSE"
|
2020-04-20 21:12:57 +03:00
|
|
|
rm "$tempDir/README.md"
|
|
|
|
rm -rf "$tempDir/.git/"
|
2020-04-16 11:48:40 +03:00
|
|
|
|
2020-04-20 21:12:57 +03:00
|
|
|
# Copy directory contents into $__fish_config_dir and cleanup
|
|
|
|
cp -rf "$tempDir/." $__fish_config_dir
|
|
|
|
rm -rf $tempDir
|
2020-04-16 11:48:40 +03:00
|
|
|
|
2020-04-20 21:12:57 +03:00
|
|
|
# ----------------Set Theme Variables----------------
|
2020-04-25 23:32:44 +03:00
|
|
|
# --------------Colors--------------
|
|
|
|
set -U lean_color_green 5FD700
|
|
|
|
set -U lean_color_light_blue 00AFFF
|
|
|
|
set -U lean_color_dark_blue 0087AF
|
|
|
|
set -U lean_color_gold D7AF00
|
2020-04-20 21:12:57 +03:00
|
|
|
# ---------------Pwd---------------
|
2020-04-29 07:19:32 +03:00
|
|
|
set -U lean_pwd_shorten_margin 5
|
2020-04-29 22:32:59 +03:00
|
|
|
set -U lean_pwd_unwritable_icon "" # Lock
|
2020-04-20 21:12:57 +03:00
|
|
|
# ------------Git prompt------------
|
|
|
|
set -U __fish_git_prompt_show_informative_status true
|
|
|
|
set -U __fish_git_prompt_showstashstate true
|
|
|
|
# -------Symbols-------
|
|
|
|
set -U __fish_git_prompt_char_stateseparator ""
|
|
|
|
set -U __fish_git_prompt_char_cleanstate ""
|
|
|
|
set -U __fish_git_prompt_char_upstream_ahead " ⇡"
|
|
|
|
set -U __fish_git_prompt_char_upstream_behind " ⇣"
|
|
|
|
set -U __fish_git_prompt_char_stagedstate " +"
|
2020-04-29 22:32:59 +03:00
|
|
|
set -U __fish_git_prompt_char_dirtystate " !"
|
|
|
|
set -U __fish_git_prompt_char_untrackedfiles " ?"
|
2020-04-20 21:12:57 +03:00
|
|
|
set -U __fish_git_prompt_char_stashstate " *"
|
|
|
|
# --------Colors--------
|
|
|
|
set -U __fish_git_prompt_color_branch $lean_color_green
|
|
|
|
set -U __fish_git_prompt_color_upstream $lean_color_green
|
|
|
|
set -U __fish_git_prompt_color_stagedstate $lean_color_gold
|
|
|
|
set -U __fish_git_prompt_color_dirtystate $lean_color_gold
|
|
|
|
set -U __fish_git_prompt_color_untrackedfiles $lean_color_light_blue
|
|
|
|
set -U __fish_git_prompt_color_stashstate $lean_color_green
|
2020-04-03 02:30:40 +03:00
|
|
|
|
2020-04-28 01:37:08 +03:00
|
|
|
# ----------------Right Prompt Items----------------
|
2020-04-29 22:32:59 +03:00
|
|
|
set -U lean_right_prompt_items "status" "timer" "context" "jobs"
|
|
|
|
# --------------Status--------------
|
|
|
|
set -U lean_status_success_icon "✔"
|
|
|
|
set -U lean_status_success_color 5FAF00
|
|
|
|
set -U lean_status_failure_icon "✘"
|
|
|
|
set -U lean_status_failure_color D70000
|
2020-04-25 22:21:09 +03:00
|
|
|
# --------------Timer--------------
|
|
|
|
set -U lean_timer_color 87875F
|
|
|
|
set -U lean_timer_decimals 0
|
|
|
|
set -U lean_timer_duration 3
|
2020-04-28 23:46:40 +03:00
|
|
|
# -------------Context-------------
|
|
|
|
set -U lean_context_ssh_color D7AF87
|
|
|
|
set -U lean_context_root_color D7AF00
|
2020-04-29 07:19:32 +03:00
|
|
|
# ---------------Jobs---------------
|
2020-04-29 22:32:59 +03:00
|
|
|
set -U lean_jobs_icon "" # Gear
|
2020-04-29 07:19:32 +03:00
|
|
|
set -U lean_jobs_color 5FAF00
|
2020-04-25 22:21:09 +03:00
|
|
|
|
|
|
|
# -----------------------Finish-----------------------
|
2020-04-20 21:12:57 +03:00
|
|
|
source "$__fish_config_dir/functions/fish_prompt.fish"
|
2020-04-03 03:12:55 +03:00
|
|
|
|
2020-04-20 21:12:57 +03:00
|
|
|
set_color $lean_color_green
|
2020-04-22 06:06:05 +03:00
|
|
|
echo "Lean theme installed!"
|
2020-04-20 21:12:57 +03:00
|
|
|
set_color $fish_color_normal
|
2020-04-22 06:06:05 +03:00
|
|
|
|
2020-04-28 02:38:17 +03:00
|
|
|
if _user_confirm_defaultYes "Configure lean prompt?"
|
2020-04-22 06:06:05 +03:00
|
|
|
lean_wizard
|
|
|
|
else
|
|
|
|
echo -e "\n""Run lean_wizard to configure your prompt."
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-04-26 00:52:39 +03:00
|
|
|
function _user_confirm_defaultYes -a question
|
2020-04-22 06:06:05 +03:00
|
|
|
while true
|
|
|
|
read -P "$question [Y/n] " input
|
|
|
|
|
|
|
|
switch $input
|
|
|
|
case y Y yes Yes
|
|
|
|
return 0
|
|
|
|
case n N no No
|
|
|
|
return 1
|
2020-04-29 22:32:59 +03:00
|
|
|
case ""
|
2020-04-22 06:06:05 +03:00
|
|
|
return 0
|
|
|
|
end
|
|
|
|
end
|
2020-04-20 21:12:57 +03:00
|
|
|
end
|