Skip to content

Instantly share code, notes, and snippets.

@firstclown
Created December 5, 2013 00:53
Show Gist options
  • Save firstclown/7798380 to your computer and use it in GitHub Desktop.
Save firstclown/7798380 to your computer and use it in GitHub Desktop.
My current fish prompt. Shows the current directory, who's logged in, current host (last two helpful for SSH sessions) and then a git status prompt displaying current branch and the branches status. Finally the actual prompt is on the next line, to keep lots of space for commands.
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 user (whoami)
set -g host (hostname)
function fish_prompt --description 'Write out the prompt'
set -l last_status $status
if not set -q __fish_prompt_normal
set -g __fish_prompt_normal (set_color normal)
end
# PWD
set_color $fish_color_cwd
printf "[%s] " (prompt_pwd)
set_color normal
printf "$user@$host %s " (__fish_git_prompt)
if not test $last_status -eq 0
set_color $fish_color_error
end
echo -n -e '\n$ '
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment