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.

83 lines
3.8 KiB

3 years ago
  1. # vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8
  2. ################################################################
  3. # Powerlevel10k Theme
  4. # https://github.com/romkatv/powerlevel10k
  5. #
  6. # Forked from Powerlevel9k Theme
  7. # https://github.com/bhilburn/powerlevel9k
  8. #
  9. # Which in turn was forked from Agnoster Theme
  10. # https://github.com/robbyrussell/oh-my-zsh/blob/74177c5320b2a1b2f8c4c695c05984b57fd7c6ea/themes/agnoster.zsh-theme
  11. ################################################################
  12. # Temporarily change options.
  13. 'builtin' 'local' '-a' '__p9k_src_opts'
  14. [[ ! -o 'aliases' ]] || __p9k_src_opts+=('aliases')
  15. [[ ! -o 'sh_glob' ]] || __p9k_src_opts+=('sh_glob')
  16. [[ ! -o 'no_brace_expand' ]] || __p9k_src_opts+=('no_brace_expand')
  17. 'builtin' 'setopt' 'no_aliases' 'no_sh_glob' 'brace_expand'
  18. (( $+__p9k_root_dir )) || typeset -gr __p9k_root_dir=${POWERLEVEL9K_INSTALLATION_DIR:-${${(%):-%x}:A:h}}
  19. (( $+__p9k_intro )) || {
  20. # Leading spaces before `local` are important. Otherwise Antigen will remove `local` (!!!).
  21. # __p9k_trapint is to work around bugs in zsh: https://www.zsh.org/mla/workers/2020/msg00612.html.
  22. # Likewise for `trap ":"` instead of the plain `trap ""`.
  23. typeset -gr __p9k_intro_base='emulate -L zsh -o no_hist_expand -o extended_glob -o no_prompt_bang -o prompt_percent -o no_prompt_subst -o no_aliases -o no_bg_nice -o typeset_silent -o no_rematch_pcre
  24. (( $+__p9k_trapped )) || { local -i __p9k_trapped; trap : INT; trap "trap ${(q)__p9k_trapint:--} INT" EXIT }
  25. local -a match mbegin mend
  26. local -i MBEGIN MEND OPTIND
  27. local MATCH OPTARG IFS=$'\'' \t\n\0'\'
  28. typeset -gr __p9k_intro_locale='[[ $langinfo[CODESET] != (utf|UTF)(-|)8 ]] && _p9k_init_locale && { [[ -n $LC_ALL ]] && local LC_ALL=$__p9k_locale || local LC_CTYPE=$__p9k_locale }'
  29. typeset -gr __p9k_intro_no_locale="${${__p9k_intro_base/ match / match reply }/ MATCH / MATCH REPLY }"
  30. typeset -gr __p9k_intro_no_reply="$__p9k_intro_base; $__p9k_intro_locale"
  31. typeset -gr __p9k_intro="$__p9k_intro_no_locale; $__p9k_intro_locale"
  32. }
  33. zmodload zsh/langinfo
  34. function _p9k_init_locale() {
  35. if (( ! $+__p9k_locale )); then
  36. typeset -g __p9k_locale=
  37. (( $+commands[locale] )) || return
  38. local -a loc
  39. loc=(${(@M)$(locale -a 2>/dev/null):#*.(utf|UTF)(-|)8}) || return
  40. (( $#loc )) || return
  41. typeset -g __p9k_locale=${loc[(r)(#i)C.UTF(-|)8]:-${loc[(r)(#i)en_US.UTF(-|)8]:-$loc[1]}}
  42. fi
  43. [[ -n $__p9k_locale ]]
  44. }
  45. () {
  46. eval "$__p9k_intro"
  47. if (( $+__p9k_sourced )); then
  48. (( $+functions[_p9k_setup] )) && _p9k_setup
  49. return 0
  50. fi
  51. typeset -gr __p9k_dump_file=${XDG_CACHE_HOME:-~/.cache}/p10k-dump-${(%):-%n}.zsh
  52. if [[ $__p9k_dump_file != $__p9k_instant_prompt_dump_file ]] && (( ! $+functions[_p9k_preinit] )) && source $__p9k_dump_file 2>/dev/null && (( $+functions[_p9k_preinit] )); then
  53. _p9k_preinit
  54. fi
  55. typeset -gr __p9k_sourced=13
  56. if [[ $ZSH_VERSION == (5.<1->*|<6->.*) ]]; then
  57. if [[ -w $__p9k_root_dir && -w $__p9k_root_dir/internal && -w $__p9k_root_dir/gitstatus ]]; then
  58. local f
  59. for f in $__p9k_root_dir/{powerlevel9k.zsh-theme,powerlevel10k.zsh-theme,internal/p10k.zsh,internal/icons.zsh,internal/configure.zsh,internal/worker.zsh,internal/parser.zsh,gitstatus/gitstatus.plugin.zsh,gitstatus/install}; do
  60. [[ $f.zwc -nt $f ]] && continue
  61. zmodload -F zsh/files b:zf_mv b:zf_rm
  62. local tmp=$f.tmp.$$.zwc
  63. {
  64. # `zf_mv -f src dst` fails on NTFS if `dst` is not writable, hence `zf_rm`.
  65. zf_rm -f -- $f.zwc && zcompile -R -- $tmp $f && zf_mv -f -- $tmp $f.zwc
  66. } always {
  67. (( $? )) && zf_rm -f -- $tmp
  68. }
  69. done
  70. fi
  71. fi
  72. builtin source $__p9k_root_dir/internal/p10k.zsh || true
  73. }
  74. (( $+__p9k_instant_prompt_active )) && unsetopt prompt_cr prompt_sp || setopt prompt_cr prompt_sp
  75. (( ${#__p9k_src_opts} )) && setopt ${__p9k_src_opts[@]}
  76. 'builtin' 'unset' '__p9k_src_opts'