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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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='%F{cyan}@%B%F{%(#.red.blue)}'
  25. # Skull emoji for root terminal
  26. [ "$EUID" -eq 0 ] && prompt_symbol='%F{white}☠%B%F{%(#.red.blue)}'
  27. case "$PROMPT_ALTERNATIVE" in
  28. twoline)
  29. export GIT_PROMPT_DETAILS="off"
  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 -p`%F{%(#.blue.green)}└─%F{red}%(?.. %? %B⚡%b)%F{yellow}%(1j. %j %B⚙ %b%F{reset}.)%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. # Add mechanism to switch git details for prompt
  34. gitp() {
  35. [[ "$GIT_PROMPT_DETAILS" == "on" ]] && export GIT_PROMPT_DETAILS="off" || export GIT_PROMPT_DETAILS="on"
  36. }
  37. ;;
  38. oneline)
  39. 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}%(#.#.$) '
  40. RPROMPT=
  41. ;;
  42. backtrack)
  43. PROMPT=$'${debian_chroot:+($debian_chroot)}${VIRTUAL_ENV:+($(basename $VIRTUAL_ENV))}%B%F{red}%n@%m%b%F{reset}:%B%F{blue}%~%b%F{reset}%(#.#.$) '
  44. RPROMPT=
  45. ;;
  46. esac
  47. unset prompt_symbol
  48. }
  49. # The following block is surrounded by two delimiters.
  50. # These delimiters must not be modified. Thanks.
  51. # START KALI CONFIG VARIABLES
  52. PROMPT_ALTERNATIVE=twoline
  53. NEWLINE_BEFORE_PROMPT=yes
  54. # STOP KALI CONFIG VARIABLES
  55. if [ "$color_prompt" = yes ]; then
  56. # override default virtualenv indicator in prompt
  57. VIRTUAL_ENV_DISABLE_PROMPT=1
  58. configure_prompt
  59. else
  60. PROMPT='${debian_chroot:+($debian_chroot)}%n@%m:%~%(#.#.$) '
  61. fi
  62. unset color_prompt force_color_prompt
  63. toggle_oneline_prompt(){
  64. if [ "$PROMPT_ALTERNATIVE" = oneline ]; then
  65. PROMPT_ALTERNATIVE=twoline
  66. else
  67. PROMPT_ALTERNATIVE=oneline
  68. fi
  69. configure_prompt
  70. zle reset-prompt
  71. }
  72. zle -N toggle_oneline_prompt
  73. bindkey ^P toggle_oneline_prompt
  74. # If this is an xterm set the title to user@host:dir
  75. case "$TERM" in
  76. xterm*|rxvt*|Eterm|aterm|kterm|gnome*|alacritty)
  77. TERM_TITLE=$'\e]0;${debian_chroot:+($debian_chroot)}${VIRTUAL_ENV:+($(basename $VIRTUAL_ENV))}%n@%m: %~\a'
  78. ;;
  79. *)
  80. ;;
  81. esac
  82. precmd() {
  83. # Print the previously configured title
  84. print -Pnr -- "$TERM_TITLE"
  85. # Print a new line before the prompt, but only if it is not the first line
  86. if [ "$NEWLINE_BEFORE_PROMPT" = yes ]; then
  87. if [ -z "$_NEW_LINE_BEFORE_PROMPT" ]; then
  88. _NEW_LINE_BEFORE_PROMPT=1
  89. else
  90. print ""
  91. fi
  92. fi
  93. }