mirror of
https://github.com/xsghetti/script.git
synced 2025-01-22 17:16:09 -05:00
restore zsh
This commit is contained in:
parent
49717d5bb4
commit
331bfe63e6
29 changed files with 23492 additions and 0 deletions
22
src/powerlevel10k/LICENSE
Normal file
22
src/powerlevel10k/LICENSE
Normal file
|
@ -0,0 +1,22 @@
|
|||
Copyright (c) 2009-2014 Robby Russell and contributors (see https://github.com/robbyrussell/oh-my-zsh/contributors)
|
||||
Copyright (c) 2014-2017 Ben Hilburn <bhilburn@gmail.com>
|
||||
Copyright (c) 2019 Roman Perepelitsa <roman.perepelitsa@gmail.com> and contributors (see https://github.com/romkatv/powerlevel10k/contributors)
|
||||
|
||||
MIT LICENSE
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
14
src/powerlevel10k/Makefile
Normal file
14
src/powerlevel10k/Makefile
Normal file
|
@ -0,0 +1,14 @@
|
|||
ZSH := $(shell command -v zsh 2> /dev/null)
|
||||
|
||||
all:
|
||||
|
||||
zwc:
|
||||
$(MAKE) -C gitstatus zwc
|
||||
$(or $(ZSH),:) -fc 'for f in *.zsh-theme internal/*.zsh; do zcompile -R -- $$f.zwc $$f || exit; done'
|
||||
|
||||
minify:
|
||||
$(MAKE) -C gitstatus minify
|
||||
rm -rf -- .git .gitattributes .gitignore LICENSE Makefile README.md font.md powerlevel10k.png
|
||||
|
||||
pkg: zwc
|
||||
$(MAKE) -C gitstatus pkg
|
2107
src/powerlevel10k/README.md
Normal file
2107
src/powerlevel10k/README.md
Normal file
File diff suppressed because it is too large
Load diff
1737
src/powerlevel10k/config/p10k-classic.zsh
Normal file
1737
src/powerlevel10k/config/p10k-classic.zsh
Normal file
File diff suppressed because it is too large
Load diff
1712
src/powerlevel10k/config/p10k-lean-8colors.zsh
Normal file
1712
src/powerlevel10k/config/p10k-lean-8colors.zsh
Normal file
File diff suppressed because it is too large
Load diff
1712
src/powerlevel10k/config/p10k-lean.zsh
Normal file
1712
src/powerlevel10k/config/p10k-lean.zsh
Normal file
File diff suppressed because it is too large
Load diff
193
src/powerlevel10k/config/p10k-pure.zsh
Normal file
193
src/powerlevel10k/config/p10k-pure.zsh
Normal file
|
@ -0,0 +1,193 @@
|
|||
# Config file for Powerlevel10k with the style of Pure (https://github.com/sindresorhus/pure).
|
||||
#
|
||||
# Differences from Pure:
|
||||
#
|
||||
# - Git:
|
||||
# - `@c4d3ec2c` instead of something like `v1.4.0~11` when in detached HEAD state.
|
||||
# - No automatic `git fetch` (the same as in Pure with `PURE_GIT_PULL=0`).
|
||||
#
|
||||
# Apart from the differences listed above, the replication of Pure prompt is exact. This includes
|
||||
# even the questionable parts. For example, just like in Pure, there is no indication of Git status
|
||||
# being stale; prompt symbol is the same in command, visual and overwrite vi modes; when prompt
|
||||
# doesn't fit on one line, it wraps around with no attempt to shorten it.
|
||||
#
|
||||
# If you like the general style of Pure but not particularly attached to all its quirks, type
|
||||
# `p10k configure` and pick "Lean" style. This will give you slick minimalist prompt while taking
|
||||
# advantage of Powerlevel10k features that aren't present in Pure.
|
||||
|
||||
# Temporarily change options.
|
||||
'builtin' 'local' '-a' 'p10k_config_opts'
|
||||
[[ ! -o 'aliases' ]] || p10k_config_opts+=('aliases')
|
||||
[[ ! -o 'sh_glob' ]] || p10k_config_opts+=('sh_glob')
|
||||
[[ ! -o 'no_brace_expand' ]] || p10k_config_opts+=('no_brace_expand')
|
||||
'builtin' 'setopt' 'no_aliases' 'no_sh_glob' 'brace_expand'
|
||||
|
||||
() {
|
||||
emulate -L zsh -o extended_glob
|
||||
|
||||
# Unset all configuration options.
|
||||
unset -m '(POWERLEVEL9K_*|DEFAULT_USER)~POWERLEVEL9K_GITSTATUS_DIR'
|
||||
|
||||
# Zsh >= 5.1 is required.
|
||||
[[ $ZSH_VERSION == (5.<1->*|<6->.*) ]] || return
|
||||
|
||||
# Prompt colors.
|
||||
local grey=242
|
||||
local red=1
|
||||
local yellow=3
|
||||
local blue=4
|
||||
local magenta=5
|
||||
local cyan=6
|
||||
local white=7
|
||||
|
||||
# Left prompt segments.
|
||||
typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(
|
||||
# =========================[ Line #1 ]=========================
|
||||
context # user@host
|
||||
dir # current directory
|
||||
vcs # git status
|
||||
command_execution_time # previous command duration
|
||||
# =========================[ Line #2 ]=========================
|
||||
newline # \n
|
||||
virtualenv # python virtual environment
|
||||
prompt_char # prompt symbol
|
||||
)
|
||||
|
||||
# Right prompt segments.
|
||||
typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(
|
||||
# =========================[ Line #1 ]=========================
|
||||
# command_execution_time # previous command duration
|
||||
# virtualenv # python virtual environment
|
||||
# context # user@host
|
||||
# time # current time
|
||||
# =========================[ Line #2 ]=========================
|
||||
newline # \n
|
||||
)
|
||||
|
||||
# Basic style options that define the overall prompt look.
|
||||
typeset -g POWERLEVEL9K_BACKGROUND= # transparent background
|
||||
typeset -g POWERLEVEL9K_{LEFT,RIGHT}_{LEFT,RIGHT}_WHITESPACE= # no surrounding whitespace
|
||||
typeset -g POWERLEVEL9K_{LEFT,RIGHT}_SUBSEGMENT_SEPARATOR=' ' # separate segments with a space
|
||||
typeset -g POWERLEVEL9K_{LEFT,RIGHT}_SEGMENT_SEPARATOR= # no end-of-line symbol
|
||||
typeset -g POWERLEVEL9K_VISUAL_IDENTIFIER_EXPANSION= # no segment icons
|
||||
|
||||
# Add an empty line before each prompt except the first. This doesn't emulate the bug
|
||||
# in Pure that makes prompt drift down whenever you use the Alt-C binding from fzf or similar.
|
||||
typeset -g POWERLEVEL9K_PROMPT_ADD_NEWLINE=true
|
||||
|
||||
# Magenta prompt symbol if the last command succeeded.
|
||||
typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_{VIINS,VICMD,VIVIS}_FOREGROUND=$magenta
|
||||
# Red prompt symbol if the last command failed.
|
||||
typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_{VIINS,VICMD,VIVIS}_FOREGROUND=$red
|
||||
# Default prompt symbol.
|
||||
typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIINS_CONTENT_EXPANSION='❯'
|
||||
# Prompt symbol in command vi mode.
|
||||
typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VICMD_CONTENT_EXPANSION='❮'
|
||||
# Prompt symbol in visual vi mode is the same as in command mode.
|
||||
typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIVIS_CONTENT_EXPANSION='❮'
|
||||
# Prompt symbol in overwrite vi mode is the same as in command mode.
|
||||
typeset -g POWERLEVEL9K_PROMPT_CHAR_OVERWRITE_STATE=false
|
||||
|
||||
# Grey Python Virtual Environment.
|
||||
typeset -g POWERLEVEL9K_VIRTUALENV_FOREGROUND=$grey
|
||||
# Don't show Python version.
|
||||
typeset -g POWERLEVEL9K_VIRTUALENV_SHOW_PYTHON_VERSION=false
|
||||
typeset -g POWERLEVEL9K_VIRTUALENV_{LEFT,RIGHT}_DELIMITER=
|
||||
|
||||
# Blue current directory.
|
||||
typeset -g POWERLEVEL9K_DIR_FOREGROUND=$blue
|
||||
|
||||
# Context format when root: user@host. The first part white, the rest grey.
|
||||
typeset -g POWERLEVEL9K_CONTEXT_ROOT_TEMPLATE="%F{$white}%n%f%F{$grey}@%m%f"
|
||||
# Context format when not root: user@host. The whole thing grey.
|
||||
typeset -g POWERLEVEL9K_CONTEXT_TEMPLATE="%F{$grey}%n@%m%f"
|
||||
# Don't show context unless root or in SSH.
|
||||
typeset -g POWERLEVEL9K_CONTEXT_{DEFAULT,SUDO}_CONTENT_EXPANSION=
|
||||
|
||||
# Show previous command duration only if it's >= 5s.
|
||||
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=5
|
||||
# Don't show fractional seconds. Thus, 7s rather than 7.3s.
|
||||
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=0
|
||||
# Duration format: 1d 2h 3m 4s.
|
||||
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FORMAT='d h m s'
|
||||
# Yellow previous command duration.
|
||||
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=$yellow
|
||||
|
||||
# Grey Git prompt. This makes stale prompts indistinguishable from up-to-date ones.
|
||||
typeset -g POWERLEVEL9K_VCS_FOREGROUND=$grey
|
||||
|
||||
# Disable async loading indicator to make directories that aren't Git repositories
|
||||
# indistinguishable from large Git repositories without known state.
|
||||
typeset -g POWERLEVEL9K_VCS_LOADING_TEXT=
|
||||
|
||||
# Don't wait for Git status even for a millisecond, so that prompt always updates
|
||||
# asynchronously when Git state changes.
|
||||
typeset -g POWERLEVEL9K_VCS_MAX_SYNC_LATENCY_SECONDS=0
|
||||
|
||||
# Cyan ahead/behind arrows.
|
||||
typeset -g POWERLEVEL9K_VCS_{INCOMING,OUTGOING}_CHANGESFORMAT_FOREGROUND=$cyan
|
||||
# Don't show remote branch, current tag or stashes.
|
||||
typeset -g POWERLEVEL9K_VCS_GIT_HOOKS=(vcs-detect-changes git-untracked git-aheadbehind)
|
||||
# Don't show the branch icon.
|
||||
typeset -g POWERLEVEL9K_VCS_BRANCH_ICON=
|
||||
# When in detached HEAD state, show @commit where branch normally goes.
|
||||
typeset -g POWERLEVEL9K_VCS_COMMIT_ICON='@'
|
||||
# Don't show staged, unstaged, untracked indicators.
|
||||
typeset -g POWERLEVEL9K_VCS_{STAGED,UNSTAGED,UNTRACKED}_ICON=
|
||||
# Show '*' when there are staged, unstaged or untracked files.
|
||||
typeset -g POWERLEVEL9K_VCS_DIRTY_ICON='*'
|
||||
# Show '⇣' if local branch is behind remote.
|
||||
typeset -g POWERLEVEL9K_VCS_INCOMING_CHANGES_ICON=':⇣'
|
||||
# Show '⇡' if local branch is ahead of remote.
|
||||
typeset -g POWERLEVEL9K_VCS_OUTGOING_CHANGES_ICON=':⇡'
|
||||
# Don't show the number of commits next to the ahead/behind arrows.
|
||||
typeset -g POWERLEVEL9K_VCS_{COMMITS_AHEAD,COMMITS_BEHIND}_MAX_NUM=1
|
||||
# Remove space between '⇣' and '⇡' and all trailing spaces.
|
||||
typeset -g POWERLEVEL9K_VCS_CONTENT_EXPANSION='${${${P9K_CONTENT/⇣* :⇡/⇣⇡}// }//:/ }'
|
||||
|
||||
# Grey current time.
|
||||
typeset -g POWERLEVEL9K_TIME_FOREGROUND=$grey
|
||||
# Format for the current time: 09:51:02. See `man 3 strftime`.
|
||||
typeset -g POWERLEVEL9K_TIME_FORMAT='%D{%H:%M:%S}'
|
||||
# If set to true, time will update when you hit enter. This way prompts for the past
|
||||
# commands will contain the start times of their commands rather than the end times of
|
||||
# their preceding commands.
|
||||
typeset -g POWERLEVEL9K_TIME_UPDATE_ON_COMMAND=false
|
||||
|
||||
# Transient prompt works similarly to the builtin transient_rprompt option. It trims down prompt
|
||||
# when accepting a command line. Supported values:
|
||||
#
|
||||
# - off: Don't change prompt when accepting a command line.
|
||||
# - always: Trim down prompt when accepting a command line.
|
||||
# - same-dir: Trim down prompt when accepting a command line unless this is the first command
|
||||
# typed after changing current working directory.
|
||||
typeset -g POWERLEVEL9K_TRANSIENT_PROMPT=off
|
||||
|
||||
# Instant prompt mode.
|
||||
#
|
||||
# - off: Disable instant prompt. Choose this if you've tried instant prompt and found
|
||||
# it incompatible with your zsh configuration files.
|
||||
# - quiet: Enable instant prompt and don't print warnings when detecting console output
|
||||
# during zsh initialization. Choose this if you've read and understood
|
||||
# https://github.com/romkatv/powerlevel10k#instant-prompt.
|
||||
# - verbose: Enable instant prompt and print a warning when detecting console output during
|
||||
# zsh initialization. Choose this if you've never tried instant prompt, haven't
|
||||
# seen the warning, or if you are unsure what this all means.
|
||||
typeset -g POWERLEVEL9K_INSTANT_PROMPT=verbose
|
||||
|
||||
# Hot reload allows you to change POWERLEVEL9K options after Powerlevel10k has been initialized.
|
||||
# For example, you can type POWERLEVEL9K_BACKGROUND=red and see your prompt turn red. Hot reload
|
||||
# can slow down prompt by 1-2 milliseconds, so it's better to keep it turned off unless you
|
||||
# really need it.
|
||||
typeset -g POWERLEVEL9K_DISABLE_HOT_RELOAD=true
|
||||
|
||||
# If p10k is already loaded, reload configuration.
|
||||
# This works even with POWERLEVEL9K_DISABLE_HOT_RELOAD=true.
|
||||
(( ! $+functions[p10k] )) || p10k reload
|
||||
}
|
||||
|
||||
# Tell `p10k configure` which file it should overwrite.
|
||||
typeset -g POWERLEVEL9K_CONFIG_FILE=${${(%):-%x}:a}
|
||||
|
||||
(( ${#p10k_config_opts} )) && setopt ${p10k_config_opts[@]}
|
||||
'builtin' 'unset' 'p10k_config_opts'
|
1835
src/powerlevel10k/config/p10k-rainbow.zsh
Normal file
1835
src/powerlevel10k/config/p10k-rainbow.zsh
Normal file
File diff suppressed because it is too large
Load diff
111
src/powerlevel10k/config/p10k-robbyrussell.zsh
Normal file
111
src/powerlevel10k/config/p10k-robbyrussell.zsh
Normal file
|
@ -0,0 +1,111 @@
|
|||
# Config file for Powerlevel10k with the style of robbyrussell theme from Oh My Zsh.
|
||||
#
|
||||
# Original: https://github.com/ohmyzsh/ohmyzsh/wiki/Themes#robbyrussell.
|
||||
#
|
||||
# Replication of robbyrussell theme is exact. The only observable difference is in
|
||||
# performance. Powerlevel10k prompt is very fast everywhere, even in large Git repositories.
|
||||
#
|
||||
# Usage: Source this file either before or after loading Powerlevel10k.
|
||||
#
|
||||
# source ~/powerlevel10k/config/p10k-robbyrussell.zsh
|
||||
# source ~/powerlevel10k/powerlevel10k.zsh-theme
|
||||
|
||||
# Temporarily change options.
|
||||
'builtin' 'local' '-a' 'p10k_config_opts'
|
||||
[[ ! -o 'aliases' ]] || p10k_config_opts+=('aliases')
|
||||
[[ ! -o 'sh_glob' ]] || p10k_config_opts+=('sh_glob')
|
||||
[[ ! -o 'no_brace_expand' ]] || p10k_config_opts+=('no_brace_expand')
|
||||
'builtin' 'setopt' 'no_aliases' 'no_sh_glob' 'brace_expand'
|
||||
|
||||
() {
|
||||
emulate -L zsh -o extended_glob
|
||||
|
||||
# Unset all configuration options.
|
||||
unset -m '(POWERLEVEL9K_*|DEFAULT_USER)~POWERLEVEL9K_GITSTATUS_DIR'
|
||||
|
||||
# Zsh >= 5.1 is required.
|
||||
[[ $ZSH_VERSION == (5.<1->*|<6->.*) ]] || return
|
||||
|
||||
# Left prompt segments.
|
||||
typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(prompt_char dir vcs)
|
||||
# Right prompt segments.
|
||||
typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=()
|
||||
|
||||
# Basic style options that define the overall prompt look.
|
||||
typeset -g POWERLEVEL9K_BACKGROUND= # transparent background
|
||||
typeset -g POWERLEVEL9K_{LEFT,RIGHT}_{LEFT,RIGHT}_WHITESPACE= # no surrounding whitespace
|
||||
typeset -g POWERLEVEL9K_{LEFT,RIGHT}_SUBSEGMENT_SEPARATOR=' ' # separate segments with a space
|
||||
typeset -g POWERLEVEL9K_{LEFT,RIGHT}_SEGMENT_SEPARATOR= # no end-of-line symbol
|
||||
typeset -g POWERLEVEL9K_VISUAL_IDENTIFIER_EXPANSION= # no segment icons
|
||||
|
||||
# Green prompt symbol if the last command succeeded.
|
||||
typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_{VIINS,VICMD,VIVIS}_FOREGROUND=green
|
||||
# Red prompt symbol if the last command failed.
|
||||
typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_{VIINS,VICMD,VIVIS}_FOREGROUND=red
|
||||
# Prompt symbol: bold arrow.
|
||||
typeset -g POWERLEVEL9K_PROMPT_CHAR_CONTENT_EXPANSION='%B➜ '
|
||||
|
||||
# Cyan current directory.
|
||||
typeset -g POWERLEVEL9K_DIR_FOREGROUND=cyan
|
||||
# Show only the last segment of the current directory.
|
||||
typeset -g POWERLEVEL9K_SHORTEN_STRATEGY=truncate_to_last
|
||||
# Bold directory.
|
||||
typeset -g POWERLEVEL9K_DIR_CONTENT_EXPANSION='%B$P9K_CONTENT'
|
||||
|
||||
# Git status formatter.
|
||||
function my_git_formatter() {
|
||||
emulate -L zsh
|
||||
if [[ -n $P9K_CONTENT ]]; then
|
||||
# If P9K_CONTENT is not empty, it's either "loading" or from vcs_info (not from
|
||||
# gitstatus plugin). VCS_STATUS_* parameters are not available in this case.
|
||||
typeset -g my_git_format=$P9K_CONTENT
|
||||
else
|
||||
# Use VCS_STATUS_* parameters to assemble Git status. See reference:
|
||||
# https://github.com/romkatv/gitstatus/blob/master/gitstatus.plugin.zsh.
|
||||
typeset -g my_git_format="${1+%B%4F}git:(${1+%1F}"
|
||||
my_git_format+=${${VCS_STATUS_LOCAL_BRANCH:-${VCS_STATUS_COMMIT[1,8]}}//\%/%%}
|
||||
my_git_format+="${1+%4F})"
|
||||
if (( VCS_STATUS_NUM_CONFLICTED || VCS_STATUS_NUM_STAGED ||
|
||||
VCS_STATUS_NUM_UNSTAGED || VCS_STATUS_NUM_UNTRACKED )); then
|
||||
my_git_format+=" ${1+%3F}✗"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
functions -M my_git_formatter 2>/dev/null
|
||||
|
||||
# Disable the default Git status formatting.
|
||||
typeset -g POWERLEVEL9K_VCS_DISABLE_GITSTATUS_FORMATTING=true
|
||||
# Install our own Git status formatter.
|
||||
typeset -g POWERLEVEL9K_VCS_CONTENT_EXPANSION='${$((my_git_formatter(1)))+${my_git_format}}'
|
||||
typeset -g POWERLEVEL9K_VCS_LOADING_CONTENT_EXPANSION='${$((my_git_formatter()))+${my_git_format}}'
|
||||
# Grey Git status when loading.
|
||||
typeset -g POWERLEVEL9K_VCS_LOADING_FOREGROUND=246
|
||||
|
||||
# Instant prompt mode.
|
||||
#
|
||||
# - off: Disable instant prompt. Choose this if you've tried instant prompt and found
|
||||
# it incompatible with your zsh configuration files.
|
||||
# - quiet: Enable instant prompt and don't print warnings when detecting console output
|
||||
# during zsh initialization. Choose this if you've read and understood
|
||||
# https://github.com/romkatv/powerlevel10k#instant-prompt.
|
||||
# - verbose: Enable instant prompt and print a warning when detecting console output during
|
||||
# zsh initialization. Choose this if you've never tried instant prompt, haven't
|
||||
# seen the warning, or if you are unsure what this all means.
|
||||
typeset -g POWERLEVEL9K_INSTANT_PROMPT=verbose
|
||||
|
||||
# Hot reload allows you to change POWERLEVEL9K options after Powerlevel10k has been initialized.
|
||||
# For example, you can type POWERLEVEL9K_BACKGROUND=red and see your prompt turn red. Hot reload
|
||||
# can slow down prompt by 1-2 milliseconds, so it's better to keep it turned off unless you
|
||||
# really need it.
|
||||
typeset -g POWERLEVEL9K_DISABLE_HOT_RELOAD=true
|
||||
|
||||
# If p10k is already loaded, reload configuration.
|
||||
# This works even with POWERLEVEL9K_DISABLE_HOT_RELOAD=true.
|
||||
(( ! $+functions[p10k] )) || p10k reload
|
||||
}
|
||||
|
||||
# Tell `p10k configure` which file it should overwrite.
|
||||
typeset -g POWERLEVEL9K_CONFIG_FILE=${${(%):-%x}:a}
|
||||
|
||||
(( ${#p10k_config_opts} )) && setopt ${p10k_config_opts[@]}
|
||||
'builtin' 'unset' 'p10k_config_opts'
|
167
src/powerlevel10k/font.md
Normal file
167
src/powerlevel10k/font.md
Normal file
|
@ -0,0 +1,167 @@
|
|||
# Recommended font: Meslo Nerd Font patched for Powerlevel10k
|
||||
|
||||
Gorgeous monospace font designed by Jim Lyles for Bitstream, customized by the same for Apple,
|
||||
further customized by André Berg, and finally patched by yours truly with customized scripts
|
||||
originally developed by Ryan L McIntyre of Nerd Fonts. Contains all glyphs and symbols that
|
||||
Powerlevel10k may need. Battle-tested in dozens of different terminals on all major operating
|
||||
systems.
|
||||
|
||||
*FAQ*: [How was the recommended font created?](README.md#how-was-the-recommended-font-created)
|
||||
|
||||
## Automatic font installation
|
||||
|
||||
If you are using iTerm2 or Termux, `p10k configure` can install the recommended font for you.
|
||||
Simply answer `Yes` when asked whether to install *Meslo Nerd Font*.
|
||||
|
||||
If you are using a different terminal, proceed with manual font installation. 👇
|
||||
|
||||
## Manual font installation
|
||||
|
||||
1. Download these four ttf files:
|
||||
- [MesloLGS NF Regular.ttf](
|
||||
https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Regular.ttf)
|
||||
- [MesloLGS NF Bold.ttf](
|
||||
https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold.ttf)
|
||||
- [MesloLGS NF Italic.ttf](
|
||||
https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Italic.ttf)
|
||||
- [MesloLGS NF Bold Italic.ttf](
|
||||
https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold%20Italic.ttf)
|
||||
1. Double-click on each file and click "Install". This will make `MesloLGS NF` font available to all
|
||||
applications on your system.
|
||||
1. Configure your terminal to use this font:
|
||||
- **iTerm2**: Type `p10k configure` and answer `Yes` when asked whether to install
|
||||
*Meslo Nerd Font*. Alternatively, open *iTerm2 → Preferences → Profiles → Text* and set *Font* to
|
||||
`MesloLGS NF`.
|
||||
- **Apple Terminal**: Open *Terminal → Preferences → Profiles → Text*, click *Change* under *Font*
|
||||
and select `MesloLGS NF` family.
|
||||
- **Hyper**: Open *Hyper → Edit → Preferences* and change the value of `fontFamily` under
|
||||
`module.exports.config` to `MesloLGS NF`.
|
||||
- **Visual Studio Code**: Open *File → Preferences → Settings* (PC) or
|
||||
*Code → Preferences → Settings* (Mac), enter `terminal.integrated.fontFamily` in the search box at
|
||||
the top of *Settings* tab and set the value below to `MesloLGS NF`.
|
||||
Consult [this screenshot](
|
||||
https://raw.githubusercontent.com/romkatv/powerlevel10k-media/389133fb8c9a2347929a23702ce3039aacc46c3d/visual-studio-code-font-settings.jpg)
|
||||
to see how it should look like or see [this issue](
|
||||
https://github.com/romkatv/powerlevel10k/issues/671) for extra information.
|
||||
- **GNOME Terminal** (the default Ubuntu terminal): Open *Terminal → Preferences* and click on the
|
||||
selected profile under *Profiles*. Check *Custom font* under *Text Appearance* and select
|
||||
`MesloLGS NF Regular`.
|
||||
- **Konsole**: Open *Settings → Edit Current Profile → Appearance*, click *Select Font* and select
|
||||
`MesloLGS NF Regular`.
|
||||
- **Tilix**: Open *Tilix → Preferences* and click on the selected profile under *Profiles*. Check
|
||||
*Custom font* under *Text Appearance* and select `MesloLGS NF Regular`.
|
||||
- **Windows Console Host** (the old thing): Click the icon in the top left corner, then
|
||||
*Properties → Font* and set *Font* to `MesloLGS NF`.
|
||||
- **Windows Terminal** by Microsoft (the new thing): Open *Settings* (<kbd>Ctrl+,</kbd>), click
|
||||
either on the selected profile under *Profiles* or on *Defaults*, click *Appearance* and set
|
||||
*Font face* to `MesloLGS NF`.
|
||||
- **Conemu**: Open *Setup → General → Fonts* and set *Main console font* to `MesloLGS NF`.
|
||||
- **IntelliJ** (and other IDEs by Jet Brains): Open *IDE → Edit → Preferences → Editor →
|
||||
Color Scheme → Console Font*. Select *Use console font instead of the default* and set the font
|
||||
name to `MesloLGS NF`.
|
||||
- **Termux**: Type `p10k configure` and answer `Yes` when asked whether to install
|
||||
*Meslo Nerd Font*.
|
||||
- **Blink**: Type `config`, go to *Appearance*, tap *Add a new font*, tap *Open Gallery*, select
|
||||
*MesloLGS NF.css*, tap *import* and type `exit` in the home view to reload the font.
|
||||
- **Tabby** (formerly **Terminus**): Open *Settings → Appearance* and set *Font* to `MesloLGS NF`.
|
||||
- **Terminator**: Open *Preferences* using the context menu. Under *Profiles* select the *General*
|
||||
tab (should be selected already), uncheck *Use the system fixed width font* (if not already)
|
||||
and select `MesloLGS NF Regular`. Exit the Preferences dialog by clicking *Close*.
|
||||
- **Guake**: Right Click on an open terminal and open *Preferences*. Under *Appearance*
|
||||
tab, uncheck *Use the system fixed width font* (if not already) and select `MesloLGS NF Regular`.
|
||||
Exit the Preferences dialog by clicking *Close*.
|
||||
- **MobaXterm**: Open *Settings* → *Configuration* → *Terminal* → (under *Terminal look and feel*)
|
||||
and change *Font* to `MesloLGS NF`. If you have *sessions*, you need to change the font in each
|
||||
of them through *Settings* → right click on an individual session → *Edit Session* → *Terminal
|
||||
Settings* → *Font settings*.
|
||||
- **Asbrú Connection Manager**: Open *Preferences → Local Shell Options → Look and Feel*, enable
|
||||
*Use these personal options* and change *Font:* under *Terminal UI* to `MesloLGS NF Regular`.
|
||||
To change the font for the remote host connections, go to *Preferences → Terminal Options →
|
||||
Look and Feel* and change *Font:* under *Terminal UI* to `MesloLGS NF Regular`.
|
||||
- **WSLtty**: Right click on an open terminal and then on *Options*. In the *Text* section, under
|
||||
*Font*, click *"Select..."* and set Font to `MesloLGS NF Regular`.
|
||||
- **Yakuake**: Click *≡* → *Manage Profiles* → *New* → *Appearance*. Click *Choose* next to the
|
||||
*Font* dropdown, select `MesloLGS NF` and click *OK*. Click *OK* to save the profile. Select the
|
||||
new profile and click *Set as Default*.
|
||||
- **Alacritty**: Create or open `~/.config/alacritty/alacritty.toml` and add the following
|
||||
section to it:
|
||||
```toml
|
||||
[font.normal]
|
||||
family = "MesloLGS NF"
|
||||
```
|
||||
- **foot**: Create or open `~/.config/foot/foot.ini` and add the following section to it:
|
||||
```ini
|
||||
font=MesloLGS NF:size=12
|
||||
```
|
||||
- **kitty**: Create or open `~/.config/kitty/kitty.conf` and add the following line to it:
|
||||
```text
|
||||
font_family MesloLGS NF
|
||||
```
|
||||
Restart kitty by closing all sessions and opening a new session.
|
||||
- **puTTY**: Set *Window* → *Appearance* → *Font* to `MesloLGS NF`. Requires puTTY
|
||||
version >= 0.75.
|
||||
- **WezTerm**: Create or open `$HOME/.config/wezterm/wezterm.lua` and add the following:
|
||||
```lua
|
||||
local wezterm = require 'wezterm';
|
||||
return {
|
||||
font = wezterm.font("MesloLGS NF"),
|
||||
}
|
||||
```
|
||||
If the file already exists, only add the line with the font to the existing return.
|
||||
Also add the first line if it is not already present.
|
||||
- **urxvt**: Create or open `~/.Xresources` and add the following line to it:
|
||||
```text
|
||||
URxvt.font: xft:MesloLGS NF:size=11
|
||||
```
|
||||
You can adjust the font size to your preference. After changing the config run
|
||||
`xrdb ~/.Xresources` to reload it. The new config is applied to all new terminals.
|
||||
- **xterm**: Create or open `~/.Xresources` and add the following line to it:
|
||||
```text
|
||||
xterm*faceName: MesloLGS NF
|
||||
```
|
||||
After changing the config run `xrdb ~/.Xresources` to reload it. The new config is applied to
|
||||
all new terminals.
|
||||
- **Zed**: Open `~/.config/zed/settings.json` and set `terminal.font_family` to `"MesloLGS NF"`.
|
||||
```jsonc
|
||||
{
|
||||
"terminal": {
|
||||
"font_family": "MesloLGS NF"
|
||||
},
|
||||
// Other settings.
|
||||
}
|
||||
```
|
||||
- Crostini (Linux on Chrome OS): Open
|
||||
chrome-untrusted://terminal/html/nassh_preferences_editor.html, set *Text font family* to
|
||||
`'MesloLGS NF'` (including the quotes) and *Custom CSS (inline text)* to the following:
|
||||
```css
|
||||
@font-face {
|
||||
font-family: "MesloLGS NF";
|
||||
src: url("https://raw.githubusercontent.com/romkatv/powerlevel10k-media/master/MesloLGS%20NF%20Regular.ttf");
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
@font-face {
|
||||
font-family: "MesloLGS NF";
|
||||
src: url("https://raw.githubusercontent.com/romkatv/powerlevel10k-media/master/MesloLGS%20NF%20Bold.ttf");
|
||||
font-weight: bold;
|
||||
font-style: normal;
|
||||
}
|
||||
@font-face {
|
||||
font-family: "MesloLGS NF";
|
||||
src: url("https://raw.githubusercontent.com/romkatv/powerlevel10k-media/master/MesloLGS%20NF%20Italic.ttf");
|
||||
font-weight: normal;
|
||||
font-style: italic;
|
||||
}
|
||||
@font-face {
|
||||
font-family: "MesloLGS NF";
|
||||
src: url("https://raw.githubusercontent.com/romkatv/powerlevel10k-media/master/MesloLGS%20NF%20Bold%20Italic.ttf");
|
||||
font-weight: bold;
|
||||
font-style: italic;
|
||||
}
|
||||
```
|
||||
**_CAVEAT_**: If you open the normal terminal preferences these settings will be overwritten.
|
||||
1. Run `p10k configure` to generate a new `~/.p10k.zsh`. The old config may work
|
||||
incorrectly with the new font.
|
||||
|
||||
_Using a different terminal and know how to set the font for it? Share your knowledge by sending a
|
||||
PR to expand the list!_
|
84
src/powerlevel10k/internal/configure.zsh
Normal file
84
src/powerlevel10k/internal/configure.zsh
Normal file
|
@ -0,0 +1,84 @@
|
|||
# Fewer than 47 columns will probably work. Haven't tried it.
|
||||
typeset -gr __p9k_wizard_columns=47
|
||||
# The bottleneck is ask_tails with nerd fonts. Everything else works fine with 12 lines.
|
||||
typeset -gr __p9k_wizard_lines=14
|
||||
typeset -gr __p9k_zd=${ZDOTDIR:-$HOME}
|
||||
typeset -gr __p9k_zd_u=${${${(q)__p9k_zd}/#(#b)${(q)HOME}(|\/*)/'~'$match[1]}//\%/%%}
|
||||
typeset -gr __p9k_zshrc=${${:-$__p9k_zd/.zshrc}:A}
|
||||
typeset -gr __p9k_zshrc_u=$__p9k_zd_u/.zshrc
|
||||
typeset -gr __p9k_root_dir_u=${${${(q)__p9k_root_dir}/#(#b)${(q)HOME}(|\/*)/'~'$match[1]}//\%/%%}
|
||||
|
||||
function _p9k_can_configure() {
|
||||
[[ $1 == '-q' ]] && local -i q=1 || local -i q=0
|
||||
function $0_error() {
|
||||
(( q )) || print -rP "%1F[ERROR]%f %Bp10k configure%b: $1" >&2
|
||||
}
|
||||
typeset -g __p9k_cfg_path_o=${POWERLEVEL9K_CONFIG_FILE:=${ZDOTDIR:-~}/.p10k.zsh}
|
||||
typeset -g __p9k_cfg_basename=${__p9k_cfg_path_o:t}
|
||||
typeset -g __p9k_cfg_path=${__p9k_cfg_path_o:A}
|
||||
typeset -g __p9k_cfg_path_u=${${${(q)__p9k_cfg_path_o}/#(#b)${(q)HOME}(|\/*)/'~'$match[1]}//\%/%%}
|
||||
{
|
||||
[[ -e $__p9k_zd ]] || { $0_error "$__p9k_zd_u does not exist"; return 1 }
|
||||
[[ -d $__p9k_zd ]] || { $0_error "$__p9k_zd_u is not a directory"; return 1 }
|
||||
[[ ! -d $__p9k_cfg_path ]] || { $0_error "$__p9k_cfg_path_u is a directory"; return 1 }
|
||||
[[ ! -d $__p9k_zshrc ]] || { $0_error "$__p9k_zshrc_u is a directory"; return 1 }
|
||||
|
||||
local dir=${__p9k_cfg_path:h}
|
||||
while [[ ! -e $dir && $dir != ${dir:h} ]]; do dir=${dir:h}; done
|
||||
if [[ ! -d $dir ]]; then
|
||||
$0_error "cannot create $__p9k_cfg_path_u because ${dir//\%/%%} is not a directory"
|
||||
return 1
|
||||
fi
|
||||
if [[ ! -w $dir ]]; then
|
||||
$0_error "cannot create $__p9k_cfg_path_u because ${dir//\%/%%} is readonly"
|
||||
return 1
|
||||
fi
|
||||
|
||||
[[ ! -e $__p9k_cfg_path || -f $__p9k_cfg_path || -h $__p9k_cfg_path ]] || {
|
||||
$0_error "$__p9k_cfg_path_u is a special file"
|
||||
return 1
|
||||
}
|
||||
[[ ! -e $__p9k_zshrc || -f $__p9k_zshrc || -h $__p9k_zshrc ]] || {
|
||||
$0_error "$__p9k_zshrc_u a special file"
|
||||
return 1
|
||||
}
|
||||
[[ ! -e $__p9k_zshrc || -r $__p9k_zshrc ]] || {
|
||||
$0_error "$__p9k_zshrc_u is not readable"
|
||||
return 1
|
||||
}
|
||||
local style
|
||||
for style in lean lean-8colors classic rainbow pure; do
|
||||
[[ -r $__p9k_root_dir/config/p10k-$style.zsh ]] || {
|
||||
$0_error "$__p9k_root_dir_u/config/p10k-$style.zsh is not readable"
|
||||
return 1
|
||||
}
|
||||
done
|
||||
|
||||
(( LINES >= __p9k_wizard_lines && COLUMNS >= __p9k_wizard_columns )) || {
|
||||
$0_error "terminal size too small; must be at least $__p9k_wizard_columns columns by $__p9k_wizard_lines lines"
|
||||
return 1
|
||||
}
|
||||
[[ -t 0 && -t 1 ]] || {
|
||||
$0_error "no TTY"
|
||||
return 2
|
||||
}
|
||||
return 0
|
||||
} always {
|
||||
unfunction $0_error
|
||||
}
|
||||
}
|
||||
|
||||
function p9k_configure() {
|
||||
eval "$__p9k_intro"
|
||||
_p9k_can_configure || return
|
||||
(
|
||||
set -- -f
|
||||
builtin source $__p9k_root_dir/internal/wizard.zsh
|
||||
)
|
||||
local ret=$?
|
||||
case $ret in
|
||||
0) builtin source $__p9k_cfg_path; _p9k__force_must_init=1;;
|
||||
69) return 0;;
|
||||
*) return $ret;;
|
||||
esac
|
||||
}
|
BIN
src/powerlevel10k/internal/configure.zsh.zwc
Normal file
BIN
src/powerlevel10k/internal/configure.zsh.zwc
Normal file
Binary file not shown.
1167
src/powerlevel10k/internal/icons.zsh
Normal file
1167
src/powerlevel10k/internal/icons.zsh
Normal file
File diff suppressed because it is too large
Load diff
BIN
src/powerlevel10k/internal/icons.zsh.zwc
Normal file
BIN
src/powerlevel10k/internal/icons.zsh.zwc
Normal file
Binary file not shown.
197
src/powerlevel10k/internal/notes.md
Normal file
197
src/powerlevel10k/internal/notes.md
Normal file
|
@ -0,0 +1,197 @@
|
|||
battery: use the same technique as in vpn_ip to avoid reset=2.
|
||||
|
||||
---
|
||||
|
||||
implement fake gitstatus api on top of vcs_info (or plain git?) + worker and use it if there is no
|
||||
gitstatus.
|
||||
|
||||
---
|
||||
|
||||
- call vcs_info on worker. the tricky question is what to display while "loading".
|
||||
|
||||
---
|
||||
|
||||
- add _SHOW_SYSTEM to all *env segments.
|
||||
|
||||
---
|
||||
|
||||
- support states in SHOW_ON_COMMAND: POWERLEVEL9K_SEGMENT_STATE_SHOW_ON_COMMAND='...'
|
||||
|
||||
---
|
||||
|
||||
add POWERLEVEL9K_${SEGMENT}_${STATE}_SHOW_IN_DIR='pwd_pattern'; implement the same way as
|
||||
SHOW_ON_UPGLOB. how should it interact with POWERLEVEL9K_${SEGMENT}_DISABLED_DIR_PATTERN?
|
||||
|
||||
---
|
||||
|
||||
add `p10k upglob`; returns 0 on match and sets REPLY to the directory where match was found.
|
||||
|
||||
---
|
||||
|
||||
when directory cannot be shortened any further, start chopping off segments from the left and
|
||||
replacing the chopped off part with `…`. e.g., `…/x/anchor/y/anchor`. the shortest dir
|
||||
representation is thus `…/last` or `…/last` depending on whether the last segment is an anchor.
|
||||
the replacement parameter's value is `…/` (with a slash) to allow for `x/anchor/y/anchor`.
|
||||
|
||||
---
|
||||
|
||||
- add to faq: how do i display an environment variable in prompt? link it from "extensible"
|
||||
|
||||
---
|
||||
|
||||
- add to faq: how do i display an icon in prompt? link it from "extensible"
|
||||
|
||||
---
|
||||
|
||||
- add root_indicator to config templates
|
||||
|
||||
---
|
||||
|
||||
- test chruby and add it to config templates
|
||||
|
||||
---
|
||||
|
||||
- add ssh to config templates
|
||||
|
||||
---
|
||||
|
||||
- add swift version to config templates; see if there is a good pattern for PROJECT_ONLY
|
||||
|
||||
---
|
||||
|
||||
- add swiftenv
|
||||
|
||||
---
|
||||
|
||||
- add faq: how to customize directory shortening? mention POWERLEVEL9K_DIR_TRUNCATE_BEFORE_MARKER,
|
||||
POWERLEVEL9K_DIR_MAX_LENGTH and co., and truncate_to_last.
|
||||
|
||||
---
|
||||
|
||||
fix a bug in zsh: https://github.com/romkatv/powerlevel10k/issues/502. to reproduce:
|
||||
|
||||
```zsh
|
||||
emulate zsh -o prompt_percent -c 'print -P "%F{#ff0000}red%F{green}%B bold green"'
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
add `p10k explain` that prints something like this:
|
||||
|
||||
```text
|
||||
segment icons meaning
|
||||
|
||||
---
|
||||
|
||||
---
|
||||
|
||||
---
|
||||
|
||||
---
|
||||
|
||||
---
|
||||
|
||||
---
|
||||
|
||||
---
|
||||
|
||||
---
|
||||
--
|
||||
status ✔ ✘ exit code of the last command
|
||||
```
|
||||
|
||||
implement it the hard way: for every enabled segment go over all its {state,icon} pairs, resolve
|
||||
the icon (if not absolute), apply VISUAL_IDENTIFIER_EXPANSION, remove leading and trailing
|
||||
whitespace and print without formatting (sort of like `print -P | cat`); print segment names in
|
||||
green and icons in bold; battery can have an unlimited number of icons, so `...` would be needed
|
||||
(based on total length of concatenated icons rather than the number of icons); user-defined
|
||||
segments would have "unknown" icons by default (yellow and not bold); can allow them to
|
||||
participate by defining `explainprompt_foo` that populates array `reply` with strings like this:
|
||||
'-s STATE -i LOCK_ICON +r'; the first element must be segment description.
|
||||
|
||||
---
|
||||
|
||||
add `docker_context` prompt segment; similar to `kubecontext`; the data should come from
|
||||
`currentContext` field in `~/.docker/config.json` (according to
|
||||
https://github.com/starship/starship/issues/995); there is also `DOCKER_CONTEXT`; more info:
|
||||
https://docs.docker.com/engine/reference/commandline/context_use; also
|
||||
https://github.com/starship/starship/pull/996.
|
||||
|
||||
---
|
||||
|
||||
support `env`, `ionice` and `strace` precommands in `parser.zsh`.
|
||||
|
||||
---
|
||||
|
||||
Add ruler to configuration wizard. Options: `─`, `·`, `╌`, `┄`, `▁`, `═`.
|
||||
|
||||
---
|
||||
|
||||
Add frame styles to the wizard.
|
||||
|
||||
```text
|
||||
╭─
|
||||
╰─
|
||||
|
||||
┌─
|
||||
└─
|
||||
|
||||
┏━
|
||||
┗━
|
||||
|
||||
╔═
|
||||
╚═
|
||||
|
||||
▛▀
|
||||
▙▄
|
||||
```
|
||||
|
||||
Prompt connection should have matching options.
|
||||
|
||||
---
|
||||
|
||||
Add `POWERLEVEL9K_{LEFT,RIGHT}_SEGMENT_MIRROR_SEPARATOR`. If set, left segments get separated with
|
||||
`POWERLEVEL9K_LEFT_SEGMENT_SEPARATOR` followed by `POWERLEVEL9K_LEFT_SEGMENT_MIRROR_SEPARATOR`.
|
||||
Each is drawn without background. The first with the foreground of left segment, the second with
|
||||
the background of right segment. To insert space in between, embed it in
|
||||
`POWERLEVEL9K_{LEFT,RIGHT}_SEGMENT_MIRROR_SEPARATOR`.
|
||||
`POWERLEVEL9K_{LEFT,RIGHT}_SUBSEGMENT_SEPARATOR` is unused.
|
||||
|
||||
---
|
||||
|
||||
Add *Segment Connection* screen to configuration wizard with options *Fused*, *Touching* and
|
||||
*Disjoint*. The last two differ by the absence/presence of space between `SEGMENT_SEPARATOR` and
|
||||
`SEGMENT_MIRROR_SEPARATOR`.
|
||||
|
||||
*Fused* requires line separator (there is already a screen for it) but the other two options require
|
||||
two filled separators similar to heads and tail. Figure out how to present this choice.
|
||||
|
||||
---
|
||||
|
||||
Optimize auto-wizard check.
|
||||
|
||||
```text
|
||||
time ( repeat 1000 [[ -z "${parameters[(I)POWERLEVEL9K_*~(POWERLEVEL9K_MODE|POWERLEVEL9K_CONFIG_FILE)]}" ]] )
|
||||
user=0.21s system=0.05s cpu=99% total=0.264
|
||||
|
||||
time ( repeat 1000 [[ -z "${parameters[(I)POWERLEVEL9K_*]}" ]] )
|
||||
user=0.17s system=0.00s cpu=99% total=0.175
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
Add the equivalent of `P9K_PYTHON_VERSION` to all `*env` segments where it makes sense.
|
||||
|
||||
---
|
||||
|
||||
Define `P9K_ICON` on initialization. Fill it with `$icon`. Duplicate every key that ends in `_ICON`.
|
||||
Respect `POWERLEVEL9K_VCS_STASH_ICON` overrides but not anything with segment name or state.
|
||||
|
||||
Define `POWERLEVEL9K_VCS_*` parameters in config templates for all symbols used in
|
||||
`my_git_formatter`. Add missing entries to `icons`. Use `$P9K_ICON[...]` within `my_git_formatter`.
|
||||
Add a screen to the wizard to choose between clear and circled icons.
|
||||
|
||||
---
|
||||
|
||||
Add a screen to the wizard asking whether to set `POWERLEVEL9K_VCS_DISABLED_WORKDIR_PATTERN='~'`.
|
||||
Show it only if there is `$HOME/.git`. By default this parameter should be commented out.
|
9491
src/powerlevel10k/internal/p10k.zsh
Normal file
9491
src/powerlevel10k/internal/p10k.zsh
Normal file
File diff suppressed because it is too large
Load diff
BIN
src/powerlevel10k/internal/p10k.zsh.zwc
Normal file
BIN
src/powerlevel10k/internal/p10k.zsh.zwc
Normal file
Binary file not shown.
382
src/powerlevel10k/internal/parser.zsh
Normal file
382
src/powerlevel10k/internal/parser.zsh
Normal file
|
@ -0,0 +1,382 @@
|
|||
typeset -grA __p9k_pb_cmd_skip=(
|
||||
'}' 'always' # handled specially
|
||||
'{' ''
|
||||
'{' ''
|
||||
'|' ''
|
||||
'||' ''
|
||||
'&' ''
|
||||
'&&' ''
|
||||
'|&' ''
|
||||
'&!' ''
|
||||
'&|' ''
|
||||
')' ''
|
||||
'(' ''
|
||||
'()' ''
|
||||
'!' ''
|
||||
';' ''
|
||||
'if' ''
|
||||
'fi' ''
|
||||
'elif' ''
|
||||
'else' ''
|
||||
'then' ''
|
||||
'while' ''
|
||||
'until' ''
|
||||
'do' ''
|
||||
'done' ''
|
||||
'esac' ''
|
||||
'end' ''
|
||||
'coproc' ''
|
||||
'nocorrect' ''
|
||||
'noglob' ''
|
||||
'time' ''
|
||||
'[[' '\]\]'
|
||||
'((' '\)\)'
|
||||
'case' '\)|esac'
|
||||
';;' '\)|esac'
|
||||
';&' '\)|esac'
|
||||
';|' '\)|esac'
|
||||
'foreach' '\(*\)'
|
||||
)
|
||||
|
||||
typeset -grA __p9k_pb_precommand=(
|
||||
'-' ''
|
||||
'builtin' ''
|
||||
'command' ''
|
||||
'exec' '-[^a]#[a]'
|
||||
'nohup' ''
|
||||
'setsid' ''
|
||||
'eatmydata' ''
|
||||
'catchsegv' ''
|
||||
'pkexec' '--user'
|
||||
'doas' '-[^aCu]#[acU]'
|
||||
'nice' '-[^n]#[n]|--adjustment'
|
||||
'stdbuf' '-[^ioe]#[ioe]|--(input|output|error)'
|
||||
'sudo' '-[^aghpuUCcrtT]#[aghpuUCcrtT]|--(close-from|group|host|prompt|role|type|other-user|command-timeout|user)'
|
||||
'ssh-agent' '-[^aEPt]#[aEPt]'
|
||||
'tabbed' '-[^gnprtTuU]#[gnprtTuU]'
|
||||
'chronic' ''
|
||||
'ifne' ''
|
||||
)
|
||||
|
||||
typeset -grA __p9k_pb_redirect=(
|
||||
'&>' ''
|
||||
'>' ''
|
||||
'>&' ''
|
||||
'<' ''
|
||||
'<&' ''
|
||||
'<>' ''
|
||||
'&>|' ''
|
||||
'>|' ''
|
||||
'&>>' ''
|
||||
'>>' ''
|
||||
'>>&' ''
|
||||
'&>>|' ''
|
||||
'>>|' ''
|
||||
'<<<' ''
|
||||
)
|
||||
|
||||
typeset -grA __p9k_pb_term=(
|
||||
'|' ''
|
||||
'||' ''
|
||||
';' ''
|
||||
'&' ''
|
||||
'&&' ''
|
||||
'|&' ''
|
||||
'&!' ''
|
||||
'&|' ''
|
||||
';;' ''
|
||||
';&' ''
|
||||
';|' ''
|
||||
'(' ''
|
||||
')' ''
|
||||
'()' '' # handled specially
|
||||
'}' '' # handled specially
|
||||
)
|
||||
|
||||
typeset -grA __p9k_pb_term_skip=(
|
||||
'(' '\)'
|
||||
';;' '\)|esac'
|
||||
';&' '\)|esac'
|
||||
';|' '\)|esac'
|
||||
)
|
||||
|
||||
# Usage: _p9k_parse_buffer <buffer> [token-limit]
|
||||
#
|
||||
# Parses the specified command line buffer and pupulates array P9K_COMMANDS
|
||||
# with commands from it. Terminates early and returns 1 if there are more
|
||||
# tokens than the specified limit.
|
||||
#
|
||||
# Broken:
|
||||
#
|
||||
# ---------------
|
||||
# : $(x)
|
||||
# ---------------
|
||||
# : `x`
|
||||
# ---------------
|
||||
# ${x/}
|
||||
# ---------------
|
||||
# - -- x
|
||||
# ---------------
|
||||
# command -p -p x
|
||||
# ---------------
|
||||
# *
|
||||
# ---------------
|
||||
# x=$y; $x
|
||||
# ---------------
|
||||
# alias x=y; y
|
||||
# ---------------
|
||||
# x <<END
|
||||
# ; END
|
||||
# END
|
||||
# ---------------
|
||||
# Setup:
|
||||
# setopt interactive_comments
|
||||
# alias x='#'
|
||||
# Punchline:
|
||||
# x; y
|
||||
# ---------------
|
||||
#
|
||||
# More brokenness with non-standard options (ignore_braces, ignore_close_braces, etc.).
|
||||
function _p9k_parse_buffer() {
|
||||
[[ ${2:-0} == <-> ]] || return 2
|
||||
|
||||
local rcquotes
|
||||
[[ -o rcquotes ]] && rcquotes=rcquotes
|
||||
|
||||
eval "$__p9k_intro"
|
||||
setopt no_nomatch $rcquotes
|
||||
|
||||
typeset -ga P9K_COMMANDS=()
|
||||
|
||||
local -r id='(<->|[[:alpha:]_][[:IDENT:]]#)'
|
||||
local -r var="\$$id|\${$id}|\"\$$id\"|\"\${$id}\""
|
||||
|
||||
local -i e ic c=${2:-'1 << 62'}
|
||||
local skip n s r state token cmd prev
|
||||
local -a aln alp alf v
|
||||
|
||||
if [[ -o interactive_comments ]]; then
|
||||
ic=1
|
||||
local tokens=(${(Z+C+)1})
|
||||
else
|
||||
local tokens=(${(z)1})
|
||||
fi
|
||||
|
||||
{
|
||||
while (( $#tokens )); do
|
||||
(( e = $#state ))
|
||||
|
||||
while (( $#tokens == alp[-1] )); do
|
||||
aln[-1]=()
|
||||
alp[-1]=()
|
||||
if (( $#tokens == alf[-1] )); then
|
||||
alf[-1]=()
|
||||
(( e = 0 ))
|
||||
fi
|
||||
done
|
||||
|
||||
while (( c-- > 0 )) || return; do
|
||||
token=$tokens[1]
|
||||
tokens[1]=()
|
||||
if (( $+galiases[$token] )); then
|
||||
(( $aln[(eI)p$token] )) && break
|
||||
s=$galiases[$token]
|
||||
n=p$token
|
||||
elif (( e )); then
|
||||
break
|
||||
elif (( $+aliases[$token] )); then
|
||||
(( $aln[(eI)p$token] )) && break
|
||||
s=$aliases[$token]
|
||||
n=p$token
|
||||
elif [[ $token == ?*.?* ]] && (( $+saliases[${token##*.}] )); then
|
||||
r=${token##*.}
|
||||
(( $aln[(eI)s$r] )) && break
|
||||
s=${saliases[$r]%% #}
|
||||
n=s$r
|
||||
else
|
||||
break
|
||||
fi
|
||||
aln+=$n
|
||||
alp+=$#tokens
|
||||
[[ $s == *' ' ]] && alf+=$#tokens
|
||||
(( ic )) && tokens[1,0]=(${(Z+C+)s}) || tokens[1,0]=(${(z)s})
|
||||
done
|
||||
|
||||
case $token in
|
||||
'<<'(|-))
|
||||
state=h
|
||||
continue
|
||||
;;
|
||||
*('`'|['<>=$']'(')*)
|
||||
if [[ $token == ('`'[^'`']##'`'|'"`'[^'`']##'`"'|'$('[^')']##')'|'"$('[^')']##')"'|['<>=']'('[^')']##')') ]]; then
|
||||
s=${${token##('"'|)(['$<>']|)?}%%?('"'|)}
|
||||
(( ic )) && tokens+=(';' ${(Z+C+)s}) || tokens+=(';' ${(z)s})
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
case $state in
|
||||
*r)
|
||||
state[-1]=
|
||||
continue
|
||||
;;
|
||||
a)
|
||||
if [[ $token == $skip ]]; then
|
||||
if [[ $token == '{' ]]; then
|
||||
P9K_COMMANDS+=$cmd
|
||||
cmd=
|
||||
state=
|
||||
else
|
||||
skip='{'
|
||||
fi
|
||||
continue
|
||||
else
|
||||
state=t
|
||||
fi
|
||||
;& # fall through
|
||||
t|p*)
|
||||
if (( $+__p9k_pb_term[$token] )); then
|
||||
if [[ $token == '()' ]]; then
|
||||
state=
|
||||
else
|
||||
P9K_COMMANDS+=$cmd
|
||||
if [[ $token == '}' ]]; then
|
||||
state=a
|
||||
skip=always
|
||||
else
|
||||
skip=$__p9k_pb_term_skip[$token]
|
||||
state=${skip:+s}
|
||||
fi
|
||||
fi
|
||||
cmd=
|
||||
continue
|
||||
elif [[ $state == t ]]; then
|
||||
continue
|
||||
elif [[ $state == *x ]]; then
|
||||
if (( $+__p9k_pb_redirect[$token] )); then
|
||||
prev=
|
||||
state[-1]=r
|
||||
continue
|
||||
else
|
||||
state[-1]=
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
s)
|
||||
if [[ $token == $~skip ]]; then
|
||||
state=
|
||||
fi
|
||||
continue
|
||||
;;
|
||||
h)
|
||||
while (( $#tokens )); do
|
||||
(( e = ${tokens[(i)${(Q)token}]} ))
|
||||
if [[ $tokens[e-1] == ';' && $tokens[e+1] == ';' ]]; then
|
||||
tokens[1,e]=()
|
||||
break
|
||||
else
|
||||
tokens[1,e]=()
|
||||
fi
|
||||
done
|
||||
while (( $#alp && alp[-1] >= $#tokens )); do
|
||||
aln[-1]=()
|
||||
alp[-1]=()
|
||||
done
|
||||
state=t
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
|
||||
if (( $+__p9k_pb_redirect[${token#<0-255>}] )); then
|
||||
state+=r
|
||||
continue
|
||||
fi
|
||||
|
||||
if [[ $token == *'$'* ]]; then
|
||||
if [[ $token == $~var ]]; then
|
||||
n=${${token##[^[:IDENT:]]}%%[^[:IDENT:]]}
|
||||
[[ $token == *'"' ]] && v=("${(P)n}") || v=(${(P)n})
|
||||
tokens[1,0]=(${(@qq)v})
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
|
||||
case $state in
|
||||
'')
|
||||
if (( $+__p9k_pb_cmd_skip[$token] )); then
|
||||
skip=$__p9k_pb_cmd_skip[$token]
|
||||
[[ $token == '}' ]] && state=a || state=${skip:+s}
|
||||
continue
|
||||
fi
|
||||
if [[ $token == *=* ]]; then
|
||||
v=${(S)token/#(<->|([[:alpha:]_][[:IDENT:]]#(|'['*[^\\](\\\\)#']')))(|'+')=}
|
||||
if (( $#v < $#token )); then
|
||||
if [[ $v == '(' ]]; then
|
||||
state=s
|
||||
skip='\)'
|
||||
fi
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
: ${token::=${(Q)${~token}}}
|
||||
;;
|
||||
p2)
|
||||
if [[ -n $prev ]]; then
|
||||
prev=
|
||||
else
|
||||
: ${token::=${(Q)${~token}}}
|
||||
if [[ $token == '{'$~id'}' ]]; then
|
||||
state=p2x
|
||||
prev=$token
|
||||
else
|
||||
state=p
|
||||
fi
|
||||
continue
|
||||
fi
|
||||
;& # fall through
|
||||
p)
|
||||
if [[ -n $prev ]]; then
|
||||
token=$prev
|
||||
prev=
|
||||
else
|
||||
: ${token::=${(Q)${~token}}}
|
||||
case $token in
|
||||
'{'$~id'}') prev=$token; state=px; continue;;
|
||||
[^-]*) ;;
|
||||
--) state=p1; continue;;
|
||||
$~skip) state=p2; continue;;
|
||||
*) continue;;
|
||||
esac
|
||||
fi
|
||||
;;
|
||||
p1)
|
||||
if [[ -n $prev ]]; then
|
||||
token=$prev
|
||||
prev=
|
||||
else
|
||||
: ${token::=${(Q)${~token}}}
|
||||
if [[ $token == '{'$~id'}' ]]; then
|
||||
state=p1x
|
||||
prev=$token
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if (( $+__p9k_pb_precommand[$token] )); then
|
||||
prev=
|
||||
state=p
|
||||
skip=$__p9k_pb_precommand[$token]
|
||||
cmd+=$token$'\0'
|
||||
else
|
||||
state=t
|
||||
[[ $token == ('(('*'))'|'`'*'`'|'$'*|['<>=']'('*')'|*$'\0'*) ]] || cmd+=$token$'\0'
|
||||
fi
|
||||
done
|
||||
} always {
|
||||
[[ $state == (px|p1x) ]] && cmd+=$prev
|
||||
P9K_COMMANDS+=$cmd
|
||||
P9K_COMMANDS=(${(u)P9K_COMMANDS%$'\0'})
|
||||
}
|
||||
}
|
BIN
src/powerlevel10k/internal/parser.zsh.zwc
Normal file
BIN
src/powerlevel10k/internal/parser.zsh.zwc
Normal file
Binary file not shown.
2256
src/powerlevel10k/internal/wizard.zsh
Normal file
2256
src/powerlevel10k/internal/wizard.zsh
Normal file
File diff suppressed because it is too large
Load diff
219
src/powerlevel10k/internal/worker.zsh
Normal file
219
src/powerlevel10k/internal/worker.zsh
Normal file
|
@ -0,0 +1,219 @@
|
|||
# invoked in worker: _p9k_worker_main <pgid>
|
||||
function _p9k_worker_main() {
|
||||
mkfifo -- $_p9k__worker_file_prefix.fifo || return
|
||||
echo -nE - s$_p9k_worker_pgid$'\x1e' || return
|
||||
exec <$_p9k__worker_file_prefix.fifo || return
|
||||
zf_rm -- $_p9k__worker_file_prefix.fifo || return
|
||||
|
||||
local -i reset
|
||||
local req fd
|
||||
local -a ready
|
||||
local _p9k_worker_request_id
|
||||
local -A _p9k_worker_fds # fd => id$'\x1f'callback
|
||||
local -A _p9k_worker_inflight # id => inflight count
|
||||
|
||||
function _p9k_worker_reply() {
|
||||
print -nr -- e${(pj:\n:)@}$'\x1e' || kill -- -$_p9k_worker_pgid
|
||||
}
|
||||
|
||||
# usage: _p9k_worker_async <work> <callback>
|
||||
function _p9k_worker_async() {
|
||||
local fd async=$1
|
||||
sysopen -r -o cloexec -u fd <(() { eval $async; } && print -n '\x1e') || return
|
||||
(( ++_p9k_worker_inflight[$_p9k_worker_request_id] ))
|
||||
_p9k_worker_fds[$fd]=$_p9k_worker_request_id$'\x1f'$2
|
||||
}
|
||||
|
||||
trap '' PIPE
|
||||
|
||||
{
|
||||
while zselect -a ready 0 ${(k)_p9k_worker_fds}; do
|
||||
[[ $ready[1] == -r ]] || return
|
||||
for fd in ${ready:1}; do
|
||||
if [[ $fd == 0 ]]; then
|
||||
local buf=
|
||||
[[ -t 0 ]] # https://www.zsh.org/mla/workers/2020/msg00207.html
|
||||
if sysread -t 0 'buf[$#buf+1]'; then
|
||||
while [[ $buf != *$'\x1e' ]]; do
|
||||
sysread 'buf[$#buf+1]' || return
|
||||
done
|
||||
else
|
||||
(( $? == 4 )) || return
|
||||
fi
|
||||
for req in ${(ps:\x1e:)buf}; do
|
||||
_p9k_worker_request_id=${req%%$'\x1f'*}
|
||||
() { eval $req[$#_p9k_worker_request_id+2,-1] }
|
||||
(( $+_p9k_worker_inflight[$_p9k_worker_request_id] )) && continue
|
||||
print -rn -- d$_p9k_worker_request_id$'\x1e' || return
|
||||
done
|
||||
else
|
||||
local REPLY=
|
||||
while true; do
|
||||
if sysread -i $fd 'REPLY[$#REPLY+1]'; then
|
||||
[[ $REPLY == *$'\x1e' ]] || continue
|
||||
else
|
||||
(( $? == 5 )) || return
|
||||
break
|
||||
fi
|
||||
done
|
||||
local cb=$_p9k_worker_fds[$fd]
|
||||
_p9k_worker_request_id=${cb%%$'\x1f'*}
|
||||
unset "_p9k_worker_fds[$fd]"
|
||||
exec {fd}>&-
|
||||
if [[ $REPLY == *$'\x1e' ]]; then
|
||||
REPLY[-1]=""
|
||||
() { eval $cb[$#_p9k_worker_request_id+2,-1] }
|
||||
fi
|
||||
if (( --_p9k_worker_inflight[$_p9k_worker_request_id] == 0 )); then
|
||||
unset "_p9k_worker_inflight[$_p9k_worker_request_id]"
|
||||
print -rn -- d$_p9k_worker_request_id$'\x1e' || return
|
||||
fi
|
||||
fi
|
||||
done
|
||||
done
|
||||
} always {
|
||||
kill -- -$_p9k_worker_pgid
|
||||
}
|
||||
}
|
||||
|
||||
# invoked in master: _p9k_worker_invoke <request-id> <list>
|
||||
function _p9k_worker_invoke() {
|
||||
[[ -n $_p9k__worker_resp_fd ]] || return
|
||||
local req=$1$'\x1f'$2$'\x1e'
|
||||
if [[ -n $_p9k__worker_req_fd && $+_p9k__worker_request_map[$1] == 0 ]]; then
|
||||
_p9k__worker_request_map[$1]=
|
||||
print -rnu $_p9k__worker_req_fd -- $req
|
||||
else
|
||||
_p9k__worker_request_map[$1]=$req
|
||||
fi
|
||||
}
|
||||
|
||||
function _p9k_worker_cleanup() {
|
||||
# __p9k_intro bugs out here in some cases for some reason.
|
||||
emulate -L zsh
|
||||
[[ $_p9k__worker_shell_pid == $sysparams[pid] ]] && _p9k_worker_stop
|
||||
return 0
|
||||
}
|
||||
|
||||
function _p9k_worker_stop() {
|
||||
# See comments in _p9k_worker_cleanup.
|
||||
emulate -L zsh
|
||||
add-zsh-hook -D zshexit _p9k_worker_cleanup
|
||||
[[ -n $_p9k__worker_resp_fd ]] && zle -F $_p9k__worker_resp_fd
|
||||
[[ -n $_p9k__worker_resp_fd ]] && exec {_p9k__worker_resp_fd}>&-
|
||||
[[ -n $_p9k__worker_req_fd ]] && exec {_p9k__worker_req_fd}>&-
|
||||
[[ -n $_p9k__worker_pid ]] && kill -- -$_p9k__worker_pid 2>/dev/null
|
||||
[[ -n $_p9k__worker_file_prefix ]] && zf_rm -f -- $_p9k__worker_file_prefix.fifo
|
||||
_p9k__worker_pid=
|
||||
_p9k__worker_req_fd=
|
||||
_p9k__worker_resp_fd=
|
||||
_p9k__worker_shell_pid=
|
||||
_p9k__worker_request_map=()
|
||||
return 0
|
||||
}
|
||||
|
||||
function _p9k_worker_receive() {
|
||||
eval "$__p9k_intro"
|
||||
|
||||
[[ -z $_p9k__worker_resp_fd ]] && return
|
||||
|
||||
{
|
||||
(( $# <= 1 )) || return
|
||||
|
||||
local buf resp
|
||||
|
||||
[[ -t $_p9k__worker_resp_fd ]] # https://www.zsh.org/mla/workers/2020/msg00207.html
|
||||
if sysread -i $_p9k__worker_resp_fd -t 0 'buf[$#buf+1]'; then
|
||||
while [[ $buf == *[^$'\x05\x1e']$'\x05'# ]]; do
|
||||
sysread -i $_p9k__worker_resp_fd 'buf[$#buf+1]' || return
|
||||
done
|
||||
else
|
||||
(( $? == 4 )) || return
|
||||
fi
|
||||
|
||||
local -i reset max_reset
|
||||
for resp in ${(ps:\x1e:)${buf//$'\x05'}}; do
|
||||
local arg=$resp[2,-1]
|
||||
case $resp[1] in
|
||||
d)
|
||||
local req=$_p9k__worker_request_map[$arg]
|
||||
if [[ -n $req ]]; then
|
||||
_p9k__worker_request_map[$arg]=
|
||||
print -rnu $_p9k__worker_req_fd -- $req || return
|
||||
else
|
||||
unset "_p9k__worker_request_map[$arg]"
|
||||
fi
|
||||
;;
|
||||
e)
|
||||
() { eval $arg }
|
||||
(( reset > max_reset )) && max_reset=reset
|
||||
;;
|
||||
s)
|
||||
[[ -z $_p9k__worker_req_fd ]] || return
|
||||
[[ $arg == <1-> ]] || return
|
||||
_p9k__worker_pid=$arg
|
||||
sysopen -w -o cloexec -u _p9k__worker_req_fd $_p9k__worker_file_prefix.fifo || return
|
||||
local req=
|
||||
for req in $_p9k__worker_request_map; do
|
||||
print -rnu $_p9k__worker_req_fd -- $req || return
|
||||
done
|
||||
_p9k__worker_request_map=({${(k)^_p9k__worker_request_map},''})
|
||||
;;
|
||||
*)
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if (( max_reset == 2 )); then
|
||||
_p9k__refresh_reason=worker
|
||||
_p9k_set_prompt
|
||||
_p9k__refresh_reason=''
|
||||
fi
|
||||
(( max_reset )) && _p9k_reset_prompt
|
||||
return 0
|
||||
} always {
|
||||
(( $? )) && _p9k_worker_stop
|
||||
}
|
||||
}
|
||||
|
||||
function _p9k_worker_start() {
|
||||
setopt monitor || return
|
||||
{
|
||||
[[ -n $_p9k__worker_resp_fd ]] && return
|
||||
|
||||
if [[ -n "$TMPDIR" && ( ( -d "$TMPDIR" && -w "$TMPDIR" ) || ! ( -d /tmp && -w /tmp ) ) ]]; then
|
||||
local tmpdir=$TMPDIR
|
||||
else
|
||||
local tmpdir=/tmp
|
||||
fi
|
||||
_p9k__worker_file_prefix=$tmpdir/p10k.worker.$EUID.$sysparams[pid].$EPOCHSECONDS
|
||||
|
||||
sysopen -r -o cloexec -u _p9k__worker_resp_fd <(
|
||||
exec 0</dev/null
|
||||
if [[ -n $_POWERLEVEL9K_WORKER_LOG_LEVEL ]]; then
|
||||
exec 2>$_p9k__worker_file_prefix.log
|
||||
setopt xtrace
|
||||
else
|
||||
exec 2>/dev/null
|
||||
fi
|
||||
builtin cd -q / || return
|
||||
zmodload zsh/zselect || return
|
||||
! { zselect -t0 || (( $? != 1 )) } || return
|
||||
local _p9k_worker_pgid=$sysparams[pid]
|
||||
_p9k_worker_main &
|
||||
{
|
||||
trap '' PIPE
|
||||
while syswrite $'\x05'; do zselect -t 1000; done
|
||||
zf_rm -f $_p9k__worker_file_prefix.fifo
|
||||
kill -- -$_p9k_worker_pgid
|
||||
} &
|
||||
exec =true) || return
|
||||
_p9k__worker_pid=$sysparams[procsubstpid]
|
||||
zle -F $_p9k__worker_resp_fd _p9k_worker_receive
|
||||
_p9k__worker_shell_pid=$sysparams[pid]
|
||||
add-zsh-hook zshexit _p9k_worker_cleanup
|
||||
} always {
|
||||
(( $? )) && _p9k_worker_stop
|
||||
}
|
||||
}
|
BIN
src/powerlevel10k/internal/worker.zsh.zwc
Normal file
BIN
src/powerlevel10k/internal/worker.zsh.zwc
Normal file
Binary file not shown.
BIN
src/powerlevel10k/powerlevel10k.png
Normal file
BIN
src/powerlevel10k/powerlevel10k.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 61 KiB |
83
src/powerlevel10k/powerlevel10k.zsh-theme
Normal file
83
src/powerlevel10k/powerlevel10k.zsh-theme
Normal file
|
@ -0,0 +1,83 @@
|
|||
# vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8
|
||||
################################################################
|
||||
# Powerlevel10k Theme
|
||||
# https://github.com/romkatv/powerlevel10k
|
||||
#
|
||||
# Forked from Powerlevel9k Theme
|
||||
# https://github.com/bhilburn/powerlevel9k
|
||||
#
|
||||
# Which in turn was forked from Agnoster Theme
|
||||
# https://github.com/robbyrussell/oh-my-zsh/blob/74177c5320b2a1b2f8c4c695c05984b57fd7c6ea/themes/agnoster.zsh-theme
|
||||
################################################################
|
||||
|
||||
# Temporarily change options.
|
||||
'builtin' 'local' '-a' '__p9k_src_opts'
|
||||
[[ ! -o 'aliases' ]] || __p9k_src_opts+=('aliases')
|
||||
[[ ! -o 'sh_glob' ]] || __p9k_src_opts+=('sh_glob')
|
||||
[[ ! -o 'no_brace_expand' ]] || __p9k_src_opts+=('no_brace_expand')
|
||||
'builtin' 'setopt' 'no_aliases' 'no_sh_glob' 'brace_expand'
|
||||
|
||||
(( $+__p9k_root_dir )) || typeset -gr __p9k_root_dir=${POWERLEVEL9K_INSTALLATION_DIR:-${${(%):-%x}:A:h}}
|
||||
(( $+__p9k_intro )) || {
|
||||
# Leading spaces before `local` are important. Otherwise Antigen will remove `local` (!!!).
|
||||
# __p9k_trapint is to work around bugs in zsh: https://www.zsh.org/mla/workers/2020/msg00612.html.
|
||||
# Likewise for `trap ":"` instead of the plain `trap ""`.
|
||||
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
|
||||
(( $+__p9k_trapped )) || { local -i __p9k_trapped; trap : INT; trap "trap ${(q)__p9k_trapint:--} INT" EXIT }
|
||||
local -a match mbegin mend
|
||||
local -i MBEGIN MEND OPTIND
|
||||
local MATCH OPTARG IFS=$'\'' \t\n\0'\'
|
||||
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 }'
|
||||
typeset -gr __p9k_intro_no_locale="${${__p9k_intro_base/ match / match reply }/ MATCH / MATCH REPLY }"
|
||||
typeset -gr __p9k_intro_no_reply="$__p9k_intro_base; $__p9k_intro_locale"
|
||||
typeset -gr __p9k_intro="$__p9k_intro_no_locale; $__p9k_intro_locale"
|
||||
}
|
||||
|
||||
zmodload zsh/langinfo
|
||||
|
||||
function _p9k_init_locale() {
|
||||
if (( ! $+__p9k_locale )); then
|
||||
typeset -g __p9k_locale=
|
||||
(( $+commands[locale] )) || return
|
||||
local -a loc
|
||||
loc=(${(@M)$(locale -a 2>/dev/null):#*.(utf|UTF)(-|)8}) || return
|
||||
(( $#loc )) || return
|
||||
typeset -g __p9k_locale=${loc[(r)(#i)C.UTF(-|)8]:-${loc[(r)(#i)en_US.UTF(-|)8]:-$loc[1]}}
|
||||
fi
|
||||
[[ -n $__p9k_locale ]]
|
||||
}
|
||||
|
||||
() {
|
||||
eval "$__p9k_intro"
|
||||
if (( $+__p9k_sourced )); then
|
||||
(( $+functions[_p9k_setup] )) && _p9k_setup
|
||||
return 0
|
||||
fi
|
||||
typeset -gr __p9k_dump_file=${XDG_CACHE_HOME:-~/.cache}/p10k-dump-${(%):-%n}.zsh
|
||||
if [[ $__p9k_dump_file != $__p9k_instant_prompt_dump_file ]] && (( ! $+functions[_p9k_preinit] )) && source $__p9k_dump_file 2>/dev/null && (( $+functions[_p9k_preinit] )); then
|
||||
_p9k_preinit
|
||||
fi
|
||||
typeset -gr __p9k_sourced=13
|
||||
if [[ $ZSH_VERSION == (5.<1->*|<6->.*) ]]; then
|
||||
if [[ -w $__p9k_root_dir && -w $__p9k_root_dir/internal && -w $__p9k_root_dir/gitstatus ]]; then
|
||||
local f
|
||||
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
|
||||
[[ $f.zwc -nt $f ]] && continue
|
||||
zmodload -F zsh/files b:zf_mv b:zf_rm
|
||||
local tmp=$f.tmp.$$.zwc
|
||||
{
|
||||
# `zf_mv -f src dst` fails on NTFS if `dst` is not writable, hence `zf_rm`.
|
||||
zf_rm -f -- $f.zwc && zcompile -R -- $tmp $f && zf_mv -f -- $tmp $f.zwc
|
||||
} always {
|
||||
(( $? )) && zf_rm -f -- $tmp
|
||||
}
|
||||
done
|
||||
fi
|
||||
fi
|
||||
builtin source $__p9k_root_dir/internal/p10k.zsh || true
|
||||
}
|
||||
|
||||
(( $+__p9k_instant_prompt_active )) && unsetopt prompt_cr prompt_sp || setopt prompt_cr prompt_sp
|
||||
|
||||
(( ${#__p9k_src_opts} )) && setopt ${__p9k_src_opts[@]}
|
||||
'builtin' 'unset' '__p9k_src_opts'
|
BIN
src/powerlevel10k/powerlevel10k.zsh-theme.zwc
Normal file
BIN
src/powerlevel10k/powerlevel10k.zsh-theme.zwc
Normal file
Binary file not shown.
1
src/powerlevel10k/powerlevel9k.zsh-theme
Normal file
1
src/powerlevel10k/powerlevel9k.zsh-theme
Normal file
|
@ -0,0 +1 @@
|
|||
'builtin' 'source' "${POWERLEVEL9K_INSTALLATION_DIR:-${${(%):-%x}:A:h}}/powerlevel10k.zsh-theme"
|
BIN
src/powerlevel10k/powerlevel9k.zsh-theme.zwc
Normal file
BIN
src/powerlevel10k/powerlevel9k.zsh-theme.zwc
Normal file
Binary file not shown.
1
src/powerlevel10k/prompt_powerlevel10k_setup
Normal file
1
src/powerlevel10k/prompt_powerlevel10k_setup
Normal file
|
@ -0,0 +1 @@
|
|||
'builtin' 'source' "${POWERLEVEL9K_INSTALLATION_DIR:-${${(%):-%x}:A:h}}/powerlevel10k.zsh-theme"
|
1
src/powerlevel10k/prompt_powerlevel9k_setup
Normal file
1
src/powerlevel10k/prompt_powerlevel9k_setup
Normal file
|
@ -0,0 +1 @@
|
|||
'builtin' 'source' "${POWERLEVEL9K_INSTALLATION_DIR:-${${(%):-%x}:A:h}}/powerlevel10k.zsh-theme"
|
Loading…
Reference in a new issue