Skip to content

Instantly share code, notes, and snippets.

@tuxracer
Created March 21, 2017 20:34
Show Gist options
  • Save tuxracer/4e46ed0ec3a0d32df60e5976cdafb81f to your computer and use it in GitHub Desktop.
Save tuxracer/4e46ed0ec3a0d32df60e5976cdafb81f to your computer and use it in GitHub Desktop.
function fish_prompt
set -l last_command_status $status
set -l cwd
if test "$theme_short_path" = 'yes'
set cwd (basename (prompt_pwd))
else
set cwd (prompt_pwd)
end
set -l fish "⋊>"
set -l ahead "↑"
set -l behind "↓"
set -l diverged "⥄ "
set -l dirty "⨯"
set -l none "◦"
set -l normal_color (set_color normal)
set -l success_color (set_color $fish_pager_color_progress ^/dev/null; or set_color cyan)
set -l error_color (set_color $fish_color_error ^/dev/null; or set_color red --bold)
set -l directory_color (set_color $fish_color_quote ^/dev/null; or set_color brown)
set -l repository_color (set_color $fish_color_cwd ^/dev/null; or set_color green)
if test $last_command_status -eq 0
echo -n -s $success_color $fish $normal_color
else
echo -n -s $error_color $fish $normal_color
end
if git_is_repo
if test "$theme_short_path" = 'yes'
set root_folder (command git rev-parse --show-toplevel ^/dev/null)
set parent_root_folder (dirname $root_folder)
set cwd (echo $PWD | sed -e "s|$parent_root_folder/||")
echo -n -s " " $directory_color $cwd $normal_color
else
echo -n -s " " $directory_color $cwd $normal_color
end
echo -n -s " on " $repository_color (git_branch_name) $normal_color " "
if git_is_touched
echo -n -s $dirty
else
echo -n -s (git_ahead $ahead $behind $diverged $none)
end
else
echo -n -s " " $directory_color $cwd $normal_color
end
echo -n -s " "
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment