Created
March 17, 2025 16:36
-
-
Save MatheusMuriel/e4e9ee6c766337d873dae5caf1233516 to your computer and use it in GitHub Desktop.
fsh prompt
This file contains hidden or 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
function fish_prompt --description 'Write out the prompt' | |
set -l last_status $status | |
set -l normal (set_color normal) | |
set -l status_color (set_color brgreen) | |
set -l cwd_color (set_color $fish_color_cwd) | |
set -l vcs_color (set_color brpurple) | |
set -l prompt_status "" | |
# Since we display the prompt on a new line allow the directory names to be longer. | |
set -q fish_prompt_pwd_dir_length | |
or set -lx fish_prompt_pwd_dir_length 0 | |
# Color the prompt differently when we're root | |
set -l suffix '❯' | |
if functions -q fish_is_root_user; and fish_is_root_user | |
if set -q fish_color_cwd_root | |
set cwd_color (set_color $fish_color_cwd_root) | |
end | |
set suffix '#' | |
end | |
# Color the prompt in red on error | |
if test $last_status -ne 0 | |
set status_color (set_color $fish_color_error) | |
set prompt_status $status_color "[" $last_status "]" $normal | |
end | |
echo -s (prompt_login) ' ' $cwd_color (prompt_pwd) $vcs_color (fish_vcs_prompt) $normal ' ' $prompt_status | |
echo -n -s $status_color $suffix ' ' $normal | |
# Definição do virtualenv do virtualfish | |
if set -q VIRTUAL_ENV | |
echo -n -s (set_color -b blue white) "(" (basename "$VIRTUAL_ENV") ")" (set_color normal) " " | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment