Skip to content

Commit

Permalink
Allow setting username and hostname location in prompt
Browse files Browse the repository at this point in the history
Defaults to the style for the original pure for zsh, as seen in sindresorhus/pure#126
  • Loading branch information
benedictleejh committed Feb 17, 2017
1 parent 2b3fc69 commit ea8140e
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions fish_prompt.fish
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ __pure_set_default pure_username_color $pure_color_gray
__pure_set_default pure_host_color $pure_color_gray
__pure_set_default pure_root_color $pure_color_normal

# Determines whether the username and host are shown at the begining or end
# 0 - end of prompt, default
# 1 - start of prompt
# Any other value defaults to the default behaviour
__pure_set_default pure_user_host_location 0

# Max execution time of a process before its run time is shown when it exits
__pure_set_default pure_command_max_exec_time 5

Expand Down Expand Up @@ -68,8 +74,9 @@ function fish_prompt
set user_and_host "$user$pure_color_gray@$pure_host_color$host$pure_color_normal "
end

# Format user and host on prompt output
set prompt $prompt $user_and_host
if test $pure_user_host_location -eq 1
set prompt $prompt $user_and_host
end

# Format current folder on prompt output
set prompt $prompt "$pure_color_blue$current_folder$pure_color_normal "
Expand Down Expand Up @@ -126,6 +133,10 @@ function fish_prompt
set prompt $prompt "$pure_color_gray$git_branch_name$git_dirty$pure_color_normal\t$pure_color_cyan$git_arrows$pure_color_normal"
end

if test $pure_user_host_location -ne 1
set prompt $prompt $user_and_host
end

set prompt $prompt "\n$color_symbol$pure_symbol_prompt$pure_color_normal "

echo -e -s $prompt
Expand Down

0 comments on commit ea8140e

Please sign in to comment.