Skip to content

Instantly share code, notes, and snippets.

@CocoaBeans
Last active October 27, 2022 21:08
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CocoaBeans/4550321 to your computer and use it in GitHub Desktop.
Save CocoaBeans/4550321 to your computer and use it in GitHub Desktop.
Fish shell custom prompt
########################################################################################
### Fish Custom Overrides
### Creates a shell prompt in the form of:
###
### ----------------------------------------------------------------------- 11:56:05
### kevin@kross /S/L/F/C/V/A/F/L/V/A/Support >
########################################################################################
set --global fish_prompt_username_color 555555
set --global fish_prompt_hostname_color 555555
#trap "echo -ne " WINCH
# Override fish_prompt
function fish_prompt -d "Write out the prompt"
set marker (fish_prompt_line_marker)
echo $marker
set prompt (printf '%s%s%s@%s%s%s %s%s > ' (set_color $fish_prompt_username_color) (whoami) (set_color normal) (set_color $fish_prompt_hostname_color) (hostname|cut -d . -f 1) (set_color $fish_color_cwd) (prompt_pwd) (set_color normal))
echo -n $prompt
end
function --on-signal WINCH fish_prompt_line_marker_signal_handler
#set marker (fish_prompt_line_marker)
printf "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"
# echo (fish_prompt_line_marker)
# echo -n ''
;
end
# function --on-event fish_prompt fish_prompt_line_marker_event_handler
# set marker (fish_prompt_line_marker)
# echo (fish_prompt_line_marker)
# end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment