Another copy of my dotfiles. Because I don't completely trust GitHub.
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.

295 lines
14 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. # Generated by Powerlevel10k configuration wizard on 2021-02-22 at 09:21 +03.
  2. # Based on romkatv/powerlevel10k/config/p10k-pure.zsh.
  3. # Wizard options: nerdfont-complete + powerline, large icons, pure, snazzy, rpromt,
  4. # 2 lines, sparse, transient_prompt, instant_prompt=quiet.
  5. # Type `p10k configure` to generate another config.
  6. #
  7. # Config file for Powerlevel10k with the style of Pure (https://github.com/sindresorhus/pure).
  8. #
  9. # Differences from Pure:
  10. #
  11. # - Git:
  12. # - `@c4d3ec2c` instead of something like `v1.4.0~11` when in detached HEAD state.
  13. # - No automatic `git fetch` (the same as in Pure with `PURE_GIT_PULL=0`).
  14. #
  15. # Apart from the differences listed above, the replication of Pure prompt is exact. This includes
  16. # even the questionable parts. For example, just like in Pure, there is no indication of Git status
  17. # being stale; prompt symbol is the same in command, visual and overwrite vi modes; when prompt
  18. # doesn't fit on one line, it wraps around with no attempt to shorten it.
  19. #
  20. # If you like the general style of Pure but not particularly attached to all its quirks, type
  21. # `p10k configure` and pick "Lean" style. This will give you slick minimalist prompt while taking
  22. # advantage of Powerlevel10k features that aren't present in Pure.
  23. # Temporarily change options.
  24. 'builtin' 'local' '-a' 'p10k_config_opts'
  25. [[ ! -o 'aliases' ]] || p10k_config_opts+=('aliases')
  26. [[ ! -o 'sh_glob' ]] || p10k_config_opts+=('sh_glob')
  27. [[ ! -o 'no_brace_expand' ]] || p10k_config_opts+=('no_brace_expand')
  28. 'builtin' 'setopt' 'no_aliases' 'no_sh_glob' 'brace_expand'
  29. () {
  30. emulate -L zsh
  31. # Unset all configuration options.
  32. unset -m '(POWERLEVEL9K_*|DEFAULT_USER)~POWERLEVEL9K_GITSTATUS_DIR'
  33. # Zsh >= 5.1 is required.
  34. autoload -Uz is-at-least && is-at-least 5.1 || return
  35. # Prompt colors.
  36. local grey='242'
  37. local red='#FF5C57'
  38. local yellow='#F3F99D'
  39. local blue='#57C7FF'
  40. local magenta='#FF6AC1'
  41. local cyan='#9AEDFE'
  42. local white='#F1F1F0'
  43. # Left prompt segments.
  44. typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(
  45. # =========================[ Line #1 ]=========================
  46. # context # user@host
  47. dir # current directory
  48. # command_execution_time # previous command duration
  49. # =========================[ Line #2 ]=========================
  50. prompt_char # prompt symbol
  51. )
  52. # Right prompt segments.
  53. typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(
  54. # =========================[ Line #1 ]=========================
  55. vcs # git status
  56. command_execution_time # previous command duration
  57. virtualenv # python virtual environment
  58. context # user@host
  59. # time # current time
  60. # =========================[ Line #2 ]=========================
  61. )
  62. # Basic style options that define the overall prompt look.
  63. typeset -g POWERLEVEL9K_BACKGROUND= # transparent background
  64. typeset -g POWERLEVEL9K_{LEFT,RIGHT}_{LEFT,RIGHT}_WHITESPACE= # no surrounding whitespace
  65. typeset -g POWERLEVEL9K_{LEFT,RIGHT}_SUBSEGMENT_SEPARATOR=' ' # separate segments with a space
  66. typeset -g POWERLEVEL9K_{LEFT,RIGHT}_SEGMENT_SEPARATOR= # no end-of-line symbol
  67. typeset -g POWERLEVEL9K_VISUAL_IDENTIFIER_EXPANSION= # no segment icons
  68. # Add an empty line before each prompt except the first. This doesn't emulate the bug
  69. # in Pure that makes prompt drift down whenever you use the Alt-C binding from fzf or similar.
  70. typeset -g POWERLEVEL9K_PROMPT_ADD_NEWLINE=true
  71. # Magenta prompt symbol if the last command succeeded.
  72. typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_{VIINS,VICMD,VIVIS}_FOREGROUND=$magenta
  73. # Red prompt symbol if the last command failed.
  74. typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_{VIINS,VICMD,VIVIS}_FOREGROUND=$red
  75. # Default prompt symbol.
  76. typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIINS_CONTENT_EXPANSION='λ'
  77. # Prompt symbol in command vi mode.
  78. typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VICMD_CONTENT_EXPANSION='❮λ❯'
  79. # Prompt symbol in visual vi mode is the same as in command mode.
  80. typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIVIS_CONTENT_EXPANSION='❮λ❯'
  81. # Prompt symbol in overwrite vi mode is the same as in command mode.
  82. typeset -g POWERLEVEL9K_PROMPT_CHAR_OVERWRITE_STATE=false
  83. # Grey Python Virtual Environment.
  84. typeset -g POWERLEVEL9K_VIRTUALENV_FOREGROUND=$grey
  85. # Don't show Python version.
  86. typeset -g POWERLEVEL9K_VIRTUALENV_SHOW_PYTHON_VERSION=false
  87. typeset -g POWERLEVEL9K_VIRTUALENV_{LEFT,RIGHT}_DELIMITER=
  88. # Blue current directory.
  89. typeset -g POWERLEVEL9K_DIR_FOREGROUND=$blue
  90. # Context format when root: user@host. The first part white, the rest grey.
  91. typeset -g POWERLEVEL9K_CONTEXT_ROOT_TEMPLATE="%F{$white}%n%f%F{$grey}@%m%f"
  92. # Context format when not root: user@host. The whole thing grey.
  93. typeset -g POWERLEVEL9K_CONTEXT_TEMPLATE="%F{$grey}%n@%m%f"
  94. # Don't show context unless root or in SSH.
  95. typeset -g POWERLEVEL9K_CONTEXT_{DEFAULT,SUDO}_CONTENT_EXPANSION=
  96. # Show previous command duration only if it's >= 5s.
  97. typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=5
  98. # Don't show fractional seconds. Thus, 7s rather than 7.3s.
  99. typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=0
  100. # Duration format: 1d 2h 3m 4s.
  101. typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FORMAT='d h m s'
  102. # Yellow previous command duration.
  103. typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=$yellow
  104. #####################################[ vcs: git status ]######################################
  105. # Version control system colors.
  106. typeset -g POWERLEVEL9K_VCS_CLEAN_FOREGROUND=22
  107. typeset -g POWERLEVEL9K_VCS_MODIFIED_FOREGROUND=163
  108. typeset -g POWERLEVEL9K_VCS_UNTRACKED_FOREGROUND=20
  109. typeset -g POWERLEVEL9K_VCS_CONFLICTED_FOREGROUND=20
  110. typeset -g POWERLEVEL9K_VCS_LOADING_FOREGROUND=20
  111. # Branch icon. Set this parameter to '\uF126 ' for the popular Powerline branch icon.
  112. typeset -g POWERLEVEL9K_VCS_BRANCH_ICON='\uF126'
  113. # Untracked files icon. It's really a question mark, your font isn't broken.
  114. # Change the value of this parameter to show a different icon.
  115. typeset -g POWERLEVEL9K_VCS_UNTRACKED_ICON='?'
  116. # Formatter for Git status.
  117. #
  118. # Example output: master ⇣42⇡42 *42 merge ~42 +42 !42 ?42.
  119. #
  120. # You can edit the function to customize how Git status looks.
  121. #
  122. # VCS_STATUS_* parameters are set by gitstatus plugin. See reference:
  123. # https://github.com/romkatv/gitstatus/blob/master/gitstatus.plugin.zsh.
  124. function my_git_formatter() {
  125. emulate -L zsh
  126. if [[ -n $P9K_CONTENT ]]; then
  127. # If P9K_CONTENT is not empty, use it. It's either "loading" or from vcs_info (not from
  128. # gitstatus plugin). VCS_STATUS_* parameters are not available in this case.
  129. typeset -g my_git_format=$P9K_CONTENT
  130. return
  131. fi
  132. # Styling for different parts of Git status.
  133. local meta='%255F'
  134. local clean='%255F'
  135. local modified='%11F'
  136. local untracked='%11F'
  137. local conflicted='%10F'
  138. local res
  139. local where # branch or tag
  140. if [[ -n $VCS_STATUS_LOCAL_BRANCH ]]; then
  141. res+="${clean}${(g::)POWERLEVEL9K_VCS_BRANCH_ICON}"
  142. where=${(V)VCS_STATUS_LOCAL_BRANCH}
  143. elif [[ -n $VCS_STATUS_TAG ]]; then
  144. res+="${meta}#"
  145. where=${(V)VCS_STATUS_TAG}
  146. fi
  147. # If local branch name or tag is at most 32 characters long, show it in full.
  148. # Otherwise show the first 12 … the last 12.
  149. # Tip: To always show local branch name in full without truncation, delete the next line.
  150. (( $#where > 32 )) && where[13,-13]="…"
  151. res+="${clean}${where//\%/%%}" # escape %
  152. # Display the current Git commit if there is no branch or tag.
  153. # Tip: To always display the current Git commit, remove `[[ -z $where ]] &&` from the next line.
  154. [[ -z $where ]] && res+="${meta}@${clean}${VCS_STATUS_COMMIT[1,8]}"
  155. # Show tracking branch name if it differs from local branch.
  156. if [[ -n ${VCS_STATUS_REMOTE_BRANCH:#$VCS_STATUS_LOCAL_BRANCH} ]]; then
  157. res+="${meta}:${clean}${(V)VCS_STATUS_REMOTE_BRANCH//\%/%%}" # escape %
  158. fi
  159. # ⇣42 if behind the remote.
  160. (( VCS_STATUS_COMMITS_BEHIND )) && res+=" ${clean}${VCS_STATUS_COMMITS_BEHIND}"
  161. # ⇡42 if ahead of the remote; no leading space if also behind the remote: ⇣42⇡42.
  162. (( VCS_STATUS_COMMITS_AHEAD && !VCS_STATUS_COMMITS_BEHIND )) && res+=" "
  163. (( VCS_STATUS_COMMITS_AHEAD )) && res+="${clean}${VCS_STATUS_COMMITS_AHEAD}"
  164. # ⇠42 if behind the push remote.
  165. (( VCS_STATUS_PUSH_COMMITS_BEHIND )) && res+=" ${clean}${VCS_STATUS_PUSH_COMMITS_BEHIND}"
  166. (( VCS_STATUS_PUSH_COMMITS_AHEAD && !VCS_STATUS_PUSH_COMMITS_BEHIND )) && res+=" "
  167. # ⇢42 if ahead of the push remote; no leading space if also behind: ⇠42⇢42.
  168. (( VCS_STATUS_PUSH_COMMITS_AHEAD )) && res+="${clean}${VCS_STATUS_PUSH_COMMITS_AHEAD}"
  169. # *42 if have stashes.
  170. (( VCS_STATUS_STASHES )) && res+=" ${clean}*${VCS_STATUS_STASHES}"
  171. # 'merge' if the repo is in an unusual state.
  172. [[ -n $VCS_STATUS_ACTION ]] && res+=" ${conflicted}${VCS_STATUS_ACTION}"
  173. # ~42 if have merge conflicts.
  174. (( VCS_STATUS_NUM_CONFLICTED )) && res+=" ${conflicted}~${VCS_STATUS_NUM_CONFLICTED}"
  175. # +42 if have staged changes.
  176. (( VCS_STATUS_NUM_STAGED )) && res+=" ${modified}+${VCS_STATUS_NUM_STAGED}"
  177. # !42 if have unstaged changes.
  178. (( VCS_STATUS_NUM_UNSTAGED )) && res+=" ${modified}!${VCS_STATUS_NUM_UNSTAGED}"
  179. # ?42 if have untracked files. It's really a question mark, your font isn't broken.
  180. # See POWERLEVEL9K_VCS_UNTRACKED_ICON above if you want to use a different icon.
  181. # Remove the next line if you don't want to see untracked files at all.
  182. (( VCS_STATUS_NUM_UNTRACKED )) && res+=" ${untracked}${(g::)POWERLEVEL9K_VCS_UNTRACKED_ICON}${VCS_STATUS_NUM_UNTRACKED}"
  183. # "─" if the number of unstaged files is unknown. This can happen due to
  184. # POWERLEVEL9K_VCS_MAX_INDEX_SIZE_DIRTY (see below) being set to a non-negative number lower
  185. # than the number of files in the Git index, or due to bash.showDirtyState being set to false
  186. # in the repository config. The number of staged and untracked files may also be unknown
  187. # in this case.
  188. (( VCS_STATUS_HAS_UNSTAGED == -1 )) && res+=" ${modified}"
  189. typeset -g my_git_format=$res
  190. }
  191. functions -M my_git_formatter 2>/dev/null
  192. # Don't count the number of unstaged, untracked and conflicted files in Git repositories with
  193. # more than this many files in the index. Negative value means infinity.
  194. #
  195. # If you are working in Git repositories with tens of millions of files and seeing performance
  196. # sagging, try setting POWERLEVEL9K_VCS_MAX_INDEX_SIZE_DIRTY to a number lower than the output
  197. # of `git ls-files | wc -l`. Alternatively, add `bash.showDirtyState = false` to the repository's
  198. # config: `git config bash.showDirtyState false`.
  199. typeset -g POWERLEVEL9K_VCS_MAX_INDEX_SIZE_DIRTY=-1
  200. # Don't show Git status in prompt for repositories whose workdir matches this pattern.
  201. # For example, if set to '~', the Git repository at $HOME/.git will be ignored.
  202. # Multiple patterns can be combined with '|': '~(|/foo)|/bar/baz/*'.
  203. typeset -g POWERLEVEL9K_VCS_DISABLED_WORKDIR_PATTERN='~'
  204. # Disable the default Git status formatting.
  205. typeset -g POWERLEVEL9K_VCS_DISABLE_GITSTATUS_FORMATTING=true
  206. # Install our own Git status formatter.
  207. typeset -g POWERLEVEL9K_VCS_CONTENT_EXPANSION='${$((my_git_formatter()))+${my_git_format}}'
  208. # Enable counters for staged, unstaged, etc.
  209. typeset -g POWERLEVEL9K_VCS_{STAGED,UNSTAGED,UNTRACKED,CONFLICTED,COMMITS_AHEAD,COMMITS_BEHIND}_MAX_NUM=-1
  210. # Custom icon.
  211. typeset -g POWERLEVEL9K_VCS_VISUAL_IDENTIFIER_EXPANSION=
  212. # Custom prefix.
  213. # typeset -g POWERLEVEL9K_VCS_PREFIX='on '
  214. # Show status of repositories of these types. You can add svn and/or hg if you are
  215. # using them. If you do, your prompt may become slow even when your current directory
  216. # isn't in an svn or hg reposotiry.
  217. typeset -g POWERLEVEL9K_VCS_BACKENDS=(git)
  218. #
  219. # Grey current time.
  220. typeset -g POWERLEVEL9K_TIME_FOREGROUND=$yellow
  221. # Format for the current time: 09:51:02. See `man 3 strftime`.
  222. typeset -g POWERLEVEL9K_TIME_FORMAT='%D{%H:%M:%S}'
  223. # If set to true, time will update when you hit enter. This way prompts for the past
  224. # commands will contain the start times of their commands rather than the end times of
  225. # their preceding commands.
  226. typeset -g POWERLEVEL9K_TIME_UPDATE_ON_COMMAND=false
  227. # Transient prompt works similarly to the builtin transient_rprompt option. It trims down prompt
  228. # when accepting a command line. Supported values:
  229. #
  230. # - off: Don't change prompt when accepting a command line.
  231. # - always: Trim down prompt when accepting a command line.
  232. # - same-dir: Trim down prompt when accepting a command line unless this is the first command
  233. # typed after changing current working directory.
  234. typeset -g POWERLEVEL9K_TRANSIENT_PROMPT=always
  235. # Instant prompt mode.
  236. #
  237. # - off: Disable instant prompt. Choose this if you've tried instant prompt and found
  238. # it incompatible with your zsh configuration files.
  239. # - quiet: Enable instant prompt and don't print warnings when detecting console output
  240. # during zsh initialization. Choose this if you've read and understood
  241. # https://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt.
  242. # - verbose: Enable instant prompt and print a warning when detecting console output during
  243. # zsh initialization. Choose this if you've never tried instant prompt, haven't
  244. # seen the warning, or if you are unsure what this all means.
  245. typeset -g POWERLEVEL9K_INSTANT_PROMPT=quiet
  246. # Hot reload allows you to change POWERLEVEL9K options after Powerlevel10k has been initialized.
  247. # For example, you can type POWERLEVEL9K_BACKGROUND=red and see your prompt turn red. Hot reload
  248. # can slow down prompt by 1-2 milliseconds, so it's better to keep it turned off unless you
  249. # really need it.
  250. typeset -g POWERLEVEL9K_DISABLE_HOT_RELOAD=true
  251. # If p10k is already loaded, reload configuration.
  252. # This works even with POWERLEVEL9K_DISABLE_HOT_RELOAD=true.
  253. (( ! $+functions[p10k] )) || p10k reload
  254. }
  255. # Tell `p10k configure` which file it should overwrite.
  256. typeset -g POWERLEVEL9K_CONFIG_FILE=${${(%):-%x}:a}
  257. (( ${#p10k_config_opts} )) && setopt ${p10k_config_opts[@]}
  258. 'builtin' 'unset' 'p10k_config_opts'