mirror of
https://github.com/IlanCosman/tide.git
synced 2024-11-22 23:03:26 +03:00
Working!
This commit is contained in:
parent
598bace385
commit
97b8c703eb
@ -21,11 +21,11 @@ end
|
|||||||
if contains newline $_tide_left_items # two line prompt initialization
|
if contains newline $_tide_left_items # two line prompt initialization
|
||||||
set -l dirname (status dirname)
|
set -l dirname (status dirname)
|
||||||
|
|
||||||
set -l left_prompt_items "$(cat $dirname/tide/items/_tide_item_{$tide_left_prompt_items}.fish)"
|
set -l leftPromptItemCode "$(cat $dirname/tide/items/_tide_item_{$_tide_left_items}.fish)"
|
||||||
set -l right_prompt_items "$(cat $dirname/tide/items/_tide_item_{$tide_right_prompt_items}.fish)"
|
set -l rightPromptItemCode "$(cat $dirname/tide/items/_tide_item_{$_tide_right_items}.fish)"
|
||||||
cat $dirname/tide/functions/_tide_2_line_prompt.fish |
|
cat $dirname/tide/functions/_tide_2_line_prompt.fish |
|
||||||
string replace "# @ left side goes here @" $left_prompt_items |
|
string replace "# @ left side goes here @" $leftPromptItemCode |
|
||||||
string replace "# @ right side goes here @" $right_prompt_items >$dirname/tide/prompt.fish
|
string replace "# @ right side goes here @" $rightPromptItemCode >$dirname/tide/prompt.fish
|
||||||
|
|
||||||
test "$tide_prompt_add_newline_before" = true && set -l add_newline '\n'
|
test "$tide_prompt_add_newline_before" = true && set -l add_newline '\n'
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@ if git branch --show-current 2>/dev/null | string replace -r "(.{$tide_git_trunc
|
|||||||
git rev-parse --git-dir | read -f git_dir
|
git rev-parse --git-dir | read -f git_dir
|
||||||
set location $_tide_location_color$location
|
set location $_tide_location_color$location
|
||||||
else if test $pipestatus[1] != 0
|
else if test $pipestatus[1] != 0
|
||||||
return
|
|
||||||
else if git tag --points-at HEAD | string replace -r "(.{$tide_git_truncation_length}).+" '$1…' | read location
|
else if git tag --points-at HEAD | string replace -r "(.{$tide_git_truncation_length}).+" '$1…' | read location
|
||||||
git rev-parse --git-dir | read -f git_dir
|
git rev-parse --git-dir | read -f git_dir
|
||||||
set location '#'$_tide_location_color$location
|
set location '#'$_tide_location_color$location
|
||||||
@ -11,12 +10,13 @@ else
|
|||||||
set location @$_tide_location_color$location
|
set location @$_tide_location_color$location
|
||||||
end
|
end
|
||||||
|
|
||||||
# Operation
|
if test -n "$location"
|
||||||
if test -d $git_dir/rebase-merge
|
# Operation
|
||||||
|
if test -d $git_dir/rebase-merge
|
||||||
read -f step <$git_dir/rebase-merge/msgnum
|
read -f step <$git_dir/rebase-merge/msgnum
|
||||||
read -f total_steps <$git_dir/rebase-merge/end
|
read -f total_steps <$git_dir/rebase-merge/end
|
||||||
test -f $git_dir/rebase-merge/interactive && set -f operation rebase-i || set -f operation rebase-m
|
test -f $git_dir/rebase-merge/interactive && set -f operation rebase-i || set -f operation rebase-m
|
||||||
else if test -d $git_dir/rebase-apply
|
else if test -d $git_dir/rebase-apply
|
||||||
read -f step <$git_dir/rebase-apply/next
|
read -f step <$git_dir/rebase-apply/next
|
||||||
read -f total_steps <$git_dir/rebase-apply/last
|
read -f total_steps <$git_dir/rebase-apply/last
|
||||||
if test -f $git_dir/rebase-apply/rebasing
|
if test -f $git_dir/rebase-apply/rebasing
|
||||||
@ -26,19 +26,19 @@ else if test -d $git_dir/rebase-apply
|
|||||||
else
|
else
|
||||||
set -f operation am/rebase
|
set -f operation am/rebase
|
||||||
end
|
end
|
||||||
else if test -f $git_dir/MERGE_HEAD
|
else if test -f $git_dir/MERGE_HEAD
|
||||||
set -f operation merge
|
set -f operation merge
|
||||||
else if test -f $git_dir/CHERRY_PICK_HEAD
|
else if test -f $git_dir/CHERRY_PICK_HEAD
|
||||||
set -f operation cherry-pick
|
set -f operation cherry-pick
|
||||||
else if test -f $git_dir/REVERT_HEAD
|
else if test -f $git_dir/REVERT_HEAD
|
||||||
set -f operation revert
|
set -f operation revert
|
||||||
else if test -f $git_dir/BISECT_LOG
|
else if test -f $git_dir/BISECT_LOG
|
||||||
set -f operation bisect
|
set -f operation bisect
|
||||||
end
|
end
|
||||||
|
|
||||||
# Git status/stash + Upstream behind/ahead
|
# Git status/stash + Upstream behind/ahead
|
||||||
# Suppress errors in case we are in a bare repo or there is no upstream
|
# Suppress errors in case we are in a bare repo or there is no upstream
|
||||||
git_info=(git -C $git_dir/.. --no-optional-locks status --porcelain 2>/dev/null) \
|
git_info=(git -C $git_dir/.. --no-optional-locks status --porcelain 2>/dev/null) \
|
||||||
string match -qr '(0|(?<stash>.*))\n(0|(?<conflicted>.*))\n(0|(?<staged>.*))
|
string match -qr '(0|(?<stash>.*))\n(0|(?<conflicted>.*))\n(0|(?<staged>.*))
|
||||||
(0|(?<dirty>.*))\n(0|(?<untracked>.*))(\n(0|(?<behind>.*))\t(0|(?<ahead>.*)))?' \
|
(0|(?<dirty>.*))\n(0|(?<untracked>.*))(\n(0|(?<behind>.*))\t(0|(?<ahead>.*)))?' \
|
||||||
"$(git -C $git_dir/.. stash list 2>/dev/null | count
|
"$(git -C $git_dir/.. stash list 2>/dev/null | count
|
||||||
@ -48,13 +48,13 @@ git_info=(git -C $git_dir/.. --no-optional-locks status --porcelain 2>/dev/null)
|
|||||||
string match -r '^\?\?' $git_info | count
|
string match -r '^\?\?' $git_info | count
|
||||||
git rev-list --count --left-right @{upstream}...HEAD 2>/dev/null)"
|
git rev-list --count --left-right @{upstream}...HEAD 2>/dev/null)"
|
||||||
|
|
||||||
if test -n "$operation$conflicted"
|
if test -n "$operation$conflicted"
|
||||||
set -g tide_git_bg_color $tide_git_bg_color_urgent
|
set -g tide_git_bg_color $tide_git_bg_color_urgent
|
||||||
else if test -n "$staged$dirty$untracked"
|
else if test -n "$staged$dirty$untracked"
|
||||||
set -g tide_git_bg_color $tide_git_bg_color_unstable
|
set -g tide_git_bg_color $tide_git_bg_color_unstable
|
||||||
end
|
end
|
||||||
|
|
||||||
_tide_print_item git $_tide_location_color$tide_git_icon' ' (set_color white; echo -ns $location
|
_tide_print_item git $_tide_location_color$tide_git_icon' ' (set_color white; echo -ns $location
|
||||||
set_color $tide_git_color_operation; echo -ns ' '$operation ' '$step/$total_steps
|
set_color $tide_git_color_operation; echo -ns ' '$operation ' '$step/$total_steps
|
||||||
set_color $tide_git_color_upstream; echo -ns ' ⇣'$behind ' ⇡'$ahead
|
set_color $tide_git_color_upstream; echo -ns ' ⇣'$behind ' ⇡'$ahead
|
||||||
set_color $tide_git_color_stash; echo -ns ' *'$stash
|
set_color $tide_git_color_stash; echo -ns ' *'$stash
|
||||||
@ -62,3 +62,4 @@ _tide_print_item git $_tide_location_color$tide_git_icon' ' (set_color white; ec
|
|||||||
set_color $tide_git_color_staged; echo -ns ' +'$staged
|
set_color $tide_git_color_staged; echo -ns ' +'$staged
|
||||||
set_color $tide_git_color_dirty; echo -ns ' !'$dirty
|
set_color $tide_git_color_dirty; echo -ns ' !'$dirty
|
||||||
set_color $tide_git_color_untracked; echo -ns ' ?'$untracked)
|
set_color $tide_git_color_untracked; echo -ns ' ?'$untracked)
|
||||||
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user