4000-520-616
欢迎来到免疫在线!(蚂蚁淘生物旗下平台)  请登录 |  免费注册 |  询价篮
主营:原厂直采,平行进口,授权代理(蚂蚁淘为您服务)
咨询热线电话
4000-520-616
当前位置: 首页 > 新闻动态 >
热卖商品
新闻详情
Powerlevel10k 一个 Zsh 主题 - Linux开发社区 | CTOLib码库
来自 : java.ctolib.com/romkatv-powerl 发布时间:2021-03-24

Powerlevel10k is over 100 times faster than Powerlevel9k in this benchmark.

In fairness, Powerlevel9k has acceptable latency when given a spartan configuration. If all you need is the current directory without truncation or shortening, Powerlevel9k can render it for you in 17 ms. Powerlevel10k can do the same 30 times faster but it won\'t matter in practice because 17 ms is fast enough (the threshold where latency becomes noticeable is around 50 ms). You have to be careful with Powerlevel9k configuration as it\'s all too easy to make prompt frustratingly slow. Powerlevel10k, on the other hand, doesn\'t require trading latency for utility -- it\'s virtually instant with any configuration. It stays well below the 50 ms mark, leaving most of the latency budget for other plugins you might install.

How do I enable instant prompt?

See instant prompt to learn about instant prompt. This section explains how you can enable it and lists caveats that you should be aware of.

Instant prompt can be enabled either through p10k configure or by manually adding the following code snippet at the top of ~/.zshrc:

# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.# Initialization code that may require console input (password prompts, [y/n]# confirmations, etc.) must go above this block; everything else may go below.if [[ -r \"${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh\" ]]; then source \"${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh\"fi

It\'s important that you copy the lines verbatim. Don\'t replace source with something else, don\'t call zcompile, don\'t redirect output, etc.

When instant prompt is enabled, for the duration of Zsh initialization standard input is redirected to /dev/null and standard output with standard error are redirected to a temporary file. Once Zsh is fully initialized, standard file descriptors are restored and the content of the temporary file is printed out.

When using instant prompt, you should carefully check any output that appears on Zsh startup as it may indicate that initialization has been altered, or perhaps even broken, by instant prompt. Initialization code that may require console input, such as asking for a keyring password or for a [y/n] confirmation, must be moved above the instant prompt preamble in ~/.zshrc. Initialization code that merely prints to console but never reads from it will work correctly with instant prompt, although output that normally has colors may appear uncolored. You can either leave it be, suppress the output, or move it above the instant prompt preamble.

Here\'s an example of ~/.zshrc that breaks when instant prompt is enabled:

if [[ -r \"${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh\" ]]; then source \"${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh\"keychain id_rsa --agents ssh # asks for passwordchatty-script # spams to stdout even when everything is fine# ...

Fixed version:

keychain id_rsa --agents ssh # moved before instant prompt# OK to perform console I/O before this point.if [[ -r \"${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh\" ]]; then source \"${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh\"# From this point on, until zsh is fully initialized, console input won\'t work and# console output may appear uncolored.chatty-script /dev/null # spam output suppressed# ...

If POWERLEVEL9K_INSTANT_PROMPT is unset or set to verbose, Powerlevel10k will print a warning when it detects console output during initialization to bring attention to potential issues. You can silence this warning (without suppressing console output) with POWERLEVEL9K_INSTANT_PROMPT=quiet. This is recommended if some initialization code in ~/.zshrc prints to console and it\'s infeasible to move it above the instant prompt preamble or to suppress its output. You can completely disable instant prompt with POWERLEVEL9K_INSTANT_PROMPT=off. Do this if instant prompt breaks Zsh initialization and you don\'t know how to fix it.

Note: Instant prompt requires Zsh = 5.4. It\'s OK to enable it even when using an older version of Zsh but it won\'t do anything.

What do different symbols in Git status mean?

When using Lean, Classic or Rainbow style, Git status may look like this:

feature:master ⇣42⇡42 ⇠42⇢42 *42 merge ~42 +42 !42 ?42

本文链接: http://archwaystl.immuno-online.com/view-697115.html

发布于 : 2021-03-24 阅读(0)
公司介绍
品牌分类
联络我们
服务热线:4000-520-616
(限工作日9:00-18:00)
QQ :1570468124
手机:18915418616