Skip to content

Instantly share code, notes, and snippets.

@pateketrueke
Created July 9, 2015 18:08
Show Gist options
  • Select an option

  • Save pateketrueke/f422612b9727687b5ac2 to your computer and use it in GitHub Desktop.

Select an option

Save pateketrueke/f422612b9727687b5ac2 to your computer and use it in GitHub Desktop.
function my_prompt_git
__fish_git_prompt | sed -e "s| ||g"
end
function my_prompt_pwd
echo $PWD | sed -e "s|^$HOME|~|" -e "s|.*/||g"
end
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
if not set -q -g __fish_classic_git_functions_defined
set -g __fish_classic_git_functions_defined
function __fish_repaint_status --on-variable fish_color_status
if status --is-interactive
set -e __fish_prompt_status
commandline -f repaint ^/dev/null
end
end
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 prompt_status
if test $last_status -ne 0
if not set -q __fish_prompt_status
set -g __fish_prompt_status (set_color $fish_color_error)
end
set prompt_status "$__fish_prompt_status($last_status)$__fish_prompt_normal"
end
if not set -q __fish_prompt_quote
set -g __fish_prompt_quote (set_color $fish_color_quote)
end
echo -n -s "$prompt_status ♪ "
echo -n -s "$__fish_prompt_cwd" (my_prompt_pwd) "$__fish_prompt_normal "
set -l git_hint (my_prompt_git)
if test $git_hint
echo -n -s "$git_hint "
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment