mirror of
https://github.com/IlanCosman/tide.git
synced 2024-09-11 09:05:37 +03:00
Compare commits
5 Commits
ecb00e28ae
...
17f7922cf9
Author | SHA1 | Date | |
---|---|---|---|
|
17f7922cf9 | ||
|
ccb149f045 | ||
|
7c1497d4cc | ||
|
5d17d4c6dc | ||
|
2652ed78a0 |
@ -52,6 +52,8 @@ function _tide_title -a text
|
||||
set_color -o
|
||||
string pad --width (math --scale=0 "$fake_columns/2" + (string length $text)/2) $text
|
||||
set_color normal
|
||||
|
||||
set -g _tide_configure_first_option_after_title
|
||||
end
|
||||
|
||||
function _tide_option -a symbol text
|
||||
@ -59,7 +61,10 @@ function _tide_option -a symbol text
|
||||
set -ga _tide_option_list $text
|
||||
|
||||
if not set -q _flag_auto
|
||||
set -g _tide_configure_first_prompt_after_option
|
||||
|
||||
set_color -o
|
||||
set -e _tide_configure_first_option_after_title || echo
|
||||
echo "($symbol) $text"
|
||||
set_color normal
|
||||
end
|
||||
@ -85,6 +90,7 @@ function _tide_menu -a func
|
||||
|
||||
argparse no-restart -- $argv # Add no-restart option for first menu
|
||||
|
||||
echo
|
||||
if not set -q _flag_no_restart
|
||||
set -f r r
|
||||
echo '(r) Restart from the beginning'
|
||||
@ -117,10 +123,9 @@ function _tide_menu -a func
|
||||
end
|
||||
end
|
||||
|
||||
function _tide_display_prompt -a var_name var_value
|
||||
function _tide_display_prompt
|
||||
set -q _flag_auto && return
|
||||
|
||||
test -n "$var_name" && set -g $var_name $var_value
|
||||
_fake_tide_cache_variables
|
||||
set -l prompt (_fake_tide_prompt)
|
||||
|
||||
@ -128,9 +133,22 @@ function _tide_display_prompt -a var_name var_value
|
||||
set -l right_prompt_string (string pad --width (math $fake_columns-$bottom_left_prompt_string_length) $prompt[1])
|
||||
set -l prompt[-1] "$prompt[-1]$right_prompt_string"
|
||||
|
||||
string unescape $prompt[2..]
|
||||
if set -q _configure_transient
|
||||
if contains newline $fake_tide_left_prompt_items
|
||||
string unescape $prompt[3..]
|
||||
else
|
||||
_fake_tide_item_character
|
||||
echo
|
||||
end
|
||||
else
|
||||
if not set -q _tide_configure_first_prompt_after_option
|
||||
test "$fake_tide_prompt_add_newline_before" = true && echo
|
||||
end
|
||||
string unescape $prompt[2..]
|
||||
end
|
||||
|
||||
set -e _tide_configure_first_prompt_after_option
|
||||
set_color normal
|
||||
echo
|
||||
end
|
||||
|
||||
function _tide_exit_configure
|
||||
|
@ -34,7 +34,7 @@ if contains newline $_tide_left_items # two line prompt initialization
|
||||
set -l bot_right_frame "$prompt_and_frame_color─╯" &&
|
||||
set column_offset (math $column_offset-2)
|
||||
|
||||
if test "$tide_transient_enabled" = true
|
||||
if test "$tide_prompt_transient_enabled" = true
|
||||
eval "
|
||||
function fish_prompt
|
||||
_tide_status=\$status _tide_pipestatus=\$pipestatus if not set -e _tide_repaint
|
||||
@ -93,7 +93,7 @@ else # one line prompt initialization
|
||||
math 5 -$tide_prompt_min_cols | read -l column_offset
|
||||
test $column_offset -ge 0 && set column_offset "+$column_offset"
|
||||
|
||||
if test "$tide_transient_enabled" = true
|
||||
if test "$tide_prompt_transient_enabled" = true
|
||||
eval "
|
||||
function fish_prompt
|
||||
set -lx _tide_status \$status
|
||||
@ -148,11 +148,10 @@ eval "function _tide_on_fish_exit --on-event fish_exit
|
||||
set -e $prompt_var
|
||||
end"
|
||||
|
||||
if test "$tide_transient_enabled" = true
|
||||
if test "$tide_prompt_transient_enabled" = true
|
||||
function _tide_enter_transient
|
||||
commandline --is-valid
|
||||
# If commandline is complete (i.e pressing enter will produce a new prompt)
|
||||
if test $status != 2
|
||||
# If the commandline will be executed, or is empty
|
||||
if commandline --is-valid || test -z "$(commandline)"
|
||||
set -g _tide_transient
|
||||
set -g _tide_repaint
|
||||
commandline -f repaint
|
||||
|
@ -13,7 +13,7 @@ function icons
|
||||
case 'Few icons'
|
||||
_disable_icons
|
||||
end
|
||||
_next_choice all/finish
|
||||
_next_choice all/transient
|
||||
end
|
||||
|
||||
function _enable_icons
|
||||
|
@ -2,13 +2,16 @@ function prompt_connection
|
||||
_tide_title 'Prompt Connection'
|
||||
|
||||
_tide_option 1 Disconnected
|
||||
_tide_display_prompt fake_tide_prompt_icon_connection ' '
|
||||
set -g fake_tide_prompt_icon_connection ' '
|
||||
_tide_display_prompt
|
||||
|
||||
_tide_option 2 Dotted
|
||||
_tide_display_prompt fake_tide_prompt_icon_connection '·'
|
||||
set -g fake_tide_prompt_icon_connection '·'
|
||||
_tide_display_prompt
|
||||
|
||||
_tide_option 3 Solid
|
||||
_tide_display_prompt fake_tide_prompt_icon_connection '─'
|
||||
set -g fake_tide_prompt_icon_connection '─'
|
||||
_tide_display_prompt
|
||||
|
||||
_tide_menu (status function)
|
||||
switch $_tide_selected_option
|
||||
|
@ -10,16 +10,20 @@ function prompt_connection_andor_frame_color
|
||||
_tide_title "Connection & Frame Color"
|
||||
|
||||
_tide_option 1 Lightest
|
||||
_tide_display_prompt fake_tide_prompt_color_frame_and_connection 808080
|
||||
set -g fake_tide_prompt_color_frame_and_connection 808080
|
||||
_tide_display_prompt
|
||||
|
||||
_tide_option 2 Light
|
||||
_tide_display_prompt fake_tide_prompt_color_frame_and_connection 6C6C6C
|
||||
set -g fake_tide_prompt_color_frame_and_connection 6C6C6C
|
||||
_tide_display_prompt
|
||||
|
||||
_tide_option 3 Dark
|
||||
_tide_display_prompt fake_tide_prompt_color_frame_and_connection 585858
|
||||
set -g fake_tide_prompt_color_frame_and_connection 585858
|
||||
_tide_display_prompt
|
||||
|
||||
_tide_option 4 Darkest
|
||||
_tide_display_prompt fake_tide_prompt_color_frame_and_connection 444444
|
||||
set -g fake_tide_prompt_color_frame_and_connection 444444
|
||||
_tide_display_prompt
|
||||
|
||||
_tide_menu (status function)
|
||||
switch $_tide_selected_option
|
||||
|
@ -2,11 +2,12 @@ function prompt_spacing
|
||||
_tide_title 'Prompt Spacing'
|
||||
|
||||
_tide_option 1 Compact
|
||||
set -g fake_tide_prompt_add_newline_before false
|
||||
_tide_display_prompt
|
||||
printf \e\[1A # Move cursor up 1 row
|
||||
_tide_display_prompt
|
||||
|
||||
_tide_option 2 Sparse
|
||||
set -g fake_tide_prompt_add_newline_before true
|
||||
_tide_display_prompt
|
||||
_tide_display_prompt
|
||||
|
||||
|
@ -7,10 +7,12 @@ function show_time
|
||||
set -a fake_tide_right_prompt_items time
|
||||
|
||||
_tide_option 2 '24-hour format'
|
||||
_tide_display_prompt fake_tide_time_format %T
|
||||
set -g fake_tide_time_format %T
|
||||
_tide_display_prompt
|
||||
|
||||
_tide_option 3 '12-hour format'
|
||||
_tide_display_prompt fake_tide_time_format %r
|
||||
set -g fake_tide_time_format %r
|
||||
_tide_display_prompt
|
||||
|
||||
_tide_menu (status function)
|
||||
switch $_tide_selected_option
|
||||
|
22
functions/tide/configure/choices/all/transient.fish
Normal file
22
functions/tide/configure/choices/all/transient.fish
Normal file
@ -0,0 +1,22 @@
|
||||
function transient
|
||||
_tide_title 'Enable transient prompt?'
|
||||
|
||||
_tide_option 1 No
|
||||
_tide_display_prompt
|
||||
_tide_display_prompt
|
||||
_tide_display_prompt
|
||||
|
||||
_tide_option 2 Yes
|
||||
_configure_transient= _tide_display_prompt
|
||||
_configure_transient= _tide_display_prompt
|
||||
_tide_display_prompt
|
||||
|
||||
_tide_menu (status function)
|
||||
switch $_tide_selected_option
|
||||
case No
|
||||
set fake_tide_prompt_transient_enabled false
|
||||
case Yes
|
||||
set fake_tide_prompt_transient_enabled true
|
||||
end
|
||||
_next_choice all/finish
|
||||
end
|
@ -69,6 +69,7 @@ tide_prompt_color_frame_and_connection 6C6C6C
|
||||
tide_prompt_color_separator_same_color 949494
|
||||
tide_prompt_min_cols 34
|
||||
tide_prompt_pad_items true
|
||||
tide_prompt_transient_enabled false
|
||||
tide_pulumi_bg_color 444444
|
||||
tide_pulumi_color F7BF2A
|
||||
tide_pwd_bg_color 444444
|
||||
|
@ -69,6 +69,7 @@ tide_prompt_color_frame_and_connection 6C6C6C
|
||||
tide_prompt_color_separator_same_color 949494
|
||||
tide_prompt_min_cols 34
|
||||
tide_prompt_pad_items false
|
||||
tide_prompt_transient_enabled false
|
||||
tide_pulumi_bg_color normal
|
||||
tide_pulumi_color F7BF2A
|
||||
tide_pwd_bg_color normal
|
||||
|
@ -69,6 +69,7 @@ tide_prompt_color_frame_and_connection 6C6C6C
|
||||
tide_prompt_color_separator_same_color 949494
|
||||
tide_prompt_min_cols 34
|
||||
tide_prompt_pad_items true
|
||||
tide_prompt_transient_enabled false
|
||||
tide_pulumi_bg_color F7BF2A
|
||||
tide_pulumi_color 000000
|
||||
tide_pwd_bg_color 3465A4
|
||||
|
@ -1,5 +1,8 @@
|
||||
function _fake_tide_item_character
|
||||
set_color $fake_tide_character_color
|
||||
contains newline $fake_tide_left_prompt_items || echo -ns ' '
|
||||
echo -ns $fake_tide_character_icon
|
||||
if contains newline $fake_tide_left_prompt_items || set -q _configure_transient
|
||||
echo -ns $fake_tide_character_icon
|
||||
else
|
||||
echo -ns ' '$fake_tide_character_icon
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user