Config File Collection
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

prompt_kali.zsh 6.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. # set variable identifying the chroot you work in (used in the prompt below)
  2. if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
  3. debian_chroot=$(cat /etc/debian_chroot)
  4. fi
  5. # set a fancy prompt (non-color, unless we know we "want" color)
  6. case "$TERM" in
  7. xterm-color|*-256color) color_prompt=yes;;
  8. esac
  9. # uncomment for a colored prompt, if the terminal has the capability; turned
  10. # off by default to not distract the user: the focus in a terminal window
  11. # should be on the output of commands, not on the prompt
  12. force_color_prompt=yes
  13. if [ -n "$force_color_prompt" ]; then
  14. if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
  15. # We have color support; assume it's compliant with Ecma-48
  16. # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
  17. # a case would tend to support setf rather than setaf.)
  18. color_prompt=yes
  19. else
  20. color_prompt=
  21. fi
  22. fi
  23. configure_prompt() {
  24. #prompt_symbol=㉿
  25. prompt_symbol=@
  26. # Skull emoji for root terminal
  27. [ "$EUID" -eq 0 ] && prompt_symbol=💀
  28. case "$PROMPT_ALTERNATIVE" in
  29. twoline)
  30. 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 -n`%F{%(#.blue.green)}╚═%B%(#.%F{red}#.%F{blue}$)%b%F{reset} '
  31. # Right-side prompt with exit codes and background processes
  32. RPROMPT=$'%(?.. %? %F{red}%B⨯%b%F{reset})%(1j. %j %F{yellow}%B⚙%b%F{reset}.)'
  33. ;;
  34. oneline)
  35. 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}%(#.#.$) '
  36. RPROMPT=
  37. ;;
  38. backtrack)
  39. PROMPT=$'${debian_chroot:+($debian_chroot)}${VIRTUAL_ENV:+($(basename $VIRTUAL_ENV))}%B%F{red}%n@%m%b%F{reset}:%B%F{blue}%~%b%F{reset}%(#.#.$) '
  40. RPROMPT=
  41. ;;
  42. esac
  43. unset prompt_symbol
  44. }
  45. # The following block is surrounded by two delimiters.
  46. # These delimiters must not be modified. Thanks.
  47. # START KALI CONFIG VARIABLES
  48. PROMPT_ALTERNATIVE=twoline
  49. NEWLINE_BEFORE_PROMPT=yes
  50. # STOP KALI CONFIG VARIABLES
  51. if [ "$color_prompt" = yes ]; then
  52. # override default virtualenv indicator in prompt
  53. VIRTUAL_ENV_DISABLE_PROMPT=1
  54. configure_prompt
  55. # enable syntax-highlighting
  56. if [ -f /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ]; then
  57. . /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
  58. ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern)
  59. ZSH_HIGHLIGHT_STYLES[default]=none
  60. ZSH_HIGHLIGHT_STYLES[unknown-token]=fg=white,underline
  61. ZSH_HIGHLIGHT_STYLES[reserved-word]=fg=cyan,bold
  62. ZSH_HIGHLIGHT_STYLES[suffix-alias]=fg=green,underline
  63. ZSH_HIGHLIGHT_STYLES[global-alias]=fg=green,bold
  64. ZSH_HIGHLIGHT_STYLES[precommand]=fg=green,underline
  65. ZSH_HIGHLIGHT_STYLES[commandseparator]=fg=blue,bold
  66. ZSH_HIGHLIGHT_STYLES[autodirectory]=fg=green,underline
  67. ZSH_HIGHLIGHT_STYLES[path]=bold
  68. ZSH_HIGHLIGHT_STYLES[path_pathseparator]=
  69. ZSH_HIGHLIGHT_STYLES[path_prefix_pathseparator]=
  70. ZSH_HIGHLIGHT_STYLES[globbing]=fg=blue,bold
  71. ZSH_HIGHLIGHT_STYLES[history-expansion]=fg=blue,bold
  72. ZSH_HIGHLIGHT_STYLES[command-substitution]=none
  73. ZSH_HIGHLIGHT_STYLES[command-substitution-delimiter]=fg=magenta,bold
  74. ZSH_HIGHLIGHT_STYLES[process-substitution]=none
  75. ZSH_HIGHLIGHT_STYLES[process-substitution-delimiter]=fg=magenta,bold
  76. ZSH_HIGHLIGHT_STYLES[single-hyphen-option]=fg=green
  77. ZSH_HIGHLIGHT_STYLES[double-hyphen-option]=fg=green
  78. ZSH_HIGHLIGHT_STYLES[back-quoted-argument]=none
  79. ZSH_HIGHLIGHT_STYLES[back-quoted-argument-delimiter]=fg=blue,bold
  80. ZSH_HIGHLIGHT_STYLES[single-quoted-argument]=fg=yellow
  81. ZSH_HIGHLIGHT_STYLES[double-quoted-argument]=fg=yellow
  82. ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]=fg=yellow
  83. ZSH_HIGHLIGHT_STYLES[rc-quote]=fg=magenta
  84. ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]=fg=magenta,bold
  85. ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]=fg=magenta,bold
  86. ZSH_HIGHLIGHT_STYLES[back-dollar-quoted-argument]=fg=magenta,bold
  87. ZSH_HIGHLIGHT_STYLES[assign]=none
  88. ZSH_HIGHLIGHT_STYLES[redirection]=fg=blue,bold
  89. ZSH_HIGHLIGHT_STYLES[comment]=fg=black,bold
  90. ZSH_HIGHLIGHT_STYLES[named-fd]=none
  91. ZSH_HIGHLIGHT_STYLES[numeric-fd]=none
  92. ZSH_HIGHLIGHT_STYLES[arg0]=fg=cyan
  93. ZSH_HIGHLIGHT_STYLES[bracket-error]=fg=red,bold
  94. ZSH_HIGHLIGHT_STYLES[bracket-level-1]=fg=blue,bold
  95. ZSH_HIGHLIGHT_STYLES[bracket-level-2]=fg=green,bold
  96. ZSH_HIGHLIGHT_STYLES[bracket-level-3]=fg=magenta,bold
  97. ZSH_HIGHLIGHT_STYLES[bracket-level-4]=fg=yellow,bold
  98. ZSH_HIGHLIGHT_STYLES[bracket-level-5]=fg=cyan,bold
  99. ZSH_HIGHLIGHT_STYLES[cursor-matchingbracket]=standout
  100. fi
  101. else
  102. PROMPT='${debian_chroot:+($debian_chroot)}%n@%m:%~%(#.#.$) '
  103. fi
  104. unset color_prompt force_color_prompt
  105. toggle_oneline_prompt(){
  106. if [ "$PROMPT_ALTERNATIVE" = oneline ]; then
  107. PROMPT_ALTERNATIVE=twoline
  108. else
  109. PROMPT_ALTERNATIVE=oneline
  110. fi
  111. configure_prompt
  112. zle reset-prompt
  113. }
  114. zle -N toggle_oneline_prompt
  115. bindkey ^P toggle_oneline_prompt
  116. # If this is an xterm set the title to user@host:dir
  117. case "$TERM" in
  118. xterm*|rxvt*|Eterm|aterm|kterm|gnome*|alacritty)
  119. TERM_TITLE=$'\e]0;${debian_chroot:+($debian_chroot)}${VIRTUAL_ENV:+($(basename $VIRTUAL_ENV))}%n@%m: %~\a'
  120. ;;
  121. *)
  122. ;;
  123. esac
  124. precmd() {
  125. # Print the previously configured title
  126. print -Pnr -- "$TERM_TITLE"
  127. # Print a new line before the prompt, but only if it is not the first line
  128. if [ "$NEWLINE_BEFORE_PROMPT" = yes ]; then
  129. if [ -z "$_NEW_LINE_BEFORE_PROMPT" ]; then
  130. _NEW_LINE_BEFORE_PROMPT=1
  131. else
  132. print ""
  133. fi
  134. fi
  135. }