You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
897 B
Fish
37 lines
897 B
Fish
function fish_prompt
|
|
set -l last_status $status
|
|
set -l cwd (prompt_pwd)
|
|
|
|
if not test $last_status -eq 0
|
|
set_color --bold white -b red
|
|
echo -n ' ! '
|
|
set_color normal
|
|
end
|
|
|
|
# Display the current hostname
|
|
set_color black -b green
|
|
echo -n " $hostname "
|
|
|
|
|
|
# Display current path
|
|
set_color black -b blue
|
|
echo -n " $cwd "
|
|
|
|
# Show git branch and dirty state
|
|
set -l git_branch (command git symbolic-ref HEAD 2> /dev/null | sed -e 's|^refs/heads/||')
|
|
set -l git_dirty (command git status -s --ignore-submodules=dirty 2> /dev/null)
|
|
if test -n "$git_branch"
|
|
if test -n "$git_dirty"
|
|
set_color black -b yellow
|
|
echo -n " $git_branch "
|
|
else
|
|
set_color black -b green
|
|
echo -n " $git_branch "
|
|
end
|
|
end
|
|
|
|
# Add a space
|
|
set_color normal
|
|
echo -n ' '
|
|
end
|