Skip to content

Instantly share code, notes, and snippets.

@tomsmeding
Last active August 29, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomsmeding/558f849996392f2831a0 to your computer and use it in GitHub Desktop.
Save tomsmeding/558f849996392f2831a0 to your computer and use it in GitHub Desktop.
My fish_prompt
set -g __fish_git_prompt_show_informative_status 1
set -g __fish_git_prompt_hide_untrackedfiles 1
set -g __fish_git_prompt_color_branch magenta bold
set -g __fish_git_prompt_showupstream "informative"
set -g __fish_git_prompt_char_upstream_ahead "↑"
set -g __fish_git_prompt_char_upstream_behind "↓"
set -g __fish_git_prompt_char_upstream_prefix ""
set -g __fish_git_prompt_char_stagedstate "●"
set -g __fish_git_prompt_char_dirtystate "✚"
set -g __fish_git_prompt_char_untrackedfiles "…"
set -g __fish_git_prompt_char_conflictedstate "✖"
set -g __fish_git_prompt_char_cleanstate "✔"
set -g __fish_git_prompt_color_dirtystate blue
set -g __fish_git_prompt_color_stagedstate yellow
set -g __fish_git_prompt_color_invalidstate red
set -g __fish_git_prompt_color_untrackedfiles $fish_color_normal
set -g __fish_git_prompt_color_cleanstate green bold
set -g fish_color_error red --bold
function fish_prompt --description 'Write out the prompt'
set -l last_status $status
# Just calculate these once, to save a few cycles when displaying the prompt
if not set -q __fish_prompt_normal
set -g __fish_prompt_normal (set_color normal)
end
switch $USER
case root
if not set -q __fish_prompt_cwd
if set -q fish_color_cwd_root
set -g __fish_prompt_cwd (set_color $fish_color_cwd_root)
else
set -g __fish_prompt_cwd (set_color $fish_color_cwd)
end
end
case '*'
if not set -q __fish_prompt_cwd
set -g __fish_prompt_cwd (set_color $fish_color_cwd)
end
end
set -l error_text ""
if not test $last_status -eq 0
set error_text (set_color $fish_color_error)" err$__fish_prompt_cwd"
end
echo
echo -n -s (set_color 555) (date +%H:%M:%S) ' ' (set_color $fish_color_cwd) (prompt_pwd) "$__fish_prompt_normal" (__fish_git_prompt) "$__fish_prompt_cwd$error_text\$$__fish_prompt_normal "
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment