Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
O
oh-my-fish
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
oh-my-fish
Commits
4711a1d4
Commit
4711a1d4
authored
May 09, 2015
by
Jorge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add commits ahead indicator to scorphish
parent
e9aab2e4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
3 deletions
+16
-3
themes/scorphish/fish_prompt.fish
themes/scorphish/fish_prompt.fish
+16
-3
No files found.
themes/scorphish/fish_prompt.fish
View file @
4711a1d4
...
...
@@ -28,9 +28,21 @@ function _is_git_dirty
echo (command git status -s --ignore-submodules=dirty ^/dev/null)
end
function _git_dirty_remotes
function _git_ahead_count -a branch_name
echo (command git log origin/$branch_name..HEAD ^/dev/null | \
grep '^commit' | wc -l | tr -d ' ')
end
function _git_dirty_remotes -a ahead_color
set current_branch (git rev-parse --abbrev-ref HEAD)
set current_ref (git rev-parse HEAD)
set -l git_ahead_count (_git_ahead_count $current_branch)
if [ $git_ahead_count != 0 ]
set ahead_count "$ahead_color+$git_ahead_count$normal"
end
for remote in (git remote)
# if test $remote != 'origin'
set remote_ref_branch "refs/remotes/$remote/$current_branch"
...
...
@@ -38,13 +50,13 @@ function _git_dirty_remotes
if test "$remote_ref" != ''
if test "$remote_ref" != $current_ref
echo !
echo "$ahead_count"
end
end
# end
end
end
function fish_prompt
set_color -o 666
printf '['
...
...
@@ -69,6 +81,7 @@ function fish_prompt
set -l red (set_color red)
set -l normal (set_color normal)
set -l yellow (set_color ffcc00)
set -l orange (set_color ffb300)
set -l green (set_color 80ff00)
set -l pink (set_color ff99ff)
set -l dark_pink (set_color cc99ff)
...
...
@@ -77,7 +90,7 @@ function fish_prompt
if [ (_git_branch_name) ]
set -l git_branch (_git_branch_name)
set dirty_remotes (_git_dirty_remotes)
set dirty_remotes (_git_dirty_remotes
$orange
)
if [ (_is_git_dirty) ]
echo -n -s $gray '‹' $yellow $git_branch $red '*' $dirty_remotes $gray '›' $normal
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment