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
548008b6
Commit
548008b6
authored
Nov 16, 2014
by
Denis Kolesnikov
Committed by
Justin Hileman
Nov 20, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added simple mercurial pormpt to bobthefish theme
parent
8b0ff070
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
1 deletion
+54
-1
themes/bobthefish/fish_prompt.fish
themes/bobthefish/fish_prompt.fish
+54
-1
No files found.
themes/bobthefish/fish_prompt.fish
View file @
548008b6
...
...
@@ -71,6 +71,10 @@ function __bobthefish_in_git -d 'Check whether pwd is inside a git repo'
command git rev-parse --is-inside-work-tree >/dev/null 2>&1
end
function __bobthefish_in_hg -d 'Check whether pwd is inside a hg repo'
command hg stat > /dev/null 2>&1
end
function __bobthefish_git_branch -d 'Get the current git branch (or commitish)'
set -l ref (command git symbolic-ref HEAD 2> /dev/null)
if [ $status -gt 0 ]
...
...
@@ -80,6 +84,11 @@ function __bobthefish_git_branch -d 'Get the current git branch (or commitish)'
echo $ref | sed "s-refs/heads/-$__bobthefish_branch_glyph -"
end
function __bobthefish_hg_branch -d 'Get the current hg branch'
set -g branch (hg branch ^/dev/null)
echo "$__bobthefish_branch_glyph $branch"
end
function __bobthefish_pretty_parent -d 'Print a parent directory, shortened to fit the prompt'
echo -n (dirname $argv[1]) | sed -e 's|/private||' -e "s|^$HOME|~|" -e 's-/\(\.\{0,1\}[^/]\)\([^/]*\)-/\1-g' -e 's|/$||'
end
...
...
@@ -88,11 +97,21 @@ function __bobthefish_project_dir -d 'Print the current git project base directo
command git rev-parse --show-toplevel 2>/dev/null
end
function __bobthefish_project_dir_hg -d 'Print the current git project base directory'
command hg root 2>/dev/null
end
function __bobthefish_project_pwd -d 'Print the working directory relative to project root'
set -l base_dir (__bobthefish_project_dir)
echo "$PWD" | sed -e "s*$base_dir**g" -e 's*^/**'
end
function __bobthefish_project_pwd_hg -d 'Print the working directory relative to project root'
set -l base_dir (__bobthefish_project_dir_hg)
echo "$PWD" | sed -e "s*$base_dir**g" -e 's*^/**'
end
# ===========================
# Segment functions
...
...
@@ -214,6 +233,38 @@ function __bobthefish_prompt_user -d 'Display actual user if different from $def
end
end
function __bobthefish_prompt_hg -d 'Display the actual hg state'
set -l dirty (command hg stat; or echo -n '*')
set -l flags "$dirty"
test "$flags"; and set flags ""
set -l flag_bg $__bobthefish_lt_green
set -l flag_fg $__bobthefish_dk_green
if test "$dirty"
set flag_bg $__bobthefish_med_red
set flag_fg fff
end
__bobthefish_path_segment (__bobthefish_project_dir_hg)
__bobthefish_start_segment $flag_bg $flag_fg
set_color $flag_fg --bold
echo -n -s (__bobthefish_hg_branch) $flags ' '
set_color normal
set -l project_pwd (__bobthefish_project_pwd_hg)
if test "$project_pwd"
if test -w "$PWD"
__bobthefish_start_segment 333 999
else
__bobthefish_start_segment $__bobthefish_med_red $__bobthefish_lt_red
end
echo -n -s $project_pwd ' '
end
end
# TODO: clean up the fugly $ahead business
function __bobthefish_prompt_git -d 'Display the actual git state'
set -l dirty (command git diff --no-ext-diff --quiet --exit-code; or echo -n '*')
...
...
@@ -302,7 +353,9 @@ function fish_prompt -d 'bobthefish, a fish theme optimized for awesome'
if __bobthefish_in_virtualfish_virtualenv
__bobthefish_prompt_virtualfish
end
if __bobthefish_in_git
if __bobthefish_in_hg
__bobthefish_prompt_hg
else if __bobthefish_in_git
__bobthefish_prompt_git
else
__bobthefish_prompt_dir
...
...
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