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.

296 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
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. if [ -n "$RANGER_LEVEL" ]; then export MODE="[ranger]"; fi
  72. # Magenta prompt symbol if the last command succeeded.
  73. typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_{VIINS,VICMD,VIVIS}_FOREGROUND=$magenta
  74. # Red prompt symbol if the last command failed.
  75. typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_{VIINS,VICMD,VIVIS}_FOREGROUND=$red
  76. # Default prompt symbol.
  77. typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIINS_CONTENT_EXPANSION="$MODE"λ
  78. # Prompt symbol in command vi mode.
  79. typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VICMD_CONTENT_EXPANSION="$MODE❮λ❯"
  80. # Prompt symbol in visual vi mode is the same as in command mode.
  81. typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIVIS_CONTENT_EXPANSION="$MODE❮λ❯"
  82. # Prompt symbol in overwrite vi mode is the same as in command mode.
  83. typeset -g POWERLEVEL9K_PROMPT_CHAR_OVERWRITE_STATE=false
  84. # Grey Python Virtual Environment.
  85. typeset -g POWERLEVEL9K_VIRTUALENV_FOREGROUND=$grey
  86. # Don't show Python version.
  87. typeset -g POWERLEVEL9K_VIRTUALENV_SHOW_PYTHON_VERSION=false
  88. typeset -g POWERLEVEL9K_VIRTUALENV_{LEFT,RIGHT}_DELIMITER=
  89. # Blue current directory.
  90. typeset -g POWERLEVEL9K_DIR_FOREGROUND=$blue
  91. # Context format when root: user@host. The first part white, the rest grey.
  92. typeset -g POWERLEVEL9K_CONTEXT_ROOT_TEMPLATE="%F{$white}%n%f%F{$grey}@%m%f"
  93. # Context format when not root: user@host. The whole thing grey.
  94. typeset -g POWERLEVEL9K_CONTEXT_TEMPLATE="%F{$grey}%n@%m%f"
  95. # Don't show context unless root or in SSH.
  96. typeset -g POWERLEVEL9K_CONTEXT_{DEFAULT,SUDO}_CONTENT_EXPANSION=
  97. # Show previous command duration only if it's >= 5s.
  98. typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=5
  99. # Don't show fractional seconds. Thus, 7s rather than 7.3s.
  100. typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=0
  101. # Duration format: 1d 2h 3m 4s.
  102. typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FORMAT='d h m s'
  103. # Yellow previous command duration.
  104. typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=$yellow
  105. #####################################[ vcs: git status ]######################################
  106. # Version control system colors.
  107. typeset -g POWERLEVEL9K_VCS_CLEAN_FOREGROUND=22
  108. typeset -g POWERLEVEL9K_VCS_MODIFIED_FOREGROUND=163
  109. typeset -g POWERLEVEL9K_VCS_UNTRACKED_FOREGROUND=20
  110. typeset -g POWERLEVEL9K_VCS_CONFLICTED_FOREGROUND=20
  111. typeset -g POWERLEVEL9K_VCS_LOADING_FOREGROUND=20
  112. # Branch icon. Set this parameter to '\uF126 ' for the popular Powerline branch icon.
  113. typeset -g POWERLEVEL9K_VCS_BRANCH_ICON='\uF126'
  114. # Untracked files icon. It's really a question mark, your font isn't broken.
  115. # Change the value of this parameter to show a different icon.
  116. typeset -g POWERLEVEL9K_VCS_UNTRACKED_ICON='?'
  117. # Formatter for Git status.
  118. #
  119. # Example output: master ⇣42⇡42 *42 merge ~42 +42 !42 ?42.
  120. #
  121. # You can edit the function to customize how Git status looks.
  122. #
  123. # VCS_STATUS_* parameters are set by gitstatus plugin. See reference:
  124. # https://github.com/romkatv/gitstatus/blob/master/gitstatus.plugin.zsh.
  125. function my_git_formatter() {
  126. emulate -L zsh
  127. if [[ -n $P9K_CONTENT ]]; then
  128. # If P9K_CONTENT is not empty, use it. It's either "loading" or from vcs_info (not from
  129. # gitstatus plugin). VCS_STATUS_* parameters are not available in this case.
  130. typeset -g my_git_format=$P9K_CONTENT
  131. return
  132. fi
  133. # Styling for different parts of Git status.
  134. local meta='%255F'
  135. local clean='%255F'
  136. local modified='%11F'
  137. local untracked='%11F'
  138. local conflicted='%10F'
  139. local res
  140. local where # branch or tag
  141. if [[ -n $VCS_STATUS_LOCAL_BRANCH ]]; then
  142. res+="${clean}${(g::)POWERLEVEL9K_VCS_BRANCH_ICON}"
  143. where=${(V)VCS_STATUS_LOCAL_BRANCH}
  144. elif [[ -n $VCS_STATUS_TAG ]]; then
  145. res+="${meta}#"
  146. where=${(V)VCS_STATUS_TAG}
  147. fi
  148. # If local branch name or tag is at most 32 characters long, show it in full.
  149. # Otherwise show the first 12 … the last 12.
  150. # Tip: To always show local branch name in full without truncation, delete the next line.
  151. (( $#where > 32 )) && where[13,-13]="…"
  152. res+="${clean}${where//\%/%%}" # escape %
  153. # Display the current Git commit if there is no branch or tag.
  154. # Tip: To always display the current Git commit, remove `[[ -z $where ]] &&` from the next line.
  155. [[ -z $where ]] && res+="${meta}@${clean}${VCS_STATUS_COMMIT[1,8]}"
  156. # Show tracking branch name if it differs from local branch.
  157. if [[ -n ${VCS_STATUS_REMOTE_BRANCH:#$VCS_STATUS_LOCAL_BRANCH} ]]; then
  158. res+="${meta}:${clean}${(V)VCS_STATUS_REMOTE_BRANCH//\%/%%}" # escape %
  159. fi
  160. # ⇣42 if behind the remote.
  161. (( VCS_STATUS_COMMITS_BEHIND )) && res+=" ${clean}${VCS_STATUS_COMMITS_BEHIND}"
  162. # ⇡42 if ahead of the remote; no leading space if also behind the remote: ⇣42⇡42.
  163. (( VCS_STATUS_COMMITS_AHEAD && !VCS_STATUS_COMMITS_BEHIND )) && res+=" "
  164. (( VCS_STATUS_COMMITS_AHEAD )) && res+="${clean}${VCS_STATUS_COMMITS_AHEAD}"
  165. # ⇠42 if behind the push remote.
  166. (( VCS_STATUS_PUSH_COMMITS_BEHIND )) && res+=" ${clean}${VCS_STATUS_PUSH_COMMITS_BEHIND}"
  167. (( VCS_STATUS_PUSH_COMMITS_AHEAD && !VCS_STATUS_PUSH_COMMITS_BEHIND )) && res+=" "
  168. # ⇢42 if ahead of the push remote; no leading space if also behind: ⇠42⇢42.
  169. (( VCS_STATUS_PUSH_COMMITS_AHEAD )) && res+="${clean}${VCS_STATUS_PUSH_COMMITS_AHEAD}"
  170. # *42 if have stashes.
  171. (( VCS_STATUS_STASHES )) && res+=" ${clean}*${VCS_STATUS_STASHES}"
  172. # 'merge' if the repo is in an unusual state.
  173. [[ -n $VCS_STATUS_ACTION ]] && res+=" ${conflicted}${VCS_STATUS_ACTION}"
  174. # ~42 if have merge conflicts.
  175. (( VCS_STATUS_NUM_CONFLICTED )) && res+=" ${conflicted}~${VCS_STATUS_NUM_CONFLICTED}"
  176. # +42 if have staged changes.
  177. (( VCS_STATUS_NUM_STAGED )) && res+=" ${modified}+${VCS_STATUS_NUM_STAGED}"
  178. # !42 if have unstaged changes.
  179. (( VCS_STATUS_NUM_UNSTAGED )) && res+=" ${modified}!${VCS_STATUS_NUM_UNSTAGED}"
  180. # ?42 if have untracked files. It's really a question mark, your font isn't broken.
  181. # See POWERLEVEL9K_VCS_UNTRACKED_ICON above if you want to use a different icon.
  182. # Remove the next line if you don't want to see untracked files at all.
  183. (( VCS_STATUS_NUM_UNTRACKED )) && res+=" ${untracked}${(g::)POWERLEVEL9K_VCS_UNTRACKED_ICON}${VCS_STATUS_NUM_UNTRACKED}"
  184. # "─" if the number of unstaged files is unknown. This can happen due to
  185. # POWERLEVEL9K_VCS_MAX_INDEX_SIZE_DIRTY (see below) being set to a non-negative number lower
  186. # than the number of files in the Git index, or due to bash.showDirtyState being set to false
  187. # in the repository config. The number of staged and untracked files may also be unknown
  188. # in this case.
  189. (( VCS_STATUS_HAS_UNSTAGED == -1 )) && res+=" ${modified}"
  190. typeset -g my_git_format=$res
  191. }
  192. functions -M my_git_formatter 2>/dev/null
  193. # Don't count the number of unstaged, untracked and conflicted files in Git repositories with
  194. # more than this many files in the index. Negative value means infinity.
  195. #
  196. # If you are working in Git repositories with tens of millions of files and seeing performance
  197. # sagging, try setting POWERLEVEL9K_VCS_MAX_INDEX_SIZE_DIRTY to a number lower than the output
  198. # of `git ls-files | wc -l`. Alternatively, add `bash.showDirtyState = false` to the repository's
  199. # config: `git config bash.showDirtyState false`.
  200. typeset -g POWERLEVEL9K_VCS_MAX_INDEX_SIZE_DIRTY=-1
  201. # Don't show Git status in prompt for repositories whose workdir matches this pattern.
  202. # For example, if set to '~', the Git repository at $HOME/.git will be ignored.
  203. # Multiple patterns can be combined with '|': '~(|/foo)|/bar/baz/*'.
  204. typeset -g POWERLEVEL9K_VCS_DISABLED_WORKDIR_PATTERN='~'
  205. # Disable the default Git status formatting.
  206. typeset -g POWERLEVEL9K_VCS_DISABLE_GITSTATUS_FORMATTING=true
  207. # Install our own Git status formatter.
  208. typeset -g POWERLEVEL9K_VCS_CONTENT_EXPANSION='${$((my_git_formatter()))+${my_git_format}}'
  209. # Enable counters for staged, unstaged, etc.
  210. typeset -g POWERLEVEL9K_VCS_{STAGED,UNSTAGED,UNTRACKED,CONFLICTED,COMMITS_AHEAD,COMMITS_BEHIND}_MAX_NUM=-1
  211. # Custom icon.
  212. typeset -g POWERLEVEL9K_VCS_VISUAL_IDENTIFIER_EXPANSION=
  213. # Custom prefix.
  214. # typeset -g POWERLEVEL9K_VCS_PREFIX='on '
  215. # Show status of repositories of these types. You can add svn and/or hg if you are
  216. # using them. If you do, your prompt may become slow even when your current directory
  217. # isn't in an svn or hg reposotiry.
  218. typeset -g POWERLEVEL9K_VCS_BACKENDS=(git)
  219. #
  220. # Grey current time.
  221. typeset -g POWERLEVEL9K_TIME_FOREGROUND=$yellow
  222. # Format for the current time: 09:51:02. See `man 3 strftime`.
  223. typeset -g POWERLEVEL9K_TIME_FORMAT='%D{%H:%M:%S}'
  224. # If set to true, time will update when you hit enter. This way prompts for the past
  225. # commands will contain the start times of their commands rather than the end times of
  226. # their preceding commands.
  227. typeset -g POWERLEVEL9K_TIME_UPDATE_ON_COMMAND=false
  228. # Transient prompt works similarly to the builtin transient_rprompt option. It trims down prompt
  229. # when accepting a command line. Supported values:
  230. #
  231. # - off: Don't change prompt when accepting a command line.
  232. # - always: Trim down prompt when accepting a command line.
  233. # - same-dir: Trim down prompt when accepting a command line unless this is the first command
  234. # typed after changing current working directory.
  235. typeset -g POWERLEVEL9K_TRANSIENT_PROMPT=always
  236. # Instant prompt mode.
  237. #
  238. # - off: Disable instant prompt. Choose this if you've tried instant prompt and found
  239. # it incompatible with your zsh configuration files.
  240. # - quiet: Enable instant prompt and don't print warnings when detecting console output
  241. # during zsh initialization. Choose this if you've read and understood
  242. # https://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt.
  243. # - verbose: Enable instant prompt and print a warning when detecting console output during
  244. # zsh initialization. Choose this if you've never tried instant prompt, haven't
  245. # seen the warning, or if you are unsure what this all means.
  246. typeset -g POWERLEVEL9K_INSTANT_PROMPT=quiet
  247. # Hot reload allows you to change POWERLEVEL9K options after Powerlevel10k has been initialized.
  248. # For example, you can type POWERLEVEL9K_BACKGROUND=red and see your prompt turn red. Hot reload
  249. # can slow down prompt by 1-2 milliseconds, so it's better to keep it turned off unless you
  250. # really need it.
  251. typeset -g POWERLEVEL9K_DISABLE_HOT_RELOAD=true
  252. # If p10k is already loaded, reload configuration.
  253. # This works even with POWERLEVEL9K_DISABLE_HOT_RELOAD=true.
  254. (( ! $+functions[p10k] )) || p10k reload
  255. }
  256. # Tell `p10k configure` which file it should overwrite.
  257. typeset -g POWERLEVEL9K_CONFIG_FILE=${${(%):-%x}:a}
  258. (( ${#p10k_config_opts} )) && setopt ${p10k_config_opts[@]}
  259. 'builtin' 'unset' 'p10k_config_opts'