Commit Graph

1083 Commits (master)

Author SHA1 Message Date
romkatv 182f0f7162 support true color
In order to use true color with Powerlevel10k you need ZSH >= 5.7 and a terminal that supports true
color. Here's how you can check whether you are covered.

    if autoload -U is-at-least && is-at-least 5.7; then
      echo "ZSH $ZSH_VERSION: supports true color"
    else
      echo "ZSH $ZSH_VERSION: does not support true color"
    fi

    if [[ $COLORTERM == (24bit|truecolor) || ${terminfo[colors]} -eq 16777216 ]]; then
      echo "Terminal supports true color"
    else
      echo "Terminal does not support true color"
    fi

To use true color with Powerlevel10k, use `#ffffff` format when specifying colors.

    POWERLEVEL9K_TIME_FOREGROUND='red'      # by name (type `getColorCode foreground` to list all)
    POWERLEVEL9K_TIME_BACKGROUND='001'      # by decimal code (usually 001 to 256)
    POWERLEVEL9K_TIME_BACKGROUND='#ff0000'  # by hex code (#000000 to #ffffff)

In order to be able to use the same configuration from a terminal without true color support,
add this to your ~/.zshrc:

    if [[ $COLORTERM != (24bit|truecolor) && ${terminfo[colors]} -ne 16777216 ]]; then
      zmodload zsh/nearcolor
    fi

When using a true color terminal, `#ffffff` will render as true color. When on an older terminal,
it'll render as the closest available color. Neat!

Fixes #62.
6 years ago
romkatv 361eec6f95 replace all -v checks with equivalents (trying to port to zsh 5.2) 6 years ago
Roman Perepelitsa 96f5482a8d
partial rollback of the previous commit: ${(P):-X} is not the same as ${(P)${:-X}} 6 years ago
romkatv 6ef8e2f0cf simplify: ${(x)${:-y}} => ${(x):-y} 6 years ago
romkatv d29c30af3b move zsh version check to the top 6 years ago
romkatv 5fc6fca402 call "zle -R" after every "zle reset-prompt" 6 years ago
Ming Aldrich-Gan 91b2526c02 Add LINUX_RASPBIAN_ICON (Raspberry Pi icon) as an OS_ICON candidate 6 years ago
Sam Miller 2801642436 Add VCS_LOADING_ICON to the icons map 6 years ago
romkatv d9505ef195 add extra diagnostics for old shells 6 years ago
Caleb Maclennan 20de3ac8fd
Always expand GIT_DIR to absolute path 6 years ago
Caleb Maclennan 983d9a4480
Obey GIT_DIR if set for vcsh compatability 6 years ago
romkatv 43b984494d print HEAD instead of commit if not available; do not call zle when illegal to do so 6 years ago
Mohammed Abdel Ra'ouf b0e48cbdc8 add node_version only inside project folder option 6 years ago
romkatv 3fd0e63776 don't kill timer when subshells exit 6 years ago
romkatv 88d81a215f formatting 6 years ago
romkatv a56b2c17d2 restore the copyright from the origin of powerlevel9k 6 years ago
romkatv fc9c4b6f36 fix incoming changes in git prompt 6 years ago
romkatv 0ecf2636b4 stop using typeset when declaring functions; it's stupid 6 years ago
romkatv 573c172c97 make extended git styling options consistent with the existing styling options 6 years ago
romkatv db48e0d62f simpler ws handling in git 6 years ago
romkatv c04536ce70 restore "loading" git status 6 years ago
romkatv ea13f92993 support individual styling for all parts of git prompt 6 years ago
romkatv 506598b521 support segments with multiple text elements 6 years ago
romkatv 604de18654 bail if someone tries to interpet powerlevel9k.zsh-theme with sh 6 years ago
romkatv f0770b414e get rid of unwanted whitespaces; this time the wanted whitespaces should remain 6 years ago
romkatv 724f0e6d50 optimize prompt_context 6 years ago
romkatv c38edde025 Revert "remove superfluous spaces from rprompt; optimize context"
This reverts commit a97892bc72.
6 years ago
romkatv a97892bc72 remove superfluous spaces from rprompt; optimize context 6 years ago
romkatv 1164e3e2a2 add caching to simple_dir 6 years ago
romkatv 01f151fa1f bug fix: correctly handle consecutive segments without background 6 years ago
romkatv 85e9f4955b expand string parameters with (g::) where appropriate 6 years ago
romkatv 6e7ba25046 optimze prompt compiler 6 years ago
romkatv bf0b128652 optimize left_prompt_segment further 6 years ago
romkatv 013b96efd3 optimize left_prompt_segment 6 years ago
romkatv 4af61b5fda make left and right more consistent 6 years ago
romkatv 1c6cb6bd50 simplify code a little 6 years ago
romkatv 0e8989019e close fifo descriptor on exec and ensure timer process exits 6 years ago
romkatv ab43f19909 remove _P9K_H* stuff that is no longer necessary 6 years ago
romkatv 472f241598 fix regression in truncate_with_package_name; fixes #29 6 years ago
romkatv 1e2c81f696 move segment renderring logic to prompt expansion time 6 years ago
romkatv d8ef83b59a be more aggressive in attempt to maintain correct prompt options 6 years ago
Barrett Brown 972bb3be6a
Specify `command rm` to bypass any aliases 6 years ago
romkatv e413af55bb stupid typo 6 years ago
romkatv 753fb3feb5 bug fix: accidentally defined function named "local"... oops! 6 years ago
romkatv bad4e62e93 kill timer process on exit 6 years ago
romkatv 5c816e13ca cleanup 6 years ago
romkatv 3153b33ade better quoting 6 years ago
romkatv 146d6cd232 make dir formatting a little less broken 6 years ago
romkatv 42f50bb9f6 escape properly 6 years ago
romkatv ac04d7b952 speed up background_jobs 6 years ago
romkatv 44e5b8bcc1 Merge branch 'master' of github.com:romkatv/powerlevel10k 6 years ago
romkatv 264a10fb0d support tags and revisions in gitstatus-powered vcs segment; respect vcs hooks 6 years ago
Roman Perepelitsa 6defc51073
another shot in the dark 6 years ago
Roman Perepelitsa 1b8c1f177b
fix prompt_virtualenv 6 years ago
romkatv 8f2fae5a38 shot in the dark 6 years ago
romkatv af9c7adfd0 fix linux distro icons 6 years ago
romkatv 20c4c6873e fix background_jobs; the segment now refreshes when jobs complete 6 years ago
romkatv 2d877f95fd fix POWERLEVEL9K_SHORTEN_DELIMITER 6 years ago
romkatv 46d70094e2 suppress "no such command: tput" on startup 6 years ago
romkatv 0fa2f7ba65 bail out when the theme is being sourced second time 6 years ago
romkatv 5ffc8f881c better init 6 years ago
romkatv 8de106d0e3 count suspended jobs too 6 years ago
romkatv 630ca49cf4 speed up prompt scaffolding 6 years ago
romkatv ef1f958f2c fix vim_mode segment 6 years ago
romkatv 5ee0054298 don't read configuration options until the first precmd; plus massive refactoring and cleanup 6 years ago
romkatv c9ee989e38 honor POWERLEVEL9K_MAX_CACHE_SIZE 6 years ago
romkatv a0d2449c43 speed up time, date and custom prompts. saves 2.5ms overall 6 years ago
romkatv afc1a07a71 add POWERLEVEL9K_EXPERIMENTAL_TIME_REALTIME 6 years ago
romkatv 14366ed0ce make git-is-slow stickier 6 years ago
romkatv 0aa667dbf8 fix bugs reported in https://github.com/romkatv/powerlevel10k/issues/9 6 years ago
romkatv aad3301049 do not reset prompt after prompt_powerlevel9k_teardown 6 years ago
romkatv ab913d8930 simplify and speed up caching 6 years ago
romkatv 02d836d6dc minor opitimization 6 years ago
romkatv 3241152934 define POWERLEVEL9K_VCS_MAX_INDEX_SIZE_DIRTY; some cleanup 6 years ago
romkatv 1858bbdd20 wip 6 years ago
romkatv 00bc22e194 remove unnecessary caching 6 years ago
romkatv a6eb14db5e space between >>! and the file name 6 years ago
romkatv eaa555c00f bug fix: support POWERLEVEL9K_STATUS_VERBOSE=false 6 years ago
romkatv da8f412197 use mkport in a portable way 6 years ago
romkatv 9e75070a88 make it work when CLOBBER is unset 6 years ago
romkatv 8f1dcdca84 formatting 6 years ago
romkatv f20faf175b do not set POWERLEVEL9K_VCS_STATUS_COMMAND 6 years ago
romkatv ab072ffe19 make it work with zplugin 6 years ago
romkatv 82635636f7 merge upstream 6 years ago
romkatv e54b52ad26 fix how jobs are counted 6 years ago
Dominik Ritter 3057e8fc07 Backport @wrboyce fix for truncating dir with package name from #1158 6 years ago
romkatv 8cb27f335b remove useless assoc array 6 years ago
romkatv ceae2d7422 remove most things 6 years ago
romkatv 71b763b692 start forking into powerlevel10k 6 years ago
romkatv 3122bec34b comment 6 years ago
romkatv 4c8f483cb5 change gitstatus protocol 6 years ago
romkatv 34f4658e5f change gitstatus protocol to something more suitable for daemon 6 years ago
romkatv 9d7aa4e530 move default prompt definitions to the top 6 years ago
romkatv 0b56d123ec speed up joins; get rid of _p9k_memoize_icon 6 years ago
romkatv c344b4ee9d speed up the cache-miss branch of {left,right}_prompt_segment 6 years ago
romkatv 27a599e03e add dir-writable indicator to the dir prompt key 6 years ago
romkatv 77b319c0d3 update POWERLEVEL9K_VCS_STATUS_COMMAND example 6 years ago
romkatv d9d8d8fc22 remove junk line 6 years ago
romkatv 46a4e1333e fix cache_key in vcs 6 years ago
romkatv 405a66b315 speed up the cache-miss branch of prompt_vcs 6 years ago
romkatv 42b44bbb8e add alternative vcs mode that doesn't use vcs_info 6 years ago
Dominik Ritter 613b798bb3
Merge pull request #1126 from Shini31/master
Use ip command for VPN segment - fix #1125
6 years ago
romkatv e5b954fcae speed up by using globals instead of stdout and by caching basic prompt elements 6 years ago
romkatv 7611cfda98 bug fix: add current background to the cache key in {right,left}_prompt_segment 6 years ago
romkatv 968e1a618c add caching to speed up prompt generation 6 years ago
Dominik Ritter dcd7718c62
Merge pull request #1149 from dritter/HaoZeke-fix-RVM
Fix RVM
6 years ago
Dominik Ritter 06151eeba9 Merge remote-tracking branch 'ben/master' into HEAD 6 years ago
Dominik Ritter 40e04e053c Parse IPs properly
This is done if we want to show a public IP, internal IP, or a VPN.
In the VPN case, what we actually want is to display an indicator
that a VPN is active, instead of the VPN IP itself. We parse the
IP here anyway, because we want to save some specific code there.
6 years ago
Dominik Ritter 22f6495005
Merge pull request #1151 from Wuestengecko/bugfix-1150
[Bugfix] Only abbreviate $HOME at the beginning of cwd
6 years ago
Dominik Ritter 08798d12ad
Merge pull request #1147 from dritter/fix_newlines_in_zsh57
Fix newlines in ZSH 5.7
6 years ago
Wuestengecko 8f60309386
Only abbreviate $HOME at the beginning of cwd
Fixes #1150
6 years ago
Dominik Ritter 5c7d1009de
Merge pull request #1148 from dritter/remove_nodeenv_disable_prompt
Remove checking for NODEENV_DISABLE_PROMPT
6 years ago
Dominik Ritter bd340d4a88
Merge pull request #966 from ytang/fix-rprompt-icons-cut-off
[Bugfix] Fix icons cut off in RPROMPT segments
6 years ago
Dominik Ritter 2f05bbbb47 Remove checking for NODEENV_DISABLE_PROMPT
This variable is none of our buisness.
6 years ago
Dominik Ritter 020287dd75 Fix Segment endings if followed by newline 6 years ago
Ythildir 1a1572669c Fix white arrow on newline 6 years ago
HaoZeke 58f70e57e6 rvm: Use @natemccurdy review suggestions 6 years ago
HaoZeke a41f2e81ae rvm: Only show version and patchset 6 years ago
HaoZeke 1da5fd2ed7 Revert "Huge performance improvement if you use `rvm` segment."
This reverts commit 643555a30c.

This does allow rvm to be detected even without using the depreciated
gemset settings.
6 years ago
Dominik Ritter 081000c49e Replace call to basename with ZSH internals #1128 6 years ago
Dominik Ritter 747b94b1b6 Match VPN interface fuzzy on Linux 6 years ago
Dominik Ritter bde4337992 Match VPN Interface fuzzy 6 years ago
Dominik Ritter 54a985cb11 Simplify code that checks if a VPN is running 6 years ago
Dominik Ritter 480ade162b Improve tests 6 years ago
Dominik Ritter da50151d24 Fix regular expression 6 years ago
Dominik Ritter 9b73c8bd9c Add tests 6 years ago
Ymage ee7416962d Remove $VIRTUAL_ENV_DISABLE_PROMPT testing 6 years ago
Ymage 12e9724860 Merge with @dritter proposal 6 years ago
Ymage a8db401808 [Bugfix] virtualenv prompt displaying
Fix #1127
6 years ago
Shini31 a8fa0332d2 Use ip command for VPN segment - fix #1125 6 years ago
Josselin Auguste 5c412b4d42 Update VIRTUAL_ENV_DISABLE_PROMPT value
Following prezto update
6 years ago
Dominik Ritter 5abac53698
Merge pull request #1037 from dritter/fix_vpn_ip_segment
Fix vpn_ip segment
6 years ago
Dominik Ritter 993de7aef9 Fix vpn_ip segment 6 years ago
Dominik Ritter dc731f10e6 Make truncate with package name work without setting shorten length 6 years ago
Yang Tang a98fa7ff54
Merge branch 'master' into fix-rprompt-icons-cut-off 6 years ago
Ben Hilburn 572b7a1299 Removing `rbenv` from default LPROMPT list. 6 years ago
Yang Tang 877ef61773 Fix icons cut off in RPROMPT segments 6 years ago
Dominik Ritter 2700cb46f5 Merge remote-tracking branch 'docwhat/pr/sudo-check' into prepare_066 6 years ago
Christian Höltje 3fb0383956 Use SUDO_COMMAND to check for sudo
`sudo -n true` only checks that we _could_ use `sudo`, not if we are in
a sudo session.

closes #852
6 years ago
Dominik Ritter 6daef84c60 Merge branch 'fix_colors' into prepare_066 6 years ago
Dominik Ritter 52ce9930bb Fix foreground colors in right prompt segments 6 years ago
Dominik Ritter e0630d7573 Merge branch 'fix_colors' into prepare_066 6 years ago
Dominik Ritter 27fe2c6571 Make use of helper function in left_end_segment 6 years ago
Dominik Ritter 6f5827009f Fix colors for visual identifiers
Make the visual identifier color use numerical color codes as well. This
way colors like "purple3" work as visual identifier color.
6 years ago
Dominik Ritter c7e543ff23 Merge branch 'fix_colors' into prepare_066 6 years ago
Dominik Ritter 93324c0600 Improve naming of variables
As a side effect this should improve the performance slightly, as we get
the fore- and background color codes as early as possible, and store the
result, so that we don't have to recalculate the color code all over.
6 years ago
Dominik Ritter 02506893a9 Remove duplicate variable 6 years ago
Dominik Ritter bf9082bea9 Fix bug so that the segment separator of left middle has the right color
In short: the current background color was the unfiltered color and is
used to print the next segment separator. If the user set a color like
"purple3" that would result in a white segment separator as Terminal
Emulators do not understand the color "purple3".
6 years ago
Dominik Ritter ebbdb3c1c0 Make purpose clear of backgroundColor and foregroundColor functions
The functions just start the colors, they do not end them. It seems
too much to have a function that terminates a color.
6 years ago
Dominik Ritter 3b8f0abdb2 Merge remote-tracking branch 'docwhat/pr/sudo-check' into prepare_066 6 years ago