configs/home/.zsh/themes/spaceship-prompt/docs/blog/2018-spaceship-v3.md

8.1 KiB
Raw Permalink Blame History

Meet Spaceship ZSH v3.0!


Photo by Tim Mossholder on Unsplash

Spaceship is a minimalistic, powerful and extremely customizable Zsh prompt. Today were announcing the third major release of Spaceship prompt — one of the most powerful zsh prompts ever.

Almost a year has passed since A big update of spaceship-zsh-theme and release of v2.0, but now we have even more exciting changes and announcements. So here we go!

:material-github: Source on GitHub{ .md-button}

Whats new?

The initial purpose of this release was refactoring of how Spaceship works with sections. By the way, there were a few pull-requests with breaking, but important changes. This release brings better API, new options, few performance improvements and more.

Drop Oh-My-Zsh dependency

Weve run into troubles using built-in functions from Oh-My-Zsh (OMZ). Besides this, a lot of users would like to use Spaceship without OMZ, with their custom setup or with frameworks like prezto. That was the main reason why we decided to remove using OMZ in Spaceship code.

You dont have to use ZSH_THEME or ZSH_CUSTOM folder anymore to install Spaceship. Since v3.0 we use a native prompt system that comes zsh:

# .zshrc
autoload -U promptinit; promptinit
prompt spaceship

Brand-new name

Dropping OMZ means that Spaceship isnt a *theme *anymore, its a prompt. Weve renamed our packages and GitHub repository

spaceship-zsh-theme → spaceship-prompt

Old spaceship-zsh-theme npm-package has been deprecated with recommendation to install spaceship-prompt instead.

Better project structure

First, project structure has been totally reorganized. Previously, Spaceship was just a huge single source file and any change causes constant jumping between different parts of a single file.

Now Spaceship is split up into smaller modules (sections, utils, etc) and they are loading when its required. That also means, if youre struggling with performance, you can just avoid loading the sections that you dont use. Read more at “Why is my prompt slow?” section of documentation:

Troubleshooting{ .md-button }

Custom sections and Spaceship API

Brice Dutheil sent us a pull-request with Allow invoking custom functions. This feature opens an ability to define custom sections with any functionality and, therefore, to extend functionality as much as you need.

Moreover, v3.0 comes with better API for creating sections. To avoid conflicts, Spaceship uses SPACESHIP_ prefix for variables and spaceship:: prefix for a function. All section, including custom ones, are being required to use spaceship_prefix before their name to load correctly.

Check out Spaceships API here:

API Documentation{ .md-button }

We encourage you to create your section, as many as you want and share them with others on our External sections wiki-page!

Contributing guidelines

Ability to extend and share sections requires new contributing guidelines, so weve finally added a CONTRIBUGING.md file to our repository.

Three simple rules define our development path:

  • Show only whats needed. The prompt should not be overloaded, it shows only what user needs at the moment (current directory, git branch, etc).
  • Work out of the box. The prompt should work right after installation without any additional configuration. Install it and use it.
  • Be configurable. It works without configuration, but if a configuration is needed, it provides an easy-to-use interface for customization.

Please, keep this simple rules in mind while youre contributing to Spaceship.

Contributing Guide{ .md-button }

Right prompt support

The new release brings the support of right prompt (RPROMPT). By default, right prompt is empty, but you can add some sections the same way you do with a primary prompt.

Spaceship with time section in right prompt*

Read the documentation about prompt ordering to learn more:

Options{ .md-button }

Website and documentation

We are glad to announce that now Spaceship has a documentation website. We use GitBook for generating this website from our ./docs folder.

Heres how it looks like:

Website Preview

Check out our website at:

Website{ .md-button }

Smaller changes

There was also a lot of petite, but still important changes:

You can check out Spaceship 3.0 Roadmap for further information:

:material-github: 3.0: Roadmap · Issue #200{ .md-button}

Some statistics

Its always interesting to see more statistic, so totally a pull-request #148 contains:

  • ⏺ 178 commits
  • 3,220 additions
  • 2,250 deletions
  • 34 closed issues in milestone
  • 👨‍💻 +1 team member (welcome Maxim Baz 👋🏻)

Plans for future

As always, the project doesnt stop to evolve. We have plenty of issue, pull-requests, and plans for future development.

Want to help? Check out help wanted label in Issue. If you need a feature or have any question, dont be hesitated to open an issue.

Donation

Hi! I work on this project in my spare time, beside my primary job. I hope enjoy using Spaceship, and if you do, please, buy me a cup of tea .

I would appreciate your support! Thank you!

Thankyou for reading! If you like this article, please, press 👏. Follow me on Twitter and GitHub, if you want to get updates.*