Imrpove local_install

This commit is contained in:
Ilan Cosman 2020-05-17 10:01:17 -07:00
parent 913409b4dc
commit 8d37ae4522
4 changed files with 30 additions and 16 deletions

View File

@ -0,0 +1,9 @@
function lean_count_left_prompt_height --on-variable lean_left_prompt_items
set -U lean_left_prompt_height 1
for item in $lean_left_prompt_items
if test $item = 'newline'
set -U lean_left_prompt_height (math $lean_left_prompt_height+1)
end
end
end

View File

@ -1,13 +1,16 @@
function local_install -a localRepo function local_install -a localRepo
source "$localRepo/install.fish"; and _set_lean_defaults 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/lean_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
_source_lean_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
fisher add jorgebucaran/fishtape fisher add jorgebucaran/fishtape
end end
end

View File

@ -1,15 +1,10 @@
function lean_left_prompt function lean_left_prompt
set -U lean_left_prompt_height 1
for item in lean_{$lean_left_prompt_items} for item in lean_{$lean_left_prompt_items}
set -l itemOutput (_$item) set -l itemOutput (_$item)
if test -n "$itemOutput" if test -n "$itemOutput"
printf $itemOutput printf $itemOutput
end end
if test $item = 'lean_newline'
set -U lean_left_prompt_height (math $lean_left_prompt_height+1)
end
set_color normal set_color normal
end end

View File

@ -27,8 +27,7 @@ function lean_install
_set_lean_defaults _set_lean_defaults
# -----------------------Finish----------------------- # -----------------------Finish-----------------------
source "$__fish_config_dir/conf.d/lean_cursor_movement.fish" _source_lean_functions
source "$__fish_config_dir/functions/fish_prompt.fish"
set_color $lean_color_green set_color $lean_color_green
echo 'Lean theme installed!' echo 'Lean theme installed!'
@ -100,6 +99,14 @@ function _set_lean_defaults
set -U lean_time_color 5F8787 set -U lean_time_color 5F8787
end end
function _source_lean_functions
source "$__fish_config_dir/conf.d/lean_count_left_prompt_height.fish"
source "$__fish_config_dir/conf.d/lean_cursor_movement.fish"
source "$__fish_config_dir/functions/fish_prompt.fish"
lean_count_left_prompt_height
end
function _user_confirm_defaultYes -a question function _user_confirm_defaultYes -a question
while true while true
read -P "$question [Y/n] " input read -P "$question [Y/n] " input