123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- # set variable identifying the chroot you work in (used in the prompt below)
- if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
- debian_chroot=$(cat /etc/debian_chroot)
- fi
-
- # set a fancy prompt (non-color, unless we know we "want" color)
- case "$TERM" in
- xterm-color|*-256color) color_prompt=yes;;
- esac
-
- # uncomment for a colored prompt, if the terminal has the capability; turned
- # off by default to not distract the user: the focus in a terminal window
- # should be on the output of commands, not on the prompt
- force_color_prompt=yes
-
- if [ -n "$force_color_prompt" ]; then
- if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
- # We have color support; assume it's compliant with Ecma-48
- # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
- # a case would tend to support setf rather than setaf.)
- color_prompt=yes
- else
- color_prompt=
- fi
- fi
-
- configure_prompt() {
- prompt_symbol='%F{cyan}@%B%F{%(#.red.blue)}'
- # Skull emoji for root terminal
- [ "$EUID" -eq 0 ] && prompt_symbol='%F{white}☠%B%F{%(#.red.blue)}'
- case "$PROMPT_ALTERNATIVE" in
- twoline)
- export GIT_PROMPT_DETAILS="off"
- PROMPT=$'%F{%(#.blue.green)}┌──${debian_chroot:+($debian_chroot)─}${VIRTUAL_ENV:+($(basename $VIRTUAL_ENV))─}(%B%F{%(#.red.blue)}%n'$prompt_symbol$'%m%b%F{%(#.blue.green)})-[%B%F{reset}%(6~.%-1~/…/%4~.%5~)%b%F{%(#.blue.green)}]\n`giti -p`%F{%(#.blue.green)}└─%F{red}%(?.. %? %B⚡%b)%F{yellow}%(1j. %j %B⚙ %b%F{reset}.)%B%(#.%F{red}#.%F{blue}$)%b%F{reset} '
- # Right-side prompt with exit codes and background processes
- #RPROMPT=$'%(?.. %? %F{red}%B⚡%b%F{reset})%(1j. %j %F{yellow}%B⚙%b%F{reset}.)'
- # Add mechanism to switch git details for prompt
- gitp() {
- [[ "$GIT_PROMPT_DETAILS" == "on" ]] && export GIT_PROMPT_DETAILS="off" || export GIT_PROMPT_DETAILS="on"
- }
- ;;
- oneline)
- PROMPT=$'${debian_chroot:+($debian_chroot)}${VIRTUAL_ENV:+($(basename $VIRTUAL_ENV))}%B%F{%(#.red.blue)}%n@%m%b%F{reset}:%B%F{%(#.blue.green)}%~%b%F{reset}%(#.#.$) '
- RPROMPT=
- ;;
- backtrack)
- PROMPT=$'${debian_chroot:+($debian_chroot)}${VIRTUAL_ENV:+($(basename $VIRTUAL_ENV))}%B%F{red}%n@%m%b%F{reset}:%B%F{blue}%~%b%F{reset}%(#.#.$) '
- RPROMPT=
- ;;
- esac
- unset prompt_symbol
- }
-
- # The following block is surrounded by two delimiters.
- # These delimiters must not be modified. Thanks.
- # START KALI CONFIG VARIABLES
- PROMPT_ALTERNATIVE=twoline
- NEWLINE_BEFORE_PROMPT=yes
- # STOP KALI CONFIG VARIABLES
-
- if [ "$color_prompt" = yes ]; then
- # override default virtualenv indicator in prompt
- VIRTUAL_ENV_DISABLE_PROMPT=1
-
- configure_prompt
- else
- PROMPT='${debian_chroot:+($debian_chroot)}%n@%m:%~%(#.#.$) '
- fi
- unset color_prompt force_color_prompt
-
- toggle_oneline_prompt(){
- if [ "$PROMPT_ALTERNATIVE" = oneline ]; then
- PROMPT_ALTERNATIVE=twoline
- else
- PROMPT_ALTERNATIVE=oneline
- fi
- configure_prompt
- zle reset-prompt
- }
- zle -N toggle_oneline_prompt
- bindkey ^P toggle_oneline_prompt
-
- # If this is an xterm set the title to user@host:dir
- case "$TERM" in
- xterm*|rxvt*|Eterm|aterm|kterm|gnome*|alacritty)
- TERM_TITLE=$'\e]0;${debian_chroot:+($debian_chroot)}${VIRTUAL_ENV:+($(basename $VIRTUAL_ENV))}%n@%m: %~\a'
- ;;
- *)
- ;;
- esac
-
- precmd() {
- # Print the previously configured title
- print -Pnr -- "$TERM_TITLE"
-
- # Print a new line before the prompt, but only if it is not the first line
- if [ "$NEWLINE_BEFORE_PROMPT" = yes ]; then
- if [ -z "$_NEW_LINE_BEFORE_PROMPT" ]; then
- _NEW_LINE_BEFORE_PROMPT=1
- else
- print ""
- fi
- fi
- }
|