2020-05-19 06:03:25 +03:00
|
|
|
|
function tide_install
|
|
|
|
|
echo 'Installing tide theme...'
|
2020-04-03 03:12:55 +03:00
|
|
|
|
|
2020-04-20 21:12:57 +03:00
|
|
|
|
# -----------------Download Functions-----------------
|
2020-05-19 06:03:25 +03:00
|
|
|
|
set -l tempDir '/tmp/tide_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
|
2020-05-19 06:03:25 +03:00
|
|
|
|
git clone -q --depth=1 https://github.com/IlanCosman/tide.git $tempDir
|
2020-04-20 21:12:57 +03:00
|
|
|
|
|
2020-05-19 06:03:25 +03:00
|
|
|
|
# Remove all files/dirs except functions and tide_theme
|
|
|
|
|
set -l keepFiles "$tempDir/"{'conf.d', 'functions', 'tide_theme'}
|
2020-05-10 02:41:29 +03:00
|
|
|
|
for file in $tempDir/*
|
|
|
|
|
if not contains $file $keepFiles
|
|
|
|
|
rm -rf $file
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
rm -rf "$tempDir/.git"
|
2020-04-16 11:48:40 +03:00
|
|
|
|
|
2020-05-19 06:03:25 +03:00
|
|
|
|
# Copy remaining directory contents into $__fish_config_dir and ctideup
|
2020-04-20 21:12:57 +03:00
|
|
|
|
cp -rf "$tempDir/." $__fish_config_dir
|
|
|
|
|
rm -rf $tempDir
|
2020-04-16 11:48:40 +03:00
|
|
|
|
|
2020-05-13 23:08:37 +03:00
|
|
|
|
# --------------------Set Defaults--------------------
|
2020-05-19 06:03:25 +03:00
|
|
|
|
_set_tide_defaults
|
2020-05-13 23:08:37 +03:00
|
|
|
|
|
|
|
|
|
# -----------------------Finish-----------------------
|
2020-05-19 06:03:25 +03:00
|
|
|
|
_source_tide_functions
|
2020-05-13 23:08:37 +03:00
|
|
|
|
|
2020-05-19 06:03:25 +03:00
|
|
|
|
set_color $tide_color_green
|
|
|
|
|
echo 'Tide theme installed!'
|
2020-05-13 23:08:37 +03:00
|
|
|
|
set_color $fish_color_normal
|
|
|
|
|
|
2020-05-19 06:03:25 +03:00
|
|
|
|
if _user_confirm_defaultYes 'Configure tide prompt?'
|
|
|
|
|
tide configure
|
2020-05-13 23:08:37 +03:00
|
|
|
|
else
|
|
|
|
|
echo
|
2020-05-19 06:03:25 +03:00
|
|
|
|
echo 'Run tide configure to configure your prompt.'
|
2020-05-13 23:08:37 +03:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2020-05-19 22:10:11 +03:00
|
|
|
|
function setTide
|
|
|
|
|
set -U tide_var_list
|
|
|
|
|
|
2020-05-19 21:44:22 +03:00
|
|
|
|
# -------------------Local Variables-------------------
|
|
|
|
|
set -l tideColorGold D7AF00
|
2020-05-19 22:10:11 +03:00
|
|
|
|
set -l tideColorDarkerGreen 5FAF00
|
2020-05-19 21:44:22 +03:00
|
|
|
|
|
2020-05-13 23:08:37 +03:00
|
|
|
|
# ---------------General Theme Variables---------------
|
2020-05-19 22:10:11 +03:00
|
|
|
|
_set tide_dir "$__fish_config_dir/tide_theme"
|
|
|
|
|
_set tide_newline 'true'
|
2020-04-25 23:32:44 +03:00
|
|
|
|
# --------------Colors--------------
|
2020-05-19 22:10:11 +03:00
|
|
|
|
_set tide_color_green 5FD700
|
|
|
|
|
_set tide_color_light_blue 00AFFF
|
|
|
|
|
_set tide_color_dark_blue 0087AF
|
2020-05-13 23:08:37 +03:00
|
|
|
|
# ---------Prompt Connection---------
|
2020-05-19 22:10:11 +03:00
|
|
|
|
_set tide_prompt_connection_color 6C6C6C
|
|
|
|
|
_set tide_prompt_connection_icon ' '
|
2020-05-13 23:08:37 +03:00
|
|
|
|
|
|
|
|
|
# --------------------Prompt Items--------------------
|
2020-05-19 22:10:11 +03:00
|
|
|
|
_set tide_left_prompt_items 'pwd' 'git_prompt' 'newline' 'prompt_char'
|
|
|
|
|
_set tide_left_prompt_height 2
|
|
|
|
|
_set tide_right_prompt_items 'status' 'cmd_duration' 'context' 'jobs'
|
2020-05-19 21:25:17 +03:00
|
|
|
|
# ------------Prompt Char------------
|
2020-05-19 22:10:11 +03:00
|
|
|
|
_set tide_prompt_char_success_color $tide_color_green
|
|
|
|
|
_set tide_prompt_char_failure_color FF0000
|
|
|
|
|
_set tide_prompt_char_icon '❯'
|
2020-05-13 06:17:03 +03:00
|
|
|
|
# ----------------Pwd----------------
|
2020-05-19 22:10:11 +03:00
|
|
|
|
_set tide_pwd_shorten_margin 5
|
|
|
|
|
_set tide_pwd_unwritable_icon '' # Lock
|
|
|
|
|
_set tide_pwd_color_end_dirs $tide_color_light_blue
|
|
|
|
|
_set tide_pwd_color_mid_dirs $tide_color_dark_blue
|
|
|
|
|
_set tide_pwd_color_truncated_dirs 8787AF
|
2020-04-20 21:12:57 +03:00
|
|
|
|
# ------------Git prompt------------
|
2020-05-19 22:10:11 +03:00
|
|
|
|
_set __fish_git_prompt_show_informative_status true
|
|
|
|
|
_set __fish_git_prompt_showstashstate true
|
2020-04-20 21:12:57 +03:00
|
|
|
|
# -------Symbols-------
|
2020-05-19 22:10:11 +03:00
|
|
|
|
_set __fish_git_prompt_char_stateseparator ''
|
|
|
|
|
_set __fish_git_prompt_char_cleanstate ''
|
|
|
|
|
_set __fish_git_prompt_char_upstream_ahead ' ⇡'
|
|
|
|
|
_set __fish_git_prompt_char_upstream_behind ' ⇣'
|
|
|
|
|
_set __fish_git_prompt_char_stagedstate ' +'
|
|
|
|
|
_set __fish_git_prompt_char_dirtystate ' !'
|
|
|
|
|
_set __fish_git_prompt_char_untrackedfiles ' ?'
|
|
|
|
|
_set __fish_git_prompt_char_stashstate ' *'
|
2020-04-20 21:12:57 +03:00
|
|
|
|
# --------Colors--------
|
2020-05-19 22:10:11 +03:00
|
|
|
|
_set __fish_git_prompt_color_branch $tide_color_green
|
|
|
|
|
_set __fish_git_prompt_color_upstream $tide_color_green
|
|
|
|
|
_set __fish_git_prompt_color_stagedstate $tideColorGold
|
|
|
|
|
_set __fish_git_prompt_color_dirtystate $tideColorGold
|
|
|
|
|
_set __fish_git_prompt_color_untrackedfiles $tide_color_light_blue
|
|
|
|
|
_set __fish_git_prompt_color_stashstate $tide_color_green
|
2020-04-29 22:32:59 +03:00
|
|
|
|
# --------------Status--------------
|
2020-05-19 22:10:11 +03:00
|
|
|
|
_set tide_status_success_icon '✔'
|
|
|
|
|
_set tide_status_success_color $tideColorDarkerGreen
|
|
|
|
|
_set tide_status_failure_icon '✘'
|
|
|
|
|
_set tide_status_failure_color D70000
|
2020-05-13 23:08:37 +03:00
|
|
|
|
# -----------Cmd_Duration-----------
|
2020-05-19 22:10:11 +03:00
|
|
|
|
_set tide_cmd_duration_color 87875F
|
|
|
|
|
_set tide_cmd_duration_decimals 0
|
|
|
|
|
_set tide_cmd_duration_threshold 3000
|
2020-05-13 23:08:37 +03:00
|
|
|
|
# --------------Context--------------
|
2020-05-19 22:10:11 +03:00
|
|
|
|
_set tide_context_ssh_color D7AF87
|
|
|
|
|
_set tide_context_root_color $tideColorGold
|
2020-04-29 07:19:32 +03:00
|
|
|
|
# ---------------Jobs---------------
|
2020-05-19 22:10:11 +03:00
|
|
|
|
_set tide_jobs_icon '' # Gear
|
|
|
|
|
_set tide_jobs_color $tideColorDarkerGrxeen
|
2020-04-30 03:40:44 +03:00
|
|
|
|
# ---------------Time---------------
|
2020-05-19 22:10:11 +03:00
|
|
|
|
_set tide_time_color 5F8787
|
|
|
|
|
_set tide_time_format '%T'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function _set -a var_name var_value
|
|
|
|
|
set -U $var_name $var_value
|
|
|
|
|
set -a tide_var_list $var_name
|
2020-04-22 06:06:05 +03:00
|
|
|
|
end
|
|
|
|
|
|
2020-05-19 06:03:25 +03:00
|
|
|
|
function _source_tide_functions
|
|
|
|
|
source "$__fish_config_dir/conf.d/tide_cursor_movement.fish"
|
2020-05-17 20:01:17 +03:00
|
|
|
|
source "$__fish_config_dir/functions/fish_prompt.fish"
|
|
|
|
|
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-30 00:52:58 +03:00
|
|
|
|
case ''
|
2020-04-22 06:06:05 +03:00
|
|
|
|
return 0
|
|
|
|
|
end
|
|
|
|
|
end
|
2020-04-20 21:12:57 +03:00
|
|
|
|
end
|