my xfce4 dotfiles
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.

111 lines
5.1 KiB

3 years ago
  1. # Config file for Powerlevel10k with the style of robbyrussell theme from Oh My Zsh.
  2. #
  3. # Original: https://github.com/ohmyzsh/ohmyzsh/wiki/Themes#robbyrussell.
  4. #
  5. # Replication of robbyrussell theme is exact. The only observable difference is in
  6. # performance. Powerlevel10k prompt is very fast everywhere, even in large Git repositories.
  7. #
  8. # Usage: Source this file either before or after loading Powerlevel10k.
  9. #
  10. # source ~/powerlevel10k/config/p10k-robbyrussell.zsh
  11. # source ~/powerlevel10k/powerlevel10k.zsh-theme
  12. # Temporarily change options.
  13. 'builtin' 'local' '-a' 'p10k_config_opts'
  14. [[ ! -o 'aliases' ]] || p10k_config_opts+=('aliases')
  15. [[ ! -o 'sh_glob' ]] || p10k_config_opts+=('sh_glob')
  16. [[ ! -o 'no_brace_expand' ]] || p10k_config_opts+=('no_brace_expand')
  17. 'builtin' 'setopt' 'no_aliases' 'no_sh_glob' 'brace_expand'
  18. () {
  19. emulate -L zsh -o extended_glob
  20. # Unset all configuration options.
  21. unset -m '(POWERLEVEL9K_*|DEFAULT_USER)~POWERLEVEL9K_GITSTATUS_DIR'
  22. # Zsh >= 5.1 is required.
  23. autoload -Uz is-at-least && is-at-least 5.1 || return
  24. # Left prompt segments.
  25. typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(prompt_char dir vcs)
  26. # Right prompt segments.
  27. typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=()
  28. # Basic style options that define the overall prompt look.
  29. typeset -g POWERLEVEL9K_BACKGROUND= # transparent background
  30. typeset -g POWERLEVEL9K_{LEFT,RIGHT}_{LEFT,RIGHT}_WHITESPACE= # no surrounding whitespace
  31. typeset -g POWERLEVEL9K_{LEFT,RIGHT}_SUBSEGMENT_SEPARATOR=' ' # separate segments with a space
  32. typeset -g POWERLEVEL9K_{LEFT,RIGHT}_SEGMENT_SEPARATOR= # no end-of-line symbol
  33. typeset -g POWERLEVEL9K_VISUAL_IDENTIFIER_EXPANSION= # no segment icons
  34. # Green prompt symbol if the last command succeeded.
  35. typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_{VIINS,VICMD,VIVIS}_FOREGROUND=green
  36. # Red prompt symbol if the last command failed.
  37. typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_{VIINS,VICMD,VIVIS}_FOREGROUND=red
  38. # Prompt symbol: bold arrow.
  39. typeset -g POWERLEVEL9K_PROMPT_CHAR_CONTENT_EXPANSION='%B➜ '
  40. # Cyan current directory.
  41. typeset -g POWERLEVEL9K_DIR_FOREGROUND=cyan
  42. # Show only the last segment of the current directory.
  43. typeset -g POWERLEVEL9K_SHORTEN_STRATEGY=truncate_to_last
  44. # Bold directory.
  45. typeset -g POWERLEVEL9K_DIR_CONTENT_EXPANSION='%B$P9K_CONTENT'
  46. # Git status formatter.
  47. function my_git_formatter() {
  48. emulate -L zsh
  49. if [[ -n $P9K_CONTENT ]]; then
  50. # If P9K_CONTENT is not empty, it's either "loading" or from vcs_info (not from
  51. # gitstatus plugin). VCS_STATUS_* parameters are not available in this case.
  52. typeset -g my_git_format=$P9K_CONTENT
  53. else
  54. # Use VCS_STATUS_* parameters to assemble Git status. See reference:
  55. # https://github.com/romkatv/gitstatus/blob/master/gitstatus.plugin.zsh.
  56. typeset -g my_git_format="${1+%B%4F}git:(${1+%1F}"
  57. my_git_format+=${${VCS_STATUS_LOCAL_BRANCH:-${VCS_STATUS_COMMIT[1,8]}}//\%/%%}
  58. my_git_format+="${1+%4F})"
  59. if (( VCS_STATUS_NUM_CONFLICTED || VCS_STATUS_NUM_STAGED ||
  60. VCS_STATUS_NUM_UNSTAGED || VCS_STATUS_NUM_UNTRACKED )); then
  61. my_git_format+=" ${1+%3F}"
  62. fi
  63. fi
  64. }
  65. functions -M my_git_formatter 2>/dev/null
  66. # Disable the default Git status formatting.
  67. typeset -g POWERLEVEL9K_VCS_DISABLE_GITSTATUS_FORMATTING=true
  68. # Install our own Git status formatter.
  69. typeset -g POWERLEVEL9K_VCS_CONTENT_EXPANSION='${$((my_git_formatter(1)))+${my_git_format}}'
  70. typeset -g POWERLEVEL9K_VCS_LOADING_CONTENT_EXPANSION='${$((my_git_formatter()))+${my_git_format}}'
  71. # Grey Git status when loading.
  72. typeset -g POWERLEVEL9K_VCS_LOADING_FOREGROUND=246
  73. # Instant prompt mode.
  74. #
  75. # - off: Disable instant prompt. Choose this if you've tried instant prompt and found
  76. # it incompatible with your zsh configuration files.
  77. # - quiet: Enable instant prompt and don't print warnings when detecting console output
  78. # during zsh initialization. Choose this if you've read and understood
  79. # https://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt.
  80. # - verbose: Enable instant prompt and print a warning when detecting console output during
  81. # zsh initialization. Choose this if you've never tried instant prompt, haven't
  82. # seen the warning, or if you are unsure what this all means.
  83. typeset -g POWERLEVEL9K_INSTANT_PROMPT=verbose
  84. # Hot reload allows you to change POWERLEVEL9K options after Powerlevel10k has been initialized.
  85. # For example, you can type POWERLEVEL9K_BACKGROUND=red and see your prompt turn red. Hot reload
  86. # can slow down prompt by 1-2 milliseconds, so it's better to keep it turned off unless you
  87. # really need it.
  88. typeset -g POWERLEVEL9K_DISABLE_HOT_RELOAD=true
  89. # If p10k is already loaded, reload configuration.
  90. # This works even with POWERLEVEL9K_DISABLE_HOT_RELOAD=true.
  91. (( ! $+functions[p10k] )) || p10k reload
  92. }
  93. # Tell `p10k configure` which file it should overwrite.
  94. typeset -g POWERLEVEL9K_CONFIG_FILE=${${(%):-%x}:a}
  95. (( ${#p10k_config_opts} )) && setopt ${p10k_config_opts[@]}
  96. 'builtin' 'unset' 'p10k_config_opts'