mirror of
https://github.com/IlanCosman/tide.git
synced 2024-11-23 08:46:51 +03:00
Rename to tide
This commit is contained in:
parent
e3128ba68b
commit
1b2fcb7f42
10
README.md
10
README.md
@ -1,6 +1,6 @@
|
|||||||
# Lean
|
# Tide
|
||||||
|
|
||||||
A minimal Fish theme based on [Powerlevel10k](https://github.com/romkatv/powerlevel10k/)'s lean style.
|
A Fish theme based on [Powerlevel10k](https://github.com/romkatv/powerlevel10k/).
|
||||||
|
|
||||||
![Prompt_Connection](/media/images/Prompt_Connection.png)
|
![Prompt_Connection](/media/images/Prompt_Connection.png)
|
||||||
|
|
||||||
@ -9,7 +9,7 @@ A minimal Fish theme based on [Powerlevel10k](https://github.com/romkatv/powerle
|
|||||||
Run the install script:
|
Run the install script:
|
||||||
|
|
||||||
```fish
|
```fish
|
||||||
curl -s https://raw.githubusercontent.com/IlanCosman/lean/master/install.fish | source; and lean_install
|
curl -s https://raw.githubusercontent.com/IlanCosman/tide/master/install.fish | source; and tide_install
|
||||||
```
|
```
|
||||||
|
|
||||||
# Features
|
# Features
|
||||||
@ -30,7 +30,7 @@ curl -s https://raw.githubusercontent.com/IlanCosman/lean/master/install.fish |
|
|||||||
|
|
||||||
# Configuration
|
# Configuration
|
||||||
|
|
||||||
Note that all lean variables, unless stated otherwise, begin with the string `lean_`. Thus, for brevity, variables in this section will be denoted as `example_variable` but will actually be `lean_example_variable`.
|
Note that all tide variables, unless stated otherwise, begin with the string `tide_`. Thus, for brevity, variables in this section will be denoted as `example_variable` but will actually be `tide_example_variable`.
|
||||||
|
|
||||||
## Colors
|
## Colors
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ Note that all lean variables, unless stated otherwise, begin with the string `le
|
|||||||
|
|
||||||
### git prompt
|
### git prompt
|
||||||
|
|
||||||
Lean's git capabilities are inherited from fish's built-in [fish_git_prompt](https://fishshell.com/docs/current/cmds/fish_git_prompt.html). Modify those variables to configure lean's git prompt.
|
Tide's git capabilities are inherited from fish's built-in [fish_git_prompt](https://fishshell.com/docs/current/cmds/fish_git_prompt.html). Modify those variables to configure tide's git prompt.
|
||||||
|
|
||||||
### prompt connection
|
### prompt connection
|
||||||
|
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
function lean_count_left_prompt_height --on-variable lean_left_prompt_items
|
|
||||||
set -l numberOfNewlines (count (string match -a 'newline' $lean_left_prompt_items))
|
|
||||||
set -U lean_left_prompt_height (math 1+$numberOfNewlines)
|
|
||||||
end
|
|
4
conf.d/tide_count_left_prompt_height.fish
Normal file
4
conf.d/tide_count_left_prompt_height.fish
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
function tide_count_left_prompt_height --on-variable tide_left_prompt_items
|
||||||
|
set -l numberOfNewlines (count (string match -a 'newline' $tide_left_prompt_items))
|
||||||
|
set -U tide_left_prompt_height (math 1+$numberOfNewlines)
|
||||||
|
end
|
@ -2,12 +2,12 @@ function local_install -a localRepo
|
|||||||
if source "$localRepo/install.fish"
|
if source "$localRepo/install.fish"
|
||||||
cp -r "$localRepo/conf.d" $__fish_config_dir
|
cp -r "$localRepo/conf.d" $__fish_config_dir
|
||||||
cp -r "$localRepo/functions" $__fish_config_dir
|
cp -r "$localRepo/functions" $__fish_config_dir
|
||||||
cp -r "$localRepo/lean_theme" $__fish_config_dir
|
cp -r "$localRepo/tide_theme" $__fish_config_dir
|
||||||
cp -r "$localRepo/tests" $__fish_config_dir
|
cp -r "$localRepo/tests" $__fish_config_dir
|
||||||
cp -r "$localRepo/dev/." "$__fish_config_dir/functions"
|
cp -r "$localRepo/dev/." "$__fish_config_dir/functions"
|
||||||
|
|
||||||
_set_lean_defaults
|
_set_tide_defaults
|
||||||
_source_lean_functions
|
_source_tide_functions
|
||||||
|
|
||||||
# Install fisher and fishtape for testing
|
# Install fisher and fishtape for testing
|
||||||
curl https://git.io/fisher --create-dirs -sLo ~/.config/fish/functions/fisher.fish
|
curl https://git.io/fisher --create-dirs -sLo ~/.config/fish/functions/fisher.fish
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
function lean_test
|
function tide_test
|
||||||
argparse 'h/help' 'v/verbose' 'a/all' -- $argv
|
argparse 'h/help' 'v/verbose' 'a/all' -- $argv
|
||||||
|
|
||||||
if set -q _flag_help
|
if set -q _flag_help
|
||||||
@ -8,9 +8,9 @@ function lean_test
|
|||||||
|
|
||||||
set -l testsDir "$__fish_config_dir/tests"
|
set -l testsDir "$__fish_config_dir/tests"
|
||||||
|
|
||||||
set -l pending '/tmp/lean_test'
|
set -l pending '/tmp/tide_test'
|
||||||
set -l failed '/tmp/lean_test_failed'
|
set -l failed '/tmp/tide_test_failed'
|
||||||
set -l passed '/tmp/lean_test_passed'
|
set -l passed '/tmp/tide_test_passed'
|
||||||
|
|
||||||
if set -q _flag_all
|
if set -q _flag_all
|
||||||
set argv (basename -s '.fish' $testsDir/*)
|
set argv (basename -s '.fish' $testsDir/*)
|
||||||
@ -48,7 +48,7 @@ end
|
|||||||
function _help
|
function _help
|
||||||
set -l b (set_color -o)
|
set -l b (set_color -o)
|
||||||
set -l n (set_color normal)
|
set -l n (set_color normal)
|
||||||
set -l g (set_color $lean_color_green)
|
set -l g (set_color $tide_color_green)
|
||||||
|
|
||||||
set -l optionList \
|
set -l optionList \
|
||||||
'v or --verbose' \
|
'v or --verbose' \
|
||||||
@ -59,7 +59,7 @@ function _help
|
|||||||
'run all available tests' \
|
'run all available tests' \
|
||||||
'print this help message'
|
'print this help message'
|
||||||
|
|
||||||
echo 'Usage: '$g'lean_test '$n'[options] '$b'[TESTS...]'$n
|
echo 'Usage: '$g'tide_test '$n'[options] '$b'[TESTS...]'$n
|
||||||
echo
|
echo
|
||||||
echo 'Options:'
|
echo 'Options:'
|
||||||
echo
|
echo
|
@ -1,6 +0,0 @@
|
|||||||
function _lean_jobs
|
|
||||||
if jobs -q
|
|
||||||
set_color $lean_jobs_color
|
|
||||||
printf '%s ' $lean_jobs_icon
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,4 +0,0 @@
|
|||||||
function _lean_time
|
|
||||||
set_color $lean_time_color
|
|
||||||
printf '%s ' (date +$lean_time_format)
|
|
||||||
end
|
|
@ -1,6 +1,6 @@
|
|||||||
function _lean_cmd_duration
|
function _tide_cmd_duration
|
||||||
if test $CMD_DURATION -gt $lean_cmd_duration_threshold
|
if test $CMD_DURATION -gt $tide_cmd_duration_threshold
|
||||||
set -l seconds (math --scale=$lean_cmd_duration_decimals "$CMD_DURATION/1000" % 60)
|
set -l seconds (math --scale=$tide_cmd_duration_decimals "$CMD_DURATION/1000" % 60)
|
||||||
set -l minutes (math -s0 "$CMD_DURATION/60000" % 60)
|
set -l minutes (math -s0 "$CMD_DURATION/60000" % 60)
|
||||||
set -l hours (math -s0 "$CMD_DURATION/3600000" % 60)
|
set -l hours (math -s0 "$CMD_DURATION/3600000" % 60)
|
||||||
|
|
||||||
@ -14,7 +14,7 @@ function _lean_cmd_duration
|
|||||||
set -e hours
|
set -e hours
|
||||||
end
|
end
|
||||||
|
|
||||||
set_color $lean_cmd_duration_color
|
set_color $tide_cmd_duration_color
|
||||||
printf '%s ' {$hours}'h' {$minutes}'m' {$seconds}'s'
|
printf '%s ' {$hours}'h' {$minutes}'m' {$seconds}'s'
|
||||||
end
|
end
|
||||||
end
|
end
|
@ -1,9 +1,9 @@
|
|||||||
function _lean_context
|
function _tide_context
|
||||||
if set -q SSH_TTY
|
if set -q SSH_TTY
|
||||||
set_color $lean_context_ssh_color
|
set_color $tide_context_ssh_color
|
||||||
printf '%s ' $USER'@'(prompt_hostname)
|
printf '%s ' $USER'@'(prompt_hostname)
|
||||||
else if test $USER = 'root'
|
else if test $USER = 'root'
|
||||||
set_color $lean_context_root_color
|
set_color $tide_context_root_color
|
||||||
printf '%s ' $USER'@'(prompt_hostname)
|
printf '%s ' $USER'@'(prompt_hostname)
|
||||||
end
|
end
|
||||||
end
|
end
|
@ -1,4 +1,4 @@
|
|||||||
function _lean_git_prompt
|
function _tide_git_prompt
|
||||||
if set -l gitPrompt (fish_git_prompt)
|
if set -l gitPrompt (fish_git_prompt)
|
||||||
|
|
||||||
set -l gitPrompt (string replace '(' '' $gitPrompt)
|
set -l gitPrompt (string replace '(' '' $gitPrompt)
|
6
functions/_tide_jobs.fish
Normal file
6
functions/_tide_jobs.fish
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
function _tide_jobs
|
||||||
|
if jobs -q
|
||||||
|
set_color $tide_jobs_color
|
||||||
|
printf '%s ' $tide_jobs_icon
|
||||||
|
end
|
||||||
|
end
|
@ -1,3 +1,3 @@
|
|||||||
function _lean_newline
|
function _tide_newline
|
||||||
printf '%s' '\n'
|
printf '%s' '\n'
|
||||||
end
|
end
|
@ -1,6 +1,6 @@
|
|||||||
function _lean_prompt_char
|
function _tide_prompt_char
|
||||||
if test $last_status -eq 0
|
if test $last_status -eq 0
|
||||||
set_color $lean_color_green
|
set_color $tide_color_green
|
||||||
else
|
else
|
||||||
set_color $fish_color_error
|
set_color $fish_color_error
|
||||||
end
|
end
|
@ -1,37 +1,37 @@
|
|||||||
function _lean_pwd
|
function _tide_pwd
|
||||||
set -l splitPwd (string split --no-empty '/' (_shorten_pwd))
|
set -l splitPwd (string split --no-empty '/' (_shorten_pwd))
|
||||||
set -l splitPwdLength (count $splitPwd)
|
set -l splitPwdLength (count $splitPwd)
|
||||||
|
|
||||||
if not test -w $PWD
|
if not test -w $PWD
|
||||||
set_color $lean_color_dark_blue
|
set_color $tide_color_dark_blue
|
||||||
printf '%s' {$lean_pwd_unwritable_icon}' '
|
printf '%s' {$tide_pwd_unwritable_icon}' '
|
||||||
set_color $fish_color_normal
|
set_color $fish_color_normal
|
||||||
end
|
end
|
||||||
|
|
||||||
if test "$splitPwd[1]" != '~'
|
if test "$splitPwd[1]" != '~'
|
||||||
set_color $lean_color_dark_blue
|
set_color $tide_color_dark_blue
|
||||||
printf '%s' '/'
|
printf '%s' '/'
|
||||||
set_color $fish_color_normal
|
set_color $fish_color_normal
|
||||||
end
|
end
|
||||||
|
|
||||||
set_color -o $lean_color_light_blue
|
set_color -o $tide_color_light_blue
|
||||||
printf '%s' "$splitPwd[1]"
|
printf '%s' "$splitPwd[1]"
|
||||||
set_color $fish_color_normal
|
set_color $fish_color_normal
|
||||||
|
|
||||||
if test $splitPwdLength -gt 1
|
if test $splitPwdLength -gt 1
|
||||||
set_color $lean_color_dark_blue
|
set_color $tide_color_dark_blue
|
||||||
printf '%s' '/'
|
printf '%s' '/'
|
||||||
set_color $fish_color_normal
|
set_color $fish_color_normal
|
||||||
end
|
end
|
||||||
|
|
||||||
if test $splitPwdLength -gt 2
|
if test $splitPwdLength -gt 2
|
||||||
set_color $lean_color_dark_blue
|
set_color $tide_color_dark_blue
|
||||||
printf '%s' (string join '/' $splitPwd[2..-2])'/'
|
printf '%s' (string join '/' $splitPwd[2..-2])'/'
|
||||||
set_color $fish_color_normal
|
set_color $fish_color_normal
|
||||||
end
|
end
|
||||||
|
|
||||||
if test $splitPwdLength -gt 1
|
if test $splitPwdLength -gt 1
|
||||||
set_color -o $lean_color_light_blue
|
set_color -o $tide_color_light_blue
|
||||||
printf '%s' "$splitPwd[-1]"
|
printf '%s' "$splitPwd[-1]"
|
||||||
set_color $fish_color_normal
|
set_color $fish_color_normal
|
||||||
end
|
end
|
||||||
@ -43,7 +43,7 @@ function _shorten_pwd
|
|||||||
set -l pwd (string replace $HOME '~' $PWD)
|
set -l pwd (string replace $HOME '~' $PWD)
|
||||||
set -l colorPwd $pwd
|
set -l colorPwd $pwd
|
||||||
set -l splitPwd (string split --no-empty '/' $pwd)
|
set -l splitPwd (string split --no-empty '/' $pwd)
|
||||||
set -l targetLength (math $COLUMNS-$lean_pwd_shorten_margin)
|
set -l targetLength (math $COLUMNS-$tide_pwd_shorten_margin)
|
||||||
|
|
||||||
set -l index 2
|
set -l index 2
|
||||||
while test (string length $pwd) -gt $targetLength
|
while test (string length $pwd) -gt $targetLength
|
||||||
@ -51,8 +51,8 @@ function _shorten_pwd
|
|||||||
set -l currentPartFirstLetter (string sub -l 1 $currentPart)
|
set -l currentPartFirstLetter (string sub -l 1 $currentPart)
|
||||||
set pwd (string replace $currentPart $currentPartFirstLetter $pwd)
|
set pwd (string replace $currentPart $currentPartFirstLetter $pwd)
|
||||||
|
|
||||||
set -l lilac (set_color $lean_color_lilac)
|
set -l lilac (set_color $tide_color_lilac)
|
||||||
set -l dBlue (set_color $lean_color_dark_blue)
|
set -l dBlue (set_color $tide_color_dark_blue)
|
||||||
set colorPwd (string replace $currentPart "$lilac"$currentPartFirstLetter"$dBlue" $colorPwd)
|
set colorPwd (string replace $currentPart "$lilac"$currentPartFirstLetter"$dBlue" $colorPwd)
|
||||||
|
|
||||||
set index (math $index+1)
|
set index (math $index+1)
|
@ -1,14 +1,14 @@
|
|||||||
function _lean_status
|
function _tide_status
|
||||||
if string match -q --invert '0' $last_pipestatus
|
if string match -q --invert '0' $last_pipestatus
|
||||||
set -l fishPipestatusWithSignal (__fish_pipestatus_with_signal $last_pipestatus)
|
set -l fishPipestatusWithSignal (__fish_pipestatus_with_signal $last_pipestatus)
|
||||||
|
|
||||||
if test (count $last_pipestatus) -gt 1 || string match -qe 'SIG' $fishPipestatusWithSignal
|
if test (count $last_pipestatus) -gt 1 || string match -qe 'SIG' $fishPipestatusWithSignal
|
||||||
if test $last_status -eq 0
|
if test $last_status -eq 0
|
||||||
set_color $lean_status_success_color
|
set_color $tide_status_success_color
|
||||||
printf '%s ' {$lean_status_success_icon}
|
printf '%s ' {$tide_status_success_icon}
|
||||||
else
|
else
|
||||||
set_color $lean_status_failure_color
|
set_color $tide_status_failure_color
|
||||||
printf '%s ' {$lean_status_failure_icon}
|
printf '%s ' {$tide_status_failure_icon}
|
||||||
end
|
end
|
||||||
printf '%s ' (string join '|' (string replace 'SIG' '' $fishPipestatusWithSignal))
|
printf '%s ' (string join '|' (string replace 'SIG' '' $fishPipestatusWithSignal))
|
||||||
end
|
end
|
4
functions/_tide_time.fish
Normal file
4
functions/_tide_time.fish
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
function _tide_time
|
||||||
|
set_color $tide_time_color
|
||||||
|
printf '%s ' (date +$tide_time_format)
|
||||||
|
end
|
@ -1,19 +1,19 @@
|
|||||||
# Created by lean configure
|
# Created by tide configure
|
||||||
function fish_prompt --description 'Write out the prompt'
|
function fish_prompt --description 'Write out the prompt'
|
||||||
set -g last_pipestatus $pipestatus
|
set -g last_pipestatus $pipestatus
|
||||||
set -g last_status $status
|
set -g last_status $status
|
||||||
|
|
||||||
if test "$lean_newline" = 'true'
|
if test "$tide_newline" = 'true'
|
||||||
printf '%b' '\n'
|
printf '%b' '\n'
|
||||||
end
|
end
|
||||||
|
|
||||||
set_color $lean_prompt_connection_color
|
set_color $tide_prompt_connection_color
|
||||||
printf "%.s$lean_prompt_connection_icon" (seq $COLUMNS)
|
printf "%.s$tide_prompt_connection_icon" (seq $COLUMNS)
|
||||||
set_color $fish_color_normal
|
set_color $fish_color_normal
|
||||||
|
|
||||||
printf '%b' '\r'
|
printf '%b' '\r'
|
||||||
lean_right_prompt
|
tide_right_prompt
|
||||||
|
|
||||||
printf '%b' '\r'
|
printf '%b' '\r'
|
||||||
lean_left_prompt
|
tide_left_prompt
|
||||||
end
|
end
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
function lean -a subcommand
|
|
||||||
set -l leanSubcommand "lean_$subcommand"
|
|
||||||
set -l leanCommands 'configure' 'uninstall' 'help'
|
|
||||||
|
|
||||||
if contains $subcommand $leanCommands
|
|
||||||
source "$lean_dir/functions/$subcommand.fish"
|
|
||||||
$leanSubcommand $argv[2..-1]
|
|
||||||
else
|
|
||||||
lean help
|
|
||||||
end
|
|
||||||
functions -e $leanSubcommand
|
|
||||||
end
|
|
12
functions/tide.fish
Normal file
12
functions/tide.fish
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
function tide -a subcommand
|
||||||
|
set -l tideSubcommand "tide_$subcommand"
|
||||||
|
set -l tideCommands 'configure' 'uninstall' 'help'
|
||||||
|
|
||||||
|
if contains $subcommand $tideCommands
|
||||||
|
source "$tide_dir/functions/$subcommand.fish"
|
||||||
|
$tideSubcommand $argv[2..-1]
|
||||||
|
else
|
||||||
|
tide help
|
||||||
|
end
|
||||||
|
functions -e $tideSubcommand
|
||||||
|
end
|
@ -1,4 +1,4 @@
|
|||||||
function lean_decolor -a text
|
function tide_decolor -a text
|
||||||
set text (string replace -a (set_color normal) '' "$text")
|
set text (string replace -a (set_color normal) '' "$text")
|
||||||
set text (string replace -ar '\e\[[0-9;]*m' '' "$text")
|
set text (string replace -ar '\e\[[0-9;]*m' '' "$text")
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
function lean_left_prompt
|
function tide_left_prompt
|
||||||
for item in lean_{$lean_left_prompt_items}
|
for item in tide_{$tide_left_prompt_items}
|
||||||
set -l itemOutput (_$item)
|
set -l itemOutput (_$item)
|
||||||
printf '%b' "$itemOutput"
|
printf '%b' "$itemOutput"
|
||||||
|
|
@ -1,29 +1,29 @@
|
|||||||
function lean_right_prompt
|
function tide_right_prompt
|
||||||
set -l splitText (string split '\n' (_fetch_right_prompt_items))
|
set -l splitText (string split '\n' (_fetch_right_prompt_items))
|
||||||
set -l printAtEndedRightPromptHeight (count $splitText)
|
set -l printAtEndedRightPromptHeight (count $splitText)
|
||||||
|
|
||||||
for thing in $splitText[1..-2]
|
for thing in $splitText[1..-2]
|
||||||
_print_at_end $thing
|
_print_at_end $thing
|
||||||
end
|
end
|
||||||
if test $printAtEndedRightPromptHeight -eq $lean_left_prompt_height
|
if test $printAtEndedRightPromptHeight -eq $tide_left_prompt_height
|
||||||
set -g lean_right_prompt_fish $splitText[-1]
|
set -g tide_right_prompt_fish $splitText[-1]
|
||||||
set printAtEndedRightPromptHeight (math $printAtEndedRightPromptHeight-1)
|
set printAtEndedRightPromptHeight (math $printAtEndedRightPromptHeight-1)
|
||||||
else
|
else
|
||||||
_print_at_end $splitText[-1]
|
_print_at_end $splitText[-1]
|
||||||
set -g lean_right_prompt_fish ''
|
set -g tide_right_prompt_fish ''
|
||||||
end
|
end
|
||||||
|
|
||||||
_cursor_up $printAtEndedRightPromptHeight
|
_cursor_up $printAtEndedRightPromptHeight
|
||||||
end
|
end
|
||||||
|
|
||||||
function fish_right_prompt
|
function fish_right_prompt
|
||||||
printf '%s' $lean_right_prompt_fish
|
printf '%s' $tide_right_prompt_fish
|
||||||
end
|
end
|
||||||
|
|
||||||
function _fetch_right_prompt_items
|
function _fetch_right_prompt_items
|
||||||
printf '%s' ' '
|
printf '%s' ' '
|
||||||
|
|
||||||
for item in lean_{$lean_right_prompt_items}
|
for item in tide_{$tide_right_prompt_items}
|
||||||
set -l itemOutput (_$item)
|
set -l itemOutput (_$item)
|
||||||
printf '%s' "$itemOutput"
|
printf '%s' "$itemOutput"
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ function _fetch_right_prompt_items
|
|||||||
end
|
end
|
||||||
|
|
||||||
function _print_at_end -a text
|
function _print_at_end -a text
|
||||||
set -l startLocation (math $COLUMNS -(string length (lean_decolor $text)))
|
set -l startLocation (math $COLUMNS -(string length (tide_decolor $text)))
|
||||||
_cursor_right $startLocation
|
_cursor_right $startLocation
|
||||||
printf '%s' $text
|
printf '%s' $text
|
||||||
|
|
102
install.fish
102
install.fish
@ -1,17 +1,17 @@
|
|||||||
function lean_install
|
function tide_install
|
||||||
echo 'Installing lean theme...'
|
echo 'Installing tide theme...'
|
||||||
|
|
||||||
# -----------------Download Functions-----------------
|
# -----------------Download Functions-----------------
|
||||||
set -l tempDir '/tmp/lean_theme'
|
set -l tempDir '/tmp/tide_theme'
|
||||||
|
|
||||||
# Clone repository into $tempDir
|
# Clone repository into $tempDir
|
||||||
if test -e $tempDir
|
if test -e $tempDir
|
||||||
rm -rf $tempDir
|
rm -rf $tempDir
|
||||||
end
|
end
|
||||||
git clone -q --depth=1 https://github.com/IlanCosman/lean.git $tempDir
|
git clone -q --depth=1 https://github.com/IlanCosman/tide.git $tempDir
|
||||||
|
|
||||||
# Remove all files/dirs except functions and lean_theme
|
# Remove all files/dirs except functions and tide_theme
|
||||||
set -l keepFiles "$tempDir/"{'conf.d', 'functions', 'lean_theme'}
|
set -l keepFiles "$tempDir/"{'conf.d', 'functions', 'tide_theme'}
|
||||||
for file in $tempDir/*
|
for file in $tempDir/*
|
||||||
if not contains $file $keepFiles
|
if not contains $file $keepFiles
|
||||||
rm -rf $file
|
rm -rf $file
|
||||||
@ -19,54 +19,54 @@ function lean_install
|
|||||||
end
|
end
|
||||||
rm -rf "$tempDir/.git"
|
rm -rf "$tempDir/.git"
|
||||||
|
|
||||||
# Copy remaining directory contents into $__fish_config_dir and cleanup
|
# Copy remaining directory contents into $__fish_config_dir and ctideup
|
||||||
cp -rf "$tempDir/." $__fish_config_dir
|
cp -rf "$tempDir/." $__fish_config_dir
|
||||||
rm -rf $tempDir
|
rm -rf $tempDir
|
||||||
|
|
||||||
# --------------------Set Defaults--------------------
|
# --------------------Set Defaults--------------------
|
||||||
_set_lean_defaults
|
_set_tide_defaults
|
||||||
|
|
||||||
# -----------------------Finish-----------------------
|
# -----------------------Finish-----------------------
|
||||||
_source_lean_functions
|
_source_tide_functions
|
||||||
|
|
||||||
set_color $lean_color_green
|
set_color $tide_color_green
|
||||||
echo 'Lean theme installed!'
|
echo 'Tide theme installed!'
|
||||||
set_color $fish_color_normal
|
set_color $fish_color_normal
|
||||||
|
|
||||||
if _user_confirm_defaultYes 'Configure lean prompt?'
|
if _user_confirm_defaultYes 'Configure tide prompt?'
|
||||||
lean configure
|
tide configure
|
||||||
else
|
else
|
||||||
echo
|
echo
|
||||||
echo 'Run lean configure to configure your prompt.'
|
echo 'Run tide configure to configure your prompt.'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function _set_lean_defaults
|
function _set_tide_defaults
|
||||||
# ---------------General Theme Variables---------------
|
# ---------------General Theme Variables---------------
|
||||||
set -U lean_dir "$__fish_config_dir/lean_theme"
|
set -U tide_dir "$__fish_config_dir/tide_theme"
|
||||||
set -U lean_newline 'true'
|
set -U tide_newline 'true'
|
||||||
# --------------Colors--------------
|
# --------------Colors--------------
|
||||||
set -U lean_color_green 5FD700
|
set -U tide_color_green 5FD700
|
||||||
set -U lean_color_light_blue 00AFFF
|
set -U tide_color_light_blue 00AFFF
|
||||||
set -U lean_color_dark_blue 0087AF
|
set -U tide_color_dark_blue 0087AF
|
||||||
set -U lean_color_gold D7AF00
|
set -U tide_color_gold D7AF00
|
||||||
set -U lean_color_lilac 8787AF
|
set -U tide_color_lilac 8787AF
|
||||||
# ---------Prompt Connection---------
|
# ---------Prompt Connection---------
|
||||||
set -U lean_prompt_connection_color 6C6C6C
|
set -U tide_prompt_connection_color 6C6C6C
|
||||||
set -U lean_prompt_connection_icon ' '
|
set -U tide_prompt_connection_icon ' '
|
||||||
|
|
||||||
# --------------------Prompt Items--------------------
|
# --------------------Prompt Items--------------------
|
||||||
set -U lean_left_prompt_items 'pwd' 'git_prompt' 'newline' 'prompt_char'
|
set -U tide_left_prompt_items 'pwd' 'git_prompt' 'newline' 'prompt_char'
|
||||||
set -U lean_right_prompt_items 'status' 'cmd_duration' 'context' 'jobs'
|
set -U tide_right_prompt_items 'status' 'cmd_duration' 'context' 'jobs'
|
||||||
# ----------------Pwd----------------
|
# ----------------Pwd----------------
|
||||||
set -U lean_pwd_shorten_margin 5
|
set -U tide_pwd_shorten_margin 5
|
||||||
set -U lean_pwd_unwritable_icon '' # Lock
|
set -U tide_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
|
||||||
# -------Symbols-------
|
# -------Symbols-------
|
||||||
set -U __fish_git_prompt_char_stateseparator ''
|
set -U __fish_git_prompt_char_stateseparator ''
|
||||||
set -U __fish_git_prompt_char_cleanstate ''
|
set -U __fish_git_prompt_char_ctidestate ''
|
||||||
set -U __fish_git_prompt_char_upstream_ahead ' ⇡'
|
set -U __fish_git_prompt_char_upstream_ahead ' ⇡'
|
||||||
set -U __fish_git_prompt_char_upstream_behind ' ⇣'
|
set -U __fish_git_prompt_char_upstream_behind ' ⇣'
|
||||||
set -U __fish_git_prompt_char_stagedstate ' +'
|
set -U __fish_git_prompt_char_stagedstate ' +'
|
||||||
@ -74,37 +74,37 @@ function _set_lean_defaults
|
|||||||
set -U __fish_git_prompt_char_untrackedfiles ' ?'
|
set -U __fish_git_prompt_char_untrackedfiles ' ?'
|
||||||
set -U __fish_git_prompt_char_stashstate ' *'
|
set -U __fish_git_prompt_char_stashstate ' *'
|
||||||
# --------Colors--------
|
# --------Colors--------
|
||||||
set -U __fish_git_prompt_color_branch $lean_color_green
|
set -U __fish_git_prompt_color_branch $tide_color_green
|
||||||
set -U __fish_git_prompt_color_upstream $lean_color_green
|
set -U __fish_git_prompt_color_upstream $tide_color_green
|
||||||
set -U __fish_git_prompt_color_stagedstate $lean_color_gold
|
set -U __fish_git_prompt_color_stagedstate $tide_color_gold
|
||||||
set -U __fish_git_prompt_color_dirtystate $lean_color_gold
|
set -U __fish_git_prompt_color_dirtystate $tide_color_gold
|
||||||
set -U __fish_git_prompt_color_untrackedfiles $lean_color_light_blue
|
set -U __fish_git_prompt_color_untrackedfiles $tide_color_light_blue
|
||||||
set -U __fish_git_prompt_color_stashstate $lean_color_green
|
set -U __fish_git_prompt_color_stashstate $tide_color_green
|
||||||
# --------------Status--------------
|
# --------------Status--------------
|
||||||
set -U lean_status_success_icon '✔'
|
set -U tide_status_success_icon '✔'
|
||||||
set -U lean_status_success_color 5FAF00
|
set -U tide_status_success_color 5FAF00
|
||||||
set -U lean_status_failure_icon '✘'
|
set -U tide_status_failure_icon '✘'
|
||||||
set -U lean_status_failure_color D70000
|
set -U tide_status_failure_color D70000
|
||||||
# -----------Cmd_Duration-----------
|
# -----------Cmd_Duration-----------
|
||||||
set -U lean_cmd_duration_color 87875F
|
set -U tide_cmd_duration_color 87875F
|
||||||
set -U lean_cmd_duration_decimals 0
|
set -U tide_cmd_duration_decimals 0
|
||||||
set -U lean_cmd_duration_threshold 3000
|
set -U tide_cmd_duration_threshold 3000
|
||||||
# --------------Context--------------
|
# --------------Context--------------
|
||||||
set -U lean_context_ssh_color D7AF87
|
set -U tide_context_ssh_color D7AF87
|
||||||
set -U lean_context_root_color D7AF00
|
set -U tide_context_root_color D7AF00
|
||||||
# ---------------Jobs---------------
|
# ---------------Jobs---------------
|
||||||
set -U lean_jobs_icon '' # Gear
|
set -U tide_jobs_icon '' # Gear
|
||||||
set -U lean_jobs_color 5FAF00
|
set -U tide_jobs_color 5FAF00
|
||||||
# ---------------Time---------------
|
# ---------------Time---------------
|
||||||
set -U lean_time_color 5F8787
|
set -U tide_time_color 5F8787
|
||||||
end
|
end
|
||||||
|
|
||||||
function _source_lean_functions
|
function _source_tide_functions
|
||||||
source "$__fish_config_dir/conf.d/lean_count_left_prompt_height.fish"
|
source "$__fish_config_dir/conf.d/tide_count_left_prompt_height.fish"
|
||||||
source "$__fish_config_dir/conf.d/lean_cursor_movement.fish"
|
source "$__fish_config_dir/conf.d/tide_cursor_movement.fish"
|
||||||
source "$__fish_config_dir/functions/fish_prompt.fish"
|
source "$__fish_config_dir/functions/fish_prompt.fish"
|
||||||
|
|
||||||
lean_count_left_prompt_height
|
tide_count_left_prompt_height
|
||||||
end
|
end
|
||||||
|
|
||||||
function _user_confirm_defaultYes -a question
|
function _user_confirm_defaultYes -a question
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
function fake_prompt
|
|
||||||
if test "$fake_lean_newline" = 'true'
|
|
||||||
printf '\n'
|
|
||||||
end
|
|
||||||
|
|
||||||
set_color $fake_lean_prompt_connection_color
|
|
||||||
printf "%.s$fake_lean_prompt_connection_icon" (seq $fake_columns)
|
|
||||||
set_color $fish_color_normal
|
|
||||||
|
|
||||||
printf '\r'
|
|
||||||
fake_lean_right_prompt
|
|
||||||
|
|
||||||
printf '\r'
|
|
||||||
fake_lean_left_prompt
|
|
||||||
end
|
|
@ -1,4 +0,0 @@
|
|||||||
function _fake_lean_cmd_duration
|
|
||||||
set_color $lean_cmd_duration_color
|
|
||||||
printf '%s ' '5s'
|
|
||||||
end
|
|
@ -1,4 +0,0 @@
|
|||||||
function _fake_lean_git_prompt
|
|
||||||
set_color $lean_color_green
|
|
||||||
printf '%s ' 'master'
|
|
||||||
end
|
|
@ -1,3 +0,0 @@
|
|||||||
function _fake_lean_newline
|
|
||||||
printf '%s' '\n'
|
|
||||||
end
|
|
@ -1,4 +0,0 @@
|
|||||||
function _fake_lean_prompt_char
|
|
||||||
set_color $lean_color_green
|
|
||||||
printf '%s ' '❯'
|
|
||||||
end
|
|
@ -1,14 +0,0 @@
|
|||||||
function _fake_lean_pwd
|
|
||||||
set_color -o $lean_color_light_blue
|
|
||||||
printf '%s' '~'
|
|
||||||
set_color normal
|
|
||||||
|
|
||||||
set_color $lean_color_dark_blue
|
|
||||||
printf '%s' '/'
|
|
||||||
set_color normal
|
|
||||||
|
|
||||||
set_color -o $lean_color_light_blue
|
|
||||||
printf '%s' 'src'
|
|
||||||
|
|
||||||
printf '%s' ' '
|
|
||||||
end
|
|
@ -1,4 +0,0 @@
|
|||||||
function _fake_lean_time
|
|
||||||
set_color $fake_lean_time_color
|
|
||||||
printf '%s ' (date +$fake_lean_time_format)
|
|
||||||
end
|
|
@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
function _cmd_duration -a duration threshold decimals
|
function _cmd_duration -a duration threshold decimals
|
||||||
set -g CMD_DURATION $duration
|
set -g CMD_DURATION $duration
|
||||||
set -g lean_cmd_duration_threshold $threshold
|
set -g tide_cmd_duration_threshold $threshold
|
||||||
set -g lean_cmd_duration_decimals $decimals
|
set -g tide_cmd_duration_decimals $decimals
|
||||||
|
|
||||||
lean_decolor (_lean_cmd_duration)
|
tide_decolor (_tide_cmd_duration)
|
||||||
end
|
end
|
||||||
|
|
||||||
@test 'Less than threshold' (_cmd_duration 2000 3000 0) -z
|
@test 'Less than threshold' (_cmd_duration 2000 3000 0) -z
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
@mesg '-----------context-----------'
|
@mesg '-----------context-----------'
|
||||||
|
|
||||||
set -l sourceFile "$__fish_config_dir/functions/_lean_context.fish"
|
set -l sourceFile "$__fish_config_dir/functions/_tide_context.fish"
|
||||||
|
|
||||||
function _context
|
function _context
|
||||||
lean_decolor (_lean_context)
|
tide_decolor (_tide_context)
|
||||||
end
|
end
|
||||||
|
|
||||||
@test 'None' (_context) -z
|
@test 'None' (_context) -z
|
||||||
@test 'SSH' (set -g SSH_TTY 'true'; _context) = $USER'@'(prompt_hostname)' '
|
@test 'SSH' (set -g SSH_TTY 'true'; _context) = $USER'@'(prompt_hostname)' '
|
||||||
@test 'Root' (lean_decolor (su -c "fish -c 'source $sourceFile;_lean_context'")) = 'root@'(prompt_hostname)' '
|
@test 'Root' (tide_decolor (su -c "fish -c 'source $sourceFile;_tide_context'")) = 'root@'(prompt_hostname)' '
|
@ -1,8 +1,8 @@
|
|||||||
@mesg '-------------jobs-------------'
|
@mesg '-------------jobs-------------'
|
||||||
|
|
||||||
function _jobs
|
function _jobs
|
||||||
lean_decolor (_lean_jobs)
|
tide_decolor (_tide_jobs)
|
||||||
end
|
end
|
||||||
|
|
||||||
@test 'No Jobs' (_jobs) -z
|
@test 'No Jobs' (_jobs) -z
|
||||||
@test 'Jobs' (sleep 60 &; _jobs) = "$lean_jobs_icon "
|
@test 'Jobs' (sleep 60 &; _jobs) = "$tide_jobs_icon "
|
@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
function _pwd -a dir
|
function _pwd -a dir
|
||||||
cd $dir
|
cd $dir
|
||||||
lean_decolor (_lean_pwd)
|
tide_decolor (_tide_pwd)
|
||||||
end
|
end
|
||||||
|
|
||||||
set -l unwr "$lean_pwd_unwritable_icon "
|
set -l unwr "$tide_pwd_unwritable_icon "
|
||||||
|
|
||||||
@test '/' (_pwd '/') = $unwr'/ '
|
@test '/' (_pwd '/') = $unwr'/ '
|
||||||
@test '/usr' (_pwd '/usr') = $unwr'/usr '
|
@test '/usr' (_pwd '/usr') = $unwr'/usr '
|
||||||
|
@ -3,12 +3,12 @@
|
|||||||
function _status
|
function _status
|
||||||
set -g last_pipestatus $pipestatus
|
set -g last_pipestatus $pipestatus
|
||||||
set -g last_status $status
|
set -g last_status $status
|
||||||
lean_decolor (_lean_status)
|
tide_decolor (_tide_status)
|
||||||
end
|
end
|
||||||
|
|
||||||
@test 'true' (true; _status) -z
|
@test 'true' (true; _status) -z
|
||||||
@test 'false' (false; _status) -z
|
@test 'false' (false; _status) -z
|
||||||
@test 'true|false' (true|false; _status) = "$lean_status_failure_icon 0|1 "
|
@test 'true|false' (true|false; _status) = "$tide_status_failure_icon 0|1 "
|
||||||
@test 'true|true' (true|true; _status) -z
|
@test 'true|true' (true|true; _status) -z
|
||||||
@test 'false|true' (false|true; _status) = "$lean_status_success_icon 1|0 "
|
@test 'false|true' (false|true; _status) = "$tide_status_success_icon 1|0 "
|
||||||
@test 'false|false' (false|false; _status) = "$lean_status_failure_icon 1|1 "
|
@test 'false|false' (false|false; _status) = "$tide_status_failure_icon 1|1 "
|
@ -1,5 +1,5 @@
|
|||||||
function finish
|
function finish
|
||||||
_title 'Overwrite lean config?'
|
_title 'Overwrite tide config?'
|
||||||
|
|
||||||
_option y 'Yes'
|
_option y 'Yes'
|
||||||
printf '%b' '\n\n'
|
printf '%b' '\n\n'
|
||||||
@ -10,12 +10,12 @@ function finish
|
|||||||
switch (_menu 'Choice' y/n)
|
switch (_menu 'Choice' y/n)
|
||||||
case y
|
case y
|
||||||
|
|
||||||
set -U lean_right_prompt_items 'status' 'cmd_duration' 'context' 'jobs'
|
set -U tide_right_prompt_items 'status' 'cmd_duration' 'context' 'jobs'
|
||||||
if test -z $lean_time_format
|
if test -z $tide_time_format
|
||||||
set -a lean_right_prompt_items 'time'
|
set -a tide_right_prompt_items 'time'
|
||||||
end
|
end
|
||||||
|
|
||||||
set -l vars lean_{ \
|
set -l vars tide_{ \
|
||||||
newline, \
|
newline, \
|
||||||
left_prompt_items, \
|
left_prompt_items, \
|
||||||
prompt_connection_color, prompt_connection_icon, \
|
prompt_connection_color, prompt_connection_icon, \
|
@ -2,25 +2,25 @@ function prompt_connection
|
|||||||
_title 'Prompt Connection'
|
_title 'Prompt Connection'
|
||||||
|
|
||||||
_option 1 'Disconnected'
|
_option 1 'Disconnected'
|
||||||
_display_prompt fake_lean_prompt_connection_icon ' '
|
_display_prompt fake_tide_prompt_connection_icon ' '
|
||||||
|
|
||||||
_option 2 'Dotted'
|
_option 2 'Dotted'
|
||||||
_display_prompt fake_lean_prompt_connection_icon '·'
|
_display_prompt fake_tide_prompt_connection_icon '·'
|
||||||
|
|
||||||
_option 3 'Solid'
|
_option 3 'Solid'
|
||||||
_display_prompt fake_lean_prompt_connection_icon '─'
|
_display_prompt fake_tide_prompt_connection_icon '─'
|
||||||
|
|
||||||
_display_restart_and_quit
|
_display_restart_and_quit
|
||||||
|
|
||||||
switch (_menu 'Choice' 1/2/3/r/q)
|
switch (_menu 'Choice' 1/2/3/r/q)
|
||||||
case 1
|
case 1
|
||||||
set -g fake_lean_prompt_connection_icon ' '
|
set -g fake_tide_prompt_connection_icon ' '
|
||||||
_next_choice 'prompt_spacing'
|
_next_choice 'prompt_spacing'
|
||||||
case 2
|
case 2
|
||||||
set -g fake_lean_prompt_connection_icon '·'
|
set -g fake_tide_prompt_connection_icon '·'
|
||||||
_next_choice 'prompt_connection_color'
|
_next_choice 'prompt_connection_color'
|
||||||
case 3
|
case 3
|
||||||
set -g fake_lean_prompt_connection_icon '─'
|
set -g fake_tide_prompt_connection_icon '─'
|
||||||
_next_choice 'prompt_connection_color'
|
_next_choice 'prompt_connection_color'
|
||||||
case r
|
case r
|
||||||
_begin
|
_begin
|
@ -2,31 +2,31 @@ function prompt_connection_color
|
|||||||
_title 'Connection Color'
|
_title 'Connection Color'
|
||||||
|
|
||||||
_option 1 'Lightest'
|
_option 1 'Lightest'
|
||||||
_display_prompt fake_lean_prompt_connection_color 808080
|
_display_prompt fake_tide_prompt_connection_color 808080
|
||||||
|
|
||||||
_option 2 'Light'
|
_option 2 'Light'
|
||||||
_display_prompt fake_lean_prompt_connection_color 6C6C6C
|
_display_prompt fake_tide_prompt_connection_color 6C6C6C
|
||||||
|
|
||||||
_option 3 'Dark'
|
_option 3 'Dark'
|
||||||
_display_prompt fake_lean_prompt_connection_color 585858
|
_display_prompt fake_tide_prompt_connection_color 585858
|
||||||
|
|
||||||
_option 4 'Darkest'
|
_option 4 'Darkest'
|
||||||
_display_prompt fake_lean_prompt_connection_color 444444
|
_display_prompt fake_tide_prompt_connection_color 444444
|
||||||
|
|
||||||
_display_restart_and_quit
|
_display_restart_and_quit
|
||||||
|
|
||||||
switch (_menu 'Choice' 1/2/3/4/r/q)
|
switch (_menu 'Choice' 1/2/3/4/r/q)
|
||||||
case 1
|
case 1
|
||||||
set -g fake_lean_prompt_connection_color 808080
|
set -g fake_tide_prompt_connection_color 808080
|
||||||
_next_choice 'prompt_spacing'
|
_next_choice 'prompt_spacing'
|
||||||
case 2
|
case 2
|
||||||
set -g fake_lean_prompt_connection_color 6C6C6C
|
set -g fake_tide_prompt_connection_color 6C6C6C
|
||||||
_next_choice 'prompt_spacing'
|
_next_choice 'prompt_spacing'
|
||||||
case 3
|
case 3
|
||||||
set -g fake_lean_prompt_connection_color 585858
|
set -g fake_tide_prompt_connection_color 585858
|
||||||
_next_choice 'prompt_spacing'
|
_next_choice 'prompt_spacing'
|
||||||
case 4
|
case 4
|
||||||
set -g fake_lean_prompt_connection_color 444444
|
set -g fake_tide_prompt_connection_color 444444
|
||||||
_next_choice 'prompt_spacing'
|
_next_choice 'prompt_spacing'
|
||||||
case r
|
case r
|
||||||
_begin
|
_begin
|
@ -2,22 +2,22 @@ function prompt_height
|
|||||||
_title 'Prompt Height?'
|
_title 'Prompt Height?'
|
||||||
|
|
||||||
_option 1 'One line'
|
_option 1 'One line'
|
||||||
set -g fake_lean_left_prompt_items 'pwd' 'git_prompt' 'prompt_char'
|
set -g fake_tide_left_prompt_items 'pwd' 'git_prompt' 'prompt_char'
|
||||||
# fake_lean_count_left_prompt_height
|
# fake_tide_count_left_prompt_height
|
||||||
_display_prompt
|
_display_prompt
|
||||||
|
|
||||||
_option 2 'Two lines'
|
_option 2 'Two lines'
|
||||||
set -g fake_lean_left_prompt_items 'pwd' 'git_prompt' 'newline' 'prompt_char'
|
set -g fake_tide_left_prompt_items 'pwd' 'git_prompt' 'newline' 'prompt_char'
|
||||||
_display_prompt
|
_display_prompt
|
||||||
|
|
||||||
_display_restart_and_quit
|
_display_restart_and_quit
|
||||||
|
|
||||||
switch (_menu 'Choice' 1/2/r/q)
|
switch (_menu 'Choice' 1/2/r/q)
|
||||||
case 1
|
case 1
|
||||||
set -g fake_lean_left_prompt_items 'pwd' 'git_prompt' 'prompt_char'
|
set -g fake_tide_left_prompt_items 'pwd' 'git_prompt' 'prompt_char'
|
||||||
_next_choice 'prompt_spacing'
|
_next_choice 'prompt_spacing'
|
||||||
case 2
|
case 2
|
||||||
set -g fake_lean_left_prompt_items 'pwd' 'git_prompt' 'newline' 'prompt_char'
|
set -g fake_tide_left_prompt_items 'pwd' 'git_prompt' 'newline' 'prompt_char'
|
||||||
_next_choice 'prompt_connection'
|
_next_choice 'prompt_connection'
|
||||||
case r
|
case r
|
||||||
_begin
|
_begin
|
@ -2,23 +2,23 @@ function prompt_spacing
|
|||||||
_title 'Prompt Spacing'
|
_title 'Prompt Spacing'
|
||||||
|
|
||||||
_option 1 'Compact'
|
_option 1 'Compact'
|
||||||
_display_prompt fake_lean_newline true
|
_display_prompt fake_tide_newline true
|
||||||
_cursor_up 1
|
_cursor_up 1
|
||||||
_display_prompt fake_lean_newline false
|
_display_prompt fake_tide_newline false
|
||||||
|
|
||||||
_option 2 'Sparse'
|
_option 2 'Sparse'
|
||||||
_display_prompt fake_lean_newline true
|
_display_prompt fake_tide_newline true
|
||||||
_cursor_up 1
|
_cursor_up 1
|
||||||
_display_prompt fake_lean_newline true
|
_display_prompt fake_tide_newline true
|
||||||
|
|
||||||
_display_restart_and_quit
|
_display_restart_and_quit
|
||||||
|
|
||||||
switch (_menu 'Choice' 1/2/r/q)
|
switch (_menu 'Choice' 1/2/r/q)
|
||||||
case 1
|
case 1
|
||||||
set -g fake_lean_newline false
|
set -g fake_tide_newline false
|
||||||
_next_choice 'finish'
|
_next_choice 'finish'
|
||||||
case 2
|
case 2
|
||||||
set -g fake_lean_newline true
|
set -g fake_tide_newline true
|
||||||
_next_choice 'finish'
|
_next_choice 'finish'
|
||||||
case r
|
case r
|
||||||
_begin
|
_begin
|
@ -2,25 +2,25 @@ function show_time
|
|||||||
_title 'Show current time?'
|
_title 'Show current time?'
|
||||||
|
|
||||||
_option 1 'No'
|
_option 1 'No'
|
||||||
_display_prompt fake_lean_time_format ''
|
_display_prompt fake_tide_time_format ''
|
||||||
|
|
||||||
_option 2 '24-hour format'
|
_option 2 '24-hour format'
|
||||||
_display_prompt fake_lean_time_format '%T'
|
_display_prompt fake_tide_time_format '%T'
|
||||||
|
|
||||||
_option 3 '12-hour format'
|
_option 3 '12-hour format'
|
||||||
_display_prompt fake_lean_time_format '%r'
|
_display_prompt fake_tide_time_format '%r'
|
||||||
|
|
||||||
_display_restart_and_quit
|
_display_restart_and_quit
|
||||||
|
|
||||||
switch (_menu 'Choice' 1/2/3/r/q)
|
switch (_menu 'Choice' 1/2/3/r/q)
|
||||||
case 1
|
case 1
|
||||||
set -g fake_lean_time_format ''
|
set -g fake_tide_time_format ''
|
||||||
_next_choice 'prompt_height'
|
_next_choice 'prompt_height'
|
||||||
case 2
|
case 2
|
||||||
set -g fake_lean_time_format '%T'
|
set -g fake_tide_time_format '%T'
|
||||||
_next_choice 'prompt_height'
|
_next_choice 'prompt_height'
|
||||||
case 3
|
case 3
|
||||||
set -g fake_lean_time_format '%r'
|
set -g fake_tide_time_format '%r'
|
||||||
_next_choice 'prompt_height'
|
_next_choice 'prompt_height'
|
||||||
case r
|
case r
|
||||||
_begin
|
_begin
|
@ -1,5 +1,5 @@
|
|||||||
function fake_lean_left_prompt
|
function fake_tide_left_prompt
|
||||||
for item in fake_lean_{$fake_lean_left_prompt_items}
|
for item in fake_tide_{$fake_tide_left_prompt_items}
|
||||||
set -l itemOutput (_$item)
|
set -l itemOutput (_$item)
|
||||||
printf '%b' "$itemOutput"
|
printf '%b' "$itemOutput"
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
function fake_lean_right_prompt
|
function fake_tide_right_prompt
|
||||||
set -l splitText (string split '\n' (_fetch_right_prompt_items))
|
set -l splitText (string split '\n' (_fetch_right_prompt_items))
|
||||||
set -l printAtEndedRightPromptHeight (count $splitText)
|
set -l printAtEndedRightPromptHeight (count $splitText)
|
||||||
|
|
||||||
@ -12,7 +12,7 @@ end
|
|||||||
function _fetch_right_prompt_items
|
function _fetch_right_prompt_items
|
||||||
printf '%s' ' '
|
printf '%s' ' '
|
||||||
|
|
||||||
for item in fake_lean_{$fake_lean_right_prompt_items}
|
for item in fake_tide_{$fake_tide_right_prompt_items}
|
||||||
set -l itemOutput (_$item)
|
set -l itemOutput (_$item)
|
||||||
printf '%s' "$itemOutput"
|
printf '%s' "$itemOutput"
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ function _fetch_right_prompt_items
|
|||||||
end
|
end
|
||||||
|
|
||||||
function _print_at_end -a text
|
function _print_at_end -a text
|
||||||
set -l startLocation (math $fake_columns -(string length (lean_decolor $text)))
|
set -l startLocation (math $fake_columns -(string length (tide_decolor $text)))
|
||||||
_cursor_right $startLocation
|
_cursor_right $startLocation
|
||||||
printf '%s' $text
|
printf '%s' $text
|
||||||
|
|
15
tide_theme/configure/functions/fake_prompt.fish
Normal file
15
tide_theme/configure/functions/fake_prompt.fish
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
function fake_prompt
|
||||||
|
if test "$fake_tide_newline" = 'true'
|
||||||
|
printf '\n'
|
||||||
|
end
|
||||||
|
|
||||||
|
set_color $fake_tide_prompt_connection_color
|
||||||
|
printf "%.s$fake_tide_prompt_connection_icon" (seq $fake_columns)
|
||||||
|
set_color $fish_color_normal
|
||||||
|
|
||||||
|
printf '\r'
|
||||||
|
fake_tide_right_prompt
|
||||||
|
|
||||||
|
printf '\r'
|
||||||
|
fake_tide_left_prompt
|
||||||
|
end
|
@ -0,0 +1,4 @@
|
|||||||
|
function _fake_tide_cmd_duration
|
||||||
|
set_color $tide_cmd_duration_color
|
||||||
|
printf '%s ' '5s'
|
||||||
|
end
|
@ -0,0 +1,4 @@
|
|||||||
|
function _fake_tide_git_prompt
|
||||||
|
set_color $tide_color_green
|
||||||
|
printf '%s ' 'master'
|
||||||
|
end
|
@ -0,0 +1,3 @@
|
|||||||
|
function _fake_tide_newline
|
||||||
|
printf '%s' '\n'
|
||||||
|
end
|
@ -0,0 +1,4 @@
|
|||||||
|
function _fake_tide_prompt_char
|
||||||
|
set_color $tide_color_green
|
||||||
|
printf '%s ' '❯'
|
||||||
|
end
|
14
tide_theme/configure/prompt_items/_fake_lean_pwd.fish
Normal file
14
tide_theme/configure/prompt_items/_fake_lean_pwd.fish
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
function _fake_tide_pwd
|
||||||
|
set_color -o $tide_color_light_blue
|
||||||
|
printf '%s' '~'
|
||||||
|
set_color normal
|
||||||
|
|
||||||
|
set_color $tide_color_dark_blue
|
||||||
|
printf '%s' '/'
|
||||||
|
set_color normal
|
||||||
|
|
||||||
|
set_color -o $tide_color_light_blue
|
||||||
|
printf '%s' 'src'
|
||||||
|
|
||||||
|
printf '%s' ' '
|
||||||
|
end
|
4
tide_theme/configure/prompt_items/_fake_lean_time.fish
Normal file
4
tide_theme/configure/prompt_items/_fake_lean_time.fish
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
function _fake_tide_time
|
||||||
|
set_color $fake_tide_time_color
|
||||||
|
printf '%s ' (date +$fake_tide_time_format)
|
||||||
|
end
|
@ -1,4 +1,4 @@
|
|||||||
function lean_configure
|
function tide_configure
|
||||||
if test $COLUMNS -lt 55 || test $LINES -lt 21
|
if test $COLUMNS -lt 55 || test $LINES -lt 21
|
||||||
echo 'Terminal size too small; must be at least 55 x 21'
|
echo 'Terminal size too small; must be at least 55 x 21'
|
||||||
return 1
|
return 1
|
||||||
@ -10,10 +10,10 @@ function lean_configure
|
|||||||
end
|
end
|
||||||
set -g fake_lines $LINES
|
set -g fake_lines $LINES
|
||||||
|
|
||||||
for fn in $lean_dir/configure/functions/*
|
for fn in $tide_dir/configure/functions/*
|
||||||
source "$fn"
|
source "$fn"
|
||||||
end
|
end
|
||||||
for promptItem in $lean_dir/configure/prompt_items/*
|
for promptItem in $tide_dir/configure/prompt_items/*
|
||||||
source "$promptItem"
|
source "$promptItem"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -27,22 +27,22 @@ end
|
|||||||
|
|
||||||
function _set_defaults
|
function _set_defaults
|
||||||
if test $fake_lines -ge 26
|
if test $fake_lines -ge 26
|
||||||
set -g fake_lean_newline true
|
set -g fake_tide_newline true
|
||||||
else
|
else
|
||||||
set -g fake_lean_newline false
|
set -g fake_tide_newline false
|
||||||
end
|
end
|
||||||
|
|
||||||
set -g fake_lean_left_prompt_items 'pwd' 'git_prompt' 'newline' 'prompt_char'
|
set -g fake_tide_left_prompt_items 'pwd' 'git_prompt' 'newline' 'prompt_char'
|
||||||
set -g fake_lean_right_prompt_items 'cmd_duration' 'time'
|
set -g fake_tide_right_prompt_items 'cmd_duration' 'time'
|
||||||
|
|
||||||
set -g fake_lean_time_format ''
|
set -g fake_tide_time_format ''
|
||||||
set -g fake_lean_time_color 5F8787
|
set -g fake_tide_time_color 5F8787
|
||||||
set -g fake_lean_prompt_connection_icon ' '
|
set -g fake_tide_prompt_connection_icon ' '
|
||||||
set -g fake_lean_prompt_connection_color 6C6C6C
|
set -g fake_tide_prompt_connection_color 6C6C6C
|
||||||
end
|
end
|
||||||
|
|
||||||
function _next_choice -a nextChoice
|
function _next_choice -a nextChoice
|
||||||
source "$lean_dir/configure/choices/$nextChoice.fish"
|
source "$tide_dir/configure/choices/$nextChoice.fish"
|
||||||
$nextChoice
|
$nextChoice
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ end
|
|||||||
|
|
||||||
function _quit --on-signal INT
|
function _quit --on-signal INT
|
||||||
source "$__fish_config_dir/functions/fish_prompt.fish"
|
source "$__fish_config_dir/functions/fish_prompt.fish"
|
||||||
source "$__fish_config_dir/functions/lean_left_prompt.fish"
|
source "$__fish_config_dir/functions/tide_left_prompt.fish"
|
||||||
source "$__fish_config_dir/functions/lean_right_prompt.fish"
|
source "$__fish_config_dir/functions/tide_right_prompt.fish"
|
||||||
clear
|
clear
|
||||||
end
|
end
|
@ -1,7 +1,7 @@
|
|||||||
function lean_help -a subcommand
|
function tide_help -a subcommand
|
||||||
set -g b (set_color -o)
|
set -g b (set_color -o)
|
||||||
set -g n (set_color normal)
|
set -g n (set_color normal)
|
||||||
set -g g (set_color $lean_color_green)
|
set -g g (set_color $tide_color_green)
|
||||||
|
|
||||||
set -g subcommandList \
|
set -g subcommandList \
|
||||||
'configure' \
|
'configure' \
|
||||||
@ -9,7 +9,7 @@ function lean_help -a subcommand
|
|||||||
'help'
|
'help'
|
||||||
set -g descriptionList \
|
set -g descriptionList \
|
||||||
'run interactive configuration wizard' \
|
'run interactive configuration wizard' \
|
||||||
'uninstall lean theme' \
|
'uninstall tide theme' \
|
||||||
'print this help message'
|
'print this help message'
|
||||||
|
|
||||||
if contains $subcommand $subcommandList
|
if contains $subcommand $subcommandList
|
||||||
@ -21,7 +21,7 @@ function lean_help -a subcommand
|
|||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
echo 'Usage: '$g'lean '$n$b'subcommand '$n'[options]'
|
echo 'Usage: '$g'tide '$n$b'subcommand '$n'[options]'
|
||||||
echo
|
echo
|
||||||
echo 'Subcommands:'
|
echo 'Subcommands:'
|
||||||
echo
|
echo
|
||||||
@ -33,7 +33,7 @@ function lean_help -a subcommand
|
|||||||
echo
|
echo
|
||||||
echo 'Print help for a specific subcommand:'
|
echo 'Print help for a specific subcommand:'
|
||||||
echo
|
echo
|
||||||
echo ' '$g'lean '$n'help '$b'subcommand'$n
|
echo ' '$g'tide '$n'help '$b'subcommand'$n
|
||||||
|
|
||||||
set -a rmVars b n g subcommandList descriptionList
|
set -a rmVars b n g subcommandList descriptionList
|
||||||
for var in $rmVars
|
for var in $rmVars
|
||||||
@ -51,7 +51,7 @@ function _generic_help_sub -a subcommand
|
|||||||
set -l descriptionFirstLetter (string sub -l 1 $description)
|
set -l descriptionFirstLetter (string sub -l 1 $description)
|
||||||
set -l upperDescriptionFirstLetter (string upper $descriptionFirstLetter)
|
set -l upperDescriptionFirstLetter (string upper $descriptionFirstLetter)
|
||||||
|
|
||||||
echo 'Usage: '$g'lean '$n$b$subcommand$n
|
echo 'Usage: '$g'tide '$n$b$subcommand$n
|
||||||
echo
|
echo
|
||||||
string replace $descriptionFirstLetter $upperDescriptionFirstLetter $description
|
string replace $descriptionFirstLetter $upperDescriptionFirstLetter $description
|
||||||
end
|
end
|
@ -1,70 +1,70 @@
|
|||||||
function lean_uninstall
|
function tide_uninstall
|
||||||
if not _user_confirm_defaultNo 'Uninstall lean theme?'
|
if not _user_confirm_defaultNo 'Uninstall tide theme?'
|
||||||
echo 'Aborted uninstall.'
|
echo 'Aborted uninstall.'
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
echo 'Uninstalling lean theme...'
|
echo 'Uninstalling tide theme...'
|
||||||
|
|
||||||
set -l fishPrompt (functions -D fish_prompt)
|
set -l fishPrompt (functions -D fish_prompt)
|
||||||
|
|
||||||
# ----------------------------------Remove Files----------------------------------
|
# ----------------------------------Remove Files----------------------------------
|
||||||
if test -e $lean_dir
|
if test -e $tide_dir
|
||||||
rm -r $lean_dir
|
rm -r $tide_dir
|
||||||
end
|
end
|
||||||
|
|
||||||
set -l fishPromptFirstLine (head -n 1 $fishPrompt)
|
set -l fishPromptFirstLine (head -n 1 $fishPrompt)
|
||||||
if test "$fishPromptFirstLine" = '# Created by lean configure'
|
if test "$fishPromptFirstLine" = '# Created by tide configure'
|
||||||
rm $fishPrompt
|
rm $fishPrompt
|
||||||
source "$__fish_data_dir/functions/fish_prompt.fish"
|
source "$__fish_data_dir/functions/fish_prompt.fish"
|
||||||
end
|
end
|
||||||
|
|
||||||
set -a leanFunctions 'lean'
|
set -a tideFunctions 'tide'
|
||||||
set -a leanFunctions 'lean_'{'decolor', 'left_prompt', 'right_prompt'}
|
set -a tideFunctions 'tide_'{'decolor', 'left_prompt', 'right_prompt'}
|
||||||
set -a leanFunctions '_lean_'{'cmd_duration', 'context', 'git_prompt', 'jobs', 'newline', 'prompt_char', 'pwd', 'status', 'time'}
|
set -a tideFunctions '_tide_'{'cmd_duration', 'context', 'git_prompt', 'jobs', 'newline', 'prompt_char', 'pwd', 'status', 'time'}
|
||||||
for func in $leanFunctions
|
for func in $tideFunctions
|
||||||
rm "$__fish_config_dir/functions/$func.fish"
|
rm "$__fish_config_dir/functions/$func.fish"
|
||||||
end
|
end
|
||||||
|
|
||||||
set -a leanConfd 'lean_'{'count_left_prompt_height', 'cursor_movement'}
|
set -a tideConfd 'tide_'{'count_left_prompt_height', 'cursor_movement'}
|
||||||
for file in $leanConfd
|
for file in $tideConfd
|
||||||
rm "$__fish_config_dir/conf.d/$file.fish"
|
rm "$__fish_config_dir/conf.d/$file.fish"
|
||||||
end
|
end
|
||||||
|
|
||||||
# -----------------------------Erase Theme Variables------------------------------
|
# -----------------------------Erase Theme Variables------------------------------
|
||||||
set -l rmVars \
|
set -l rmVars \
|
||||||
# ---------------General Theme Variables---------------
|
# ---------------General Theme Variables---------------
|
||||||
'lean'{'dir', 'newline'} \
|
'tide'{'dir', 'newline'} \
|
||||||
# --------------Colors--------------
|
# --------------Colors--------------
|
||||||
'lean_color_'{'green', 'light_blue', 'dark_blue', 'gold', 'lilac'} \
|
'tide_color_'{'green', 'light_blue', 'dark_blue', 'gold', 'lilac'} \
|
||||||
# ---------Prompt Connection---------
|
# ---------Prompt Connection---------
|
||||||
'lean_prompt_connection_'{'icon', 'color'} \
|
'tide_prompt_connection_'{'icon', 'color'} \
|
||||||
# --------------------Prompt Items--------------------
|
# --------------------Prompt Items--------------------
|
||||||
'lean_'{'right_prompt_items', 'left_prompt_items', 'left_prompt_height'} \
|
'tide_'{'right_prompt_items', 'left_prompt_items', 'left_prompt_height'} \
|
||||||
# ----------------Pwd----------------
|
# ----------------Pwd----------------
|
||||||
'lean_pwd_'{'shorten_margin', 'unwritable_icon'} \
|
'tide_pwd_'{'shorten_margin', 'unwritable_icon'} \
|
||||||
# ------------Git prompt------------
|
# ------------Git prompt------------
|
||||||
'__fish_git_prompt_'{'show_informative_status', 'showstashstate'} \
|
'__fish_git_prompt_'{'show_informative_status', 'showstashstate'} \
|
||||||
# -------Symbols-------
|
# -------Symbols-------
|
||||||
'__fish_git_prompt_char_'{'stateseparator', 'cleanstate', 'upstream_ahead', 'upstream_behind'} \
|
'__fish_git_prompt_char_'{'stateseparator', 'ctidestate', 'upstream_ahead', 'upstream_behind'} \
|
||||||
'__fish_git_prompt_char_'{'stagedstate', 'dirtystate', 'untrackedfiles', 'stashstate'} \
|
'__fish_git_prompt_char_'{'stagedstate', 'dirtystate', 'untrackedfiles', 'stashstate'} \
|
||||||
# --------Colors--------
|
# --------Colors--------
|
||||||
'__fish_git_prompt_color_'{'branch', 'upstream', 'stagedstate', 'dirtystate', 'untrackedfiles', 'stashstate'} \
|
'__fish_git_prompt_color_'{'branch', 'upstream', 'stagedstate', 'dirtystate', 'untrackedfiles', 'stashstate'} \
|
||||||
# --------------Status--------------
|
# --------------Status--------------
|
||||||
'lean_status_'{'success_icon', 'success_color', 'failure_icon', 'failure_color'} \
|
'tide_status_'{'success_icon', 'success_color', 'failure_icon', 'failure_color'} \
|
||||||
# ------------Cmd_Duration-----------
|
# ------------Cmd_Duration-----------
|
||||||
'lean_cmd_duration_'{'color', 'decimals', 'threshold'} \
|
'tide_cmd_duration_'{'color', 'decimals', 'threshold'} \
|
||||||
# ----------------SSH----------------
|
# ----------------SSH----------------
|
||||||
'lean_context_'{'ssh_color', 'root_color'} \
|
'tide_context_'{'ssh_color', 'root_color'} \
|
||||||
# ---------------Jobs---------------
|
# ---------------Jobs---------------
|
||||||
'lean_jobs_'{'icon', 'color'} \
|
'tide_jobs_'{'icon', 'color'} \
|
||||||
# ---------------Time---------------
|
# ---------------Time---------------
|
||||||
'lean_time_'{'format', 'color'}
|
'tide_time_'{'format', 'color'}
|
||||||
|
|
||||||
for var in $rmVars
|
for var in $rmVars
|
||||||
set -e $var
|
set -e $var
|
||||||
end
|
end
|
||||||
|
|
||||||
echo 'Lean theme uninstalled.'
|
echo 'Tide theme uninstalled.'
|
||||||
end
|
end
|
||||||
|
|
||||||
function _user_confirm_defaultNo -a question
|
function _user_confirm_defaultNo -a question
|
Loading…
Reference in New Issue
Block a user