Last active
July 31, 2023 13:58
-
-
Save joshuacrass/c50009c44867ff739359af343ea94a1b to your computer and use it in GitHub Desktop.
Customized fish prompt for a better Git experience
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Display informative Git status in the prompt (e.g., branch name, dirty state, etc.). | |
set -g __fish_git_prompt_show_informative_status true | |
# Show color hints in the Git prompt for different Git states (e.g., dirty, staged, conflicted). | |
set -g __fish_git_prompt_showcolorhints true | |
# Show verbose information about the upstream status in the Git prompt. | |
set -g __fish_git_prompt_showupstream verbose | |
# Colors for various Git states. | |
# Change color codes as desired. | |
# Valid colors are: (https://fishshell.com/docs/current/cmds/set_color.html) | |
# You can use `set_color -c` to see a list of all valid colors. | |
# Regular: [black, red, green, yellow, blue, magenta, cyan, white] | |
# Bright Colors, [brred, brgreen, bryellow, brblue, brmagenta, brcyan, brwhite] | |
set -g __fish_git_prompt_color_branch brmagenta -i # -i Sets italics mode. | |
set -g __fish_git_prompt_color_dirtystate white | |
set -g __fish_git_prompt_color_invalidstate brred | |
set -g __fish_git_prompt_color_merging yellow | |
set -g __fish_git_prompt_color_stagedstate yellow | |
set -g __fish_git_prompt_color_upstream_ahead green | |
set -g __fish_git_prompt_color_upstream_behind brred | |
# Icons for various local Git states | |
set -g __fish_git_prompt_char_cleanstate ' ๐ ' | |
set -g __fish_git_prompt_char_conflictedstate ' ๐ญ ' | |
set -g __fish_git_prompt_char_dirtystate ' ๐ฉ ' | |
set -g __fish_git_prompt_char_invalidstate ' ๐คฎ ' | |
set -g __fish_git_prompt_char_stagedstate ' ๐ฅ ' | |
set -g __fish_git_prompt_char_stashstate ' ๐ฆ ' | |
set -g __fish_git_prompt_char_stateseparator ' | ' | |
set -g __fish_git_prompt_char_untrackedfiles ' ๐ ' | |
# upstream status if __fish_git_prompt_showupstream is set to verbose | |
set -g __fish_git_prompt_char_upstream_ahead ' ๐ ' | |
set -g __fish_git_prompt_char_upstream_behind ' ๐ ' | |
set -g __fish_git_prompt_char_upstream_diverged ' ๐ง ' | |
set -g __fish_git_prompt_char_upstream_equal ' ๐ฏ ' | |
# This is the function that actually sets the prompt. | |
function fish_prompt | |
# Set the color of the current working directory in the prompt. | |
set_color green | |
# Print the current working directory. | |
printf '%s' (prompt_pwd) | |
# Reset the color to normal for the rest of the prompt. | |
set_color normal | |
# Print the Git prompt using the fish_git_prompt function (provided by Fish). | |
printf '%s ' (fish_git_prompt) | |
# Print a fish icon at the end of the prompt just for fun. | |
# Change to whatever you want, or remove it entirely. | |
# echo -n "--> " | |
echo -n "๐ " | |
# Reset the color to normal for any subsequent output. | |
set_color normal | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment