Replace module with item

This commit is contained in:
Ilan Cosman 2020-04-27 15:37:08 -07:00
parent 7926ed2a7b
commit 96e836100c
9 changed files with 25 additions and 21 deletions

View File

@ -10,7 +10,7 @@ function fish_prompt --description 'Write out the prompt'
echo -ne "\r"(lean_pwd)(lean_git_prompt)" "
lean_load_right_prompt_modules
lean_load_right_prompt_items
set -l leanRightPromptStartLocation (math $COLUMNS-(string length (_lean_right_prompt_nocolor)))
printf "\r\033["$leanRightPromptStartLocation"C"
echo -e (lean_right_prompt)
@ -28,9 +28,9 @@ end
function _lean_right_prompt_nocolor
echo -n " "
for module in lean_{$lean_right_prompt_modules}
if test -n "$$module"
echo -n "$$module"
for item in lean_{$lean_right_prompt_items}
if test -n "$$item"
echo -n "$$item"
echo -n " "
end
end

View File

@ -1,6 +1,6 @@
function lean_load_right_prompt_modules
for module in lean_{$lean_right_prompt_modules}
set -g $module (eval "_$module")
function lean_load_right_prompt_items
for item in lean_{$lean_right_prompt_items}
set -g $item (eval "_$item")
end
end

View File

@ -1,12 +1,12 @@
function lean_right_prompt
echo -n " "
for module in lean_{$lean_right_prompt_modules}
if test -n "$$module"
set -l colorName "$module"_color
for item in lean_{$lean_right_prompt_items}
if test -n "$$item"
set -l colorName "$item"_color
set_color "$$colorName"
echo -n "$$module"
echo -n "$$item"
echo -n " "
set_color normal
end

View File

@ -10,7 +10,7 @@ function lean_uninstall
rm "$__fish_config_dir/functions/fish_prompt.fish"
end
set -l leanFunctions git_prompt load_right_prompt_modules pwd right_prompt uninstall wizard
set -l leanFunctions git_prompt load_right_prompt_items pwd right_prompt uninstall wizard
for func in $leanFunctions
rm "$__fish_config_dir/functions/lean_$func.fish"
end
@ -30,8 +30,8 @@ function lean_uninstall
# --------Colors--------
set -a rmVars __fish_git_prompt_color_{branch, upstream, stagedstate, dirtystate, untrackedfiles, stashstate}
# ----------------Right Prompt Modules----------------
set -a rmVars lean_right_prompt_modules
# ----------------Right Prompt Items----------------
set -a rmVars lean_right_prompt_items
# --------------Timer--------------
set -a rmVars lean_timer_{color, decimals, duration}
# ---------------SSH---------------

View File

@ -6,7 +6,11 @@ function lean_wizard
set -g fishPrompt "$__fish_config_dir/functions/fish_prompt.fish"
set -g fakePrompt "$__fish_config_dir/lean_theme/fake_prompt.fish"
set -g columns $COLUMNS
if test $columns -gt 100
set -g columns 100
end
set -g lines $LINES
_begin

View File

@ -48,8 +48,8 @@ function lean_install
set -U __fish_git_prompt_color_untrackedfiles $lean_color_light_blue
set -U __fish_git_prompt_color_stashstate $lean_color_green
# ----------------Right Prompt Modules----------------
set -U lean_right_prompt_modules timer ssh
# ----------------Right Prompt Items----------------
set -U lean_right_prompt_items timer ssh
# --------------Timer--------------
set -U lean_timer_color 87875F
set -U lean_timer_decimals 0

View File

@ -4,7 +4,7 @@
echo -ne "\r"(lean_pwd)(lean_git_prompt)" "
lean_load_right_prompt_modules
lean_load_right_prompt_items
set -l leanRightPromptStartLocation (math $COLUMNS-(string length (_lean_right_prompt_nocolor)))
printf "\r\033["$leanRightPromptStartLocation"C"
echo -e (lean_right_prompt)

View File

@ -1,9 +1,9 @@
function _lean_right_prompt_nocolor
echo -n " "
for module in lean_{$lean_right_prompt_modules}
if test -n "$$module"
echo -n "$$module"
for item in lean_{$lean_right_prompt_items}
if test -n "$$item"
echo -n "$$item"
echo -n " "
end
end

View File

@ -1,4 +1,4 @@
function fish_right_prompt
lean_load_right_prompt_modules
lean_load_right_prompt_items
lean_right_prompt
end