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.

193 lines
9.3 KiB

3 years ago
  1. # Config file for Powerlevel10k with the style of Pure (https://github.com/sindresorhus/pure).
  2. #
  3. # Differences from Pure:
  4. #
  5. # - Git:
  6. # - `@c4d3ec2c` instead of something like `v1.4.0~11` when in detached HEAD state.
  7. # - No automatic `git fetch` (the same as in Pure with `PURE_GIT_PULL=0`).
  8. #
  9. # Apart from the differences listed above, the replication of Pure prompt is exact. This includes
  10. # even the questionable parts. For example, just like in Pure, there is no indication of Git status
  11. # being stale; prompt symbol is the same in command, visual and overwrite vi modes; when prompt
  12. # doesn't fit on one line, it wraps around with no attempt to shorten it.
  13. #
  14. # If you like the general style of Pure but not particularly attached to all its quirks, type
  15. # `p10k configure` and pick "Lean" style. This will give you slick minimalist prompt while taking
  16. # advantage of Powerlevel10k features that aren't present in Pure.
  17. # Temporarily change options.
  18. 'builtin' 'local' '-a' 'p10k_config_opts'
  19. [[ ! -o 'aliases' ]] || p10k_config_opts+=('aliases')
  20. [[ ! -o 'sh_glob' ]] || p10k_config_opts+=('sh_glob')
  21. [[ ! -o 'no_brace_expand' ]] || p10k_config_opts+=('no_brace_expand')
  22. 'builtin' 'setopt' 'no_aliases' 'no_sh_glob' 'brace_expand'
  23. () {
  24. emulate -L zsh -o extended_glob
  25. # Unset all configuration options.
  26. unset -m '(POWERLEVEL9K_*|DEFAULT_USER)~POWERLEVEL9K_GITSTATUS_DIR'
  27. # Zsh >= 5.1 is required.
  28. autoload -Uz is-at-least && is-at-least 5.1 || return
  29. # Prompt colors.
  30. local grey=242
  31. local red=1
  32. local yellow=3
  33. local blue=4
  34. local magenta=5
  35. local cyan=6
  36. local white=7
  37. # Left prompt segments.
  38. typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(
  39. # =========================[ Line #1 ]=========================
  40. context # user@host
  41. dir # current directory
  42. vcs # git status
  43. command_execution_time # previous command duration
  44. # =========================[ Line #2 ]=========================
  45. newline # \n
  46. virtualenv # python virtual environment
  47. prompt_char # prompt symbol
  48. )
  49. # Right prompt segments.
  50. typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(
  51. # =========================[ Line #1 ]=========================
  52. # command_execution_time # previous command duration
  53. # virtualenv # python virtual environment
  54. # context # user@host
  55. # time # current time
  56. # =========================[ Line #2 ]=========================
  57. newline # \n
  58. )
  59. # Basic style options that define the overall prompt look.
  60. typeset -g POWERLEVEL9K_BACKGROUND= # transparent background
  61. typeset -g POWERLEVEL9K_{LEFT,RIGHT}_{LEFT,RIGHT}_WHITESPACE= # no surrounding whitespace
  62. typeset -g POWERLEVEL9K_{LEFT,RIGHT}_SUBSEGMENT_SEPARATOR=' ' # separate segments with a space
  63. typeset -g POWERLEVEL9K_{LEFT,RIGHT}_SEGMENT_SEPARATOR= # no end-of-line symbol
  64. typeset -g POWERLEVEL9K_VISUAL_IDENTIFIER_EXPANSION= # no segment icons
  65. # Add an empty line before each prompt except the first. This doesn't emulate the bug
  66. # in Pure that makes prompt drift down whenever you use the Alt-C binding from fzf or similar.
  67. typeset -g POWERLEVEL9K_PROMPT_ADD_NEWLINE=true
  68. # Magenta prompt symbol if the last command succeeded.
  69. typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_{VIINS,VICMD,VIVIS}_FOREGROUND=$magenta
  70. # Red prompt symbol if the last command failed.
  71. typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_{VIINS,VICMD,VIVIS}_FOREGROUND=$red
  72. # Default prompt symbol.
  73. typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIINS_CONTENT_EXPANSION='❯'
  74. # Prompt symbol in command vi mode.
  75. typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VICMD_CONTENT_EXPANSION='❮'
  76. # Prompt symbol in visual vi mode is the same as in command mode.
  77. typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIVIS_CONTENT_EXPANSION='❮'
  78. # Prompt symbol in overwrite vi mode is the same as in command mode.
  79. typeset -g POWERLEVEL9K_PROMPT_CHAR_OVERWRITE_STATE=false
  80. # Grey Python Virtual Environment.
  81. typeset -g POWERLEVEL9K_VIRTUALENV_FOREGROUND=$grey
  82. # Don't show Python version.
  83. typeset -g POWERLEVEL9K_VIRTUALENV_SHOW_PYTHON_VERSION=false
  84. typeset -g POWERLEVEL9K_VIRTUALENV_{LEFT,RIGHT}_DELIMITER=
  85. # Blue current directory.
  86. typeset -g POWERLEVEL9K_DIR_FOREGROUND=$blue
  87. # Context format when root: user@host. The first part white, the rest grey.
  88. typeset -g POWERLEVEL9K_CONTEXT_ROOT_TEMPLATE="%F{$white}%n%f%F{$grey}@%m%f"
  89. # Context format when not root: user@host. The whole thing grey.
  90. typeset -g POWERLEVEL9K_CONTEXT_TEMPLATE="%F{$grey}%n@%m%f"
  91. # Don't show context unless root or in SSH.
  92. typeset -g POWERLEVEL9K_CONTEXT_{DEFAULT,SUDO}_CONTENT_EXPANSION=
  93. # Show previous command duration only if it's >= 5s.
  94. typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=5
  95. # Don't show fractional seconds. Thus, 7s rather than 7.3s.
  96. typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=0
  97. # Duration format: 1d 2h 3m 4s.
  98. typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FORMAT='d h m s'
  99. # Yellow previous command duration.
  100. typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=$yellow
  101. # Grey Git prompt. This makes stale prompts indistinguishable from up-to-date ones.
  102. typeset -g POWERLEVEL9K_VCS_FOREGROUND=$grey
  103. # Disable async loading indicator to make directories that aren't Git repositories
  104. # indistinguishable from large Git repositories without known state.
  105. typeset -g POWERLEVEL9K_VCS_LOADING_TEXT=
  106. # Don't wait for Git status even for a millisecond, so that prompt always updates
  107. # asynchronously when Git state changes.
  108. typeset -g POWERLEVEL9K_VCS_MAX_SYNC_LATENCY_SECONDS=0
  109. # Cyan ahead/behind arrows.
  110. typeset -g POWERLEVEL9K_VCS_{INCOMING,OUTGOING}_CHANGESFORMAT_FOREGROUND=$cyan
  111. # Don't show remote branch, current tag or stashes.
  112. typeset -g POWERLEVEL9K_VCS_GIT_HOOKS=(vcs-detect-changes git-untracked git-aheadbehind)
  113. # Don't show the branch icon.
  114. typeset -g POWERLEVEL9K_VCS_BRANCH_ICON=
  115. # When in detached HEAD state, show @commit where branch normally goes.
  116. typeset -g POWERLEVEL9K_VCS_COMMIT_ICON='@'
  117. # Don't show staged, unstaged, untracked indicators.
  118. typeset -g POWERLEVEL9K_VCS_{STAGED,UNSTAGED,UNTRACKED}_ICON=
  119. # Show '*' when there are staged, unstaged or untracked files.
  120. typeset -g POWERLEVEL9K_VCS_DIRTY_ICON='*'
  121. # Show '⇣' if local branch is behind remote.
  122. typeset -g POWERLEVEL9K_VCS_INCOMING_CHANGES_ICON=':⇣'
  123. # Show '⇡' if local branch is ahead of remote.
  124. typeset -g POWERLEVEL9K_VCS_OUTGOING_CHANGES_ICON=':⇡'
  125. # Don't show the number of commits next to the ahead/behind arrows.
  126. typeset -g POWERLEVEL9K_VCS_{COMMITS_AHEAD,COMMITS_BEHIND}_MAX_NUM=1
  127. # Remove space between '⇣' and '⇡' and all trailing spaces.
  128. typeset -g POWERLEVEL9K_VCS_CONTENT_EXPANSION='${${${P9K_CONTENT/⇣* :⇡/⇣⇡}// }//:/ }'
  129. # Grey current time.
  130. typeset -g POWERLEVEL9K_TIME_FOREGROUND=$grey
  131. # Format for the current time: 09:51:02. See `man 3 strftime`.
  132. typeset -g POWERLEVEL9K_TIME_FORMAT='%D{%H:%M:%S}'
  133. # If set to true, time will update when you hit enter. This way prompts for the past
  134. # commands will contain the start times of their commands rather than the end times of
  135. # their preceding commands.
  136. typeset -g POWERLEVEL9K_TIME_UPDATE_ON_COMMAND=false
  137. # Transient prompt works similarly to the builtin transient_rprompt option. It trims down prompt
  138. # when accepting a command line. Supported values:
  139. #
  140. # - off: Don't change prompt when accepting a command line.
  141. # - always: Trim down prompt when accepting a command line.
  142. # - same-dir: Trim down prompt when accepting a command line unless this is the first command
  143. # typed after changing current working directory.
  144. typeset -g POWERLEVEL9K_TRANSIENT_PROMPT=off
  145. # Instant prompt mode.
  146. #
  147. # - off: Disable instant prompt. Choose this if you've tried instant prompt and found
  148. # it incompatible with your zsh configuration files.
  149. # - quiet: Enable instant prompt and don't print warnings when detecting console output
  150. # during zsh initialization. Choose this if you've read and understood
  151. # https://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt.
  152. # - verbose: Enable instant prompt and print a warning when detecting console output during
  153. # zsh initialization. Choose this if you've never tried instant prompt, haven't
  154. # seen the warning, or if you are unsure what this all means.
  155. typeset -g POWERLEVEL9K_INSTANT_PROMPT=verbose
  156. # Hot reload allows you to change POWERLEVEL9K options after Powerlevel10k has been initialized.
  157. # For example, you can type POWERLEVEL9K_BACKGROUND=red and see your prompt turn red. Hot reload
  158. # can slow down prompt by 1-2 milliseconds, so it's better to keep it turned off unless you
  159. # really need it.
  160. typeset -g POWERLEVEL9K_DISABLE_HOT_RELOAD=true
  161. # If p10k is already loaded, reload configuration.
  162. # This works even with POWERLEVEL9K_DISABLE_HOT_RELOAD=true.
  163. (( ! $+functions[p10k] )) || p10k reload
  164. }
  165. # Tell `p10k configure` which file it should overwrite.
  166. typeset -g POWERLEVEL9K_CONFIG_FILE=${${(%):-%x}:a}
  167. (( ${#p10k_config_opts} )) && setopt ${p10k_config_opts[@]}
  168. 'builtin' 'unset' 'p10k_config_opts'