Git Product home page Git Product logo

zinc's Introduction

ZINC

Inspired by Powerlevel9K, Agnoster, and friends this is a powerline theme written from scratch in pure ZSH. It supports mixed async segments using zsh-async as a backend.

ZINC Prompt Screenshot

ZINC is ZSH software, not just shell scripts. (See https://github.com/zdharma/Zsh-100-Commits-Club )

Quickstart and Documentation

Visit the GitLab / GitHub Wiki! There you'll find docs about how to install and configure ZINC.

If you're looking for the individual segment options, look in the zsdoc folder in this repo. Each segment has it's docs autogenerated by Zshelldoc.

Why ZINC?

  • ZINC is configured and structured very differently from other themes
    • ZSH associations (/dictionaries) are used for almost all options
    • There's no central icon or segment registration
    • Segments are free to do as they please
  • ZINC is a very small and lean code base that's quick to load.
  • ZINC is easily extensible (works via shell functions and zsh's fpath)
  • ZINC is completely customizable (make your own segments with a standard API!)

ZINC was built to support mixed async and non-async segments from the ground up. Git/HG/SVN information is loaded asynchronously, so your prompt is usable near instantly even on slow systems!

Also, async segments are smart:

  • redrawing the prompt doesn't start duplicate jobs
  • async output can be cached differently per-segment
  • custom async segments are easy to implement (3 shell functions) and require no changes or calls to ZINC code

Note about Icons and Symbols

If you're in it for the super-fancy icons from Nerd-Fonts, etc, Powerlevel9K is still a better choice as the advanced Icon registry and alternative font support is not present in ZINC by default.

Official ZINC segments will only use Unicode, UTF-8, and icons from the powerline patched fonts in order to both ease setup/configuration and simplify a lot of the code for speed.

Since it's supposed to be super easy to modify and make your own segments, we've left custom font icons up to the users for usage.

Performance

  • Only functions that get used are loaded via ZSH's fpath autoload functionality
  • There are no external calls in the main thread. Program calls and shell forking is all done in an async worker.
  • Prompt segments can be compiled to ZSH word code for better startup time. (Just execute prompt_zinc_compile)
  • ZSH builtins and binary modules are used instead of GNU utils / external binaries.

Performance comparison: (Mar. 2019) using zsh-prompt-benchmark

ZINC:

************************************************************
                Prompt Benchmark Results
************************************************************
Warmup prompts (skipped)  5
Benchmarked prompts       1841
Total time                5.002s
Time per prompt           2.7ms
************************************************************

Powerlevel9K: https://github.com/bhilburn/powerlevel9k

************************************************************
                Prompt Benchmark Results
************************************************************
Warmup prompts (skipped)  5
Benchmarked prompts       28
Total time                5.037s
Time per prompt           179.9ms
************************************************************

Pure: https://github.com/sindresorhus/pure

************************************************************
                Prompt Benchmark Results
************************************************************
Warmup prompts (skipped)  5
Benchmarked prompts       3130
Total time                5.001s
Time per prompt           1.6ms
************************************************************

All tests done with Git information enabled and with the same git repo state on a machine using an nvme SSD.

GitLab vs GitHub

ZINC started on GitLab, but is mirrored to GitHub for availability purposes. Both the repo and the wiki are mirrored. (So robobenklein/zinc works in plugin managers with GitHub as the default.)

Issues should be reported on GitLab, as it has a slightly better issue tracker and allows things like file attachments.

zinc's People

Contributors

robobenklein avatar romkatv avatar sinetoami avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

jrc2139 enometh

zinc's Issues

Space absent between branch name and status icon

Detail, though annoying: in your video, I see "dev o" (space between the branch name and some status icon). In my case, there is no space (for my projects) between "master" and the "o" icon. Any idea why?

Wish item: symbol for branches

Dear Ben,

May I?
You may consider this as going too far - and I'd understand. So, your call!

I'd find it very nice to get the "branch" symbol that I had in PowerLevel9k... but even better: just having it displayed when it's a real branch - I mean, not for trunk (in SVN) nor master (in Git). That'd clearly would make branches stand out in the prompt.

As I said, this is not an issue, nor a bug, just an item on a wish list.

Exit "blocked"

Dear Ben, now, since I'm using Zinc, I have some (?) terminal windows which don't close, after the exit command. It stays in that state forever:

image

and if I click on the x button, I get:

image

But answering OK does not change anything: the window still hangs out…

Any idea?

RPROMPT before left PROMPT?

Is there any possibility to get first the RPROMPT displayed, then a newline, and finally the left PROMPT?

Put commit hash in the prompt, when in detached mode

Dear Ben,

When in detached mode, could you put the commit hash in the prompt (instead of "heads/master")?

That was like that in PowerLevel9K, and was a time-saver…

Thanks in advance! Best regards, Fabrice

[Question] Performance advantages over powerlevel10k

First of all, sorry for open this issue here when the README tell us for open on GitLab. And sorry my bad english.

I've seeing lots of discution about the powerlevel10k prompt and how great is the improvements working on it and how much great is the gitstatus on it too. I use it and i really like it actually. In some of these discutions the Zinc prompt appears as a great prompt using gitstatus too. I saw the zinc seems more simple than powerlevel10k. But in terms of performance, have zinc some advantages over powerlevel10k? Which are these advantages? Zinc really uses gitstatus? Can I make my own customizations using the zinc code as base to do this?

For now, that's it. Thanks for your attention!

SVN not enabled by default?

Hello -- and many thanks for this super fast prompt!

It's a must for me, as I do want Git and SVN status on my prompt, and fast.

Though, I did not do anything, just cloned and then sourcing zinc.zsh, I don't see any SVN info in my prompt. Do I have to do something special?

PS- I see I do have ~/.dotfiles/plugins/oh-my-zsh/plugins/svn on my disk. Is that a trouble?
PPS- Using this with Oh My Zsh! from Cygwin on Windows...

Best regards,
Fabrice

How to convert POWERLEVEL9K config?

Dear,

I had this config before:

# Single-line prompt.
POWERLEVEL9K_PROMPT_ON_NEWLINE=false
POWERLEVEL9K_RPROMPT_ON_NEWLINE=false

POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX=''
POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX=''

# Customise the Powerlevel9k prompts.
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ssh dir vcs)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status command_execution_time time background_jobs)

POWERLEVEL9K_STATUS_VERBOSE=false
POWERLEVEL9K_STATUS_OK_IN_NON_VERBOSE=true
POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=10
POWERLEVEL9K_TIME_FORMAT="%D{%H:%M}"

How to get the same prompt with Zinc?

What annoys me currently is the user@hostname part at the beginning of the PROMPT. I almost do not use ssh, and so this is a big part of space taken for nothing -- I'd like that to be auto-visible, though, in ssh sessions, but that may be not possible.

And I'd like the time format to be just HH:MM.

And finally I'd like the duration for "long commands" to be shown if the command is taking more than 10 seconds.

On the other hand, I enjoy a lot your exit code (which really give the number instead of a red cross), and I appreciate a lot the SIGINT marker as well! I wanna keep those as-is!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.