fish-theme-nelsonjchen/fish_prompt.fish

35 lines
1.4 KiB
Fish
Raw Normal View History

function fish_prompt
2015-09-27 11:51:48 +02:00
set user (set_color --bold cyan)(whoami)(set_color normal)
set machine (set_color --bold blue)(hostname| cut -d . -f 1)(set_color normal)
set -l realhome ~
set directory (set_color --bold green)(echo $PWD | sed -e "s|^$realhome|~|")(set_color normal)
set -g __fish_git_prompt_show_informative_status 'yes'
set -g __fish_git_prompt_showcolorhints 'yes'
set color_bold_red (set_color --bold red)
set color_bold_yellow (set_color --bold yellow)
set color_bold_cyan (set_color --bold cyan)
set color_reset (set_color normal)
set -g __fish_git_prompt_char_dirtystate "$color_bold_red±$color_reset"
set -g __fish_git_prompt_char_cleanstate "$color_bold_red$color_reset"
set -g __fish_git_prompt_char_stagedstate "$color_bold_yellow$color_reset"
set -g __fish_git_prompt_char_stagedstate "$color_bold_cyan$color_reset"
set -g __fish_git_prompt_char_stateseparator ' '
# I have *no* idea why this works. Maybe set_color just ignores the second bold?
set -g __fish_git_prompt_color_branch "--bold" "--bold" "yellow"
set color_bold_magenta (set_color --bold magenta)
set git (__fish_git_prompt "$color_bold_magenta^$color_reset%s")
echo -s $user (set_color yellow)'@' $machine ':' $directory $git
2015-01-06 11:04:31 +01:00
if [ $USER = "root" ]
2015-09-27 11:51:48 +02:00
set caret (set_color red ) "#"
2015-01-06 11:04:31 +01:00
else
2015-09-27 11:51:48 +02:00
set caret (set_color magenta) "\$"
2015-01-06 11:04:31 +01:00
end
2015-09-27 11:51:48 +02:00
echo -s $caret ' '(set_color normal)
2015-01-06 11:04:31 +01:00
end