Giter Site home page Giter Site logo

powerline-rs's Introduction

powerline-rs

powerline-rs is a rewrite of powerline-shell, inspired by powerline-go.

Note: powerline-rs is in somewhat of a maintenance mode. I’ll try to make time to fix bugs and add new features, but the code is messy and I will not be fixing it any time soon unfortunately. It could be reworked to be more generic and maybe read a config file for the prompt, since it’s still going to be very fast thanks to rust. But I’m not going to implement that. Not now, at least.

/That said,/ I still use this for my own prompt and will probably never stop, so don’t worry it’s definitely not a dead project.

Why?

Speed! I haven’t done any extensive benchmarks, but it appears like even the debug version of powerline-rs is about 20 milliseconds faster than powerline-go. The Rust language is perfect for fast applications, since copying large structures isn’t implicit.

How to install

I strongly recommend installing powerline-rs using the Nix package manager, which will get you all the required native dependencies by default.

nix-env -iA powerline-rs

If you’d prefer the absolutely latest git version, you can use this instead:

nix-env -if https://gitlab.com/jD91mZM2/powerline-rs/-/archive/master.tar.gz

Then add the following code to your shell:

Other installation options

You can also install powerline-rs from an unofficial AUR package.

Using other installation options you’ll unfortunately have to fetch all native dependencies yourself. I’ve tried to guess which dependencies most users will need to install to build this, feel free to update the following matrix if it proves outdated.

ConfigurationNative dependenciesDescription
DefaultAll of the below
–no-default-featuresNone of the below
–features chronoNoneAdd time support for `–shell bare`
–features flameNoneAdds some performance benchmarks. Don’t use this.
–features git2libgit2, libzipAdd git support
–features usersNoneAdd username support for `–shell bare`

You’ll also need Rust, obviously. After that you can install powerline-rs via cargo.

cargo install powerline-rs

What’s new?

Well, the default modules have changed to not include the username and hostname. I feel like most people already know theirs. But you can always enable it, of course!

What’s optimized?

  • Generally just using Rust.
  • Using libgit2 over calling and parsing git output (Thanks tbodt for suggesting it!)
  • libgit2 can be disabled at compile time if you don’t plan on using git functionality.
  • Themes are using a simple small key=value scripts. No JSON overhead or similar.
  • The output of powerline-rs is slightly smaller than the 2 alternatives I mentioned. To be honest, I have no idea why.

What’s removed?

Most of the service-specific modules are deleted. I am very lazy. Pull requests are welcome, though.

Also, the jobs module won’t work with --shell bare.

Add it to your shell

Bash

prompt() {
    PS1="$(powerline-rs --shell bash $?)"
}
PROMPT_COMMAND=prompt

Zsh

prompt() {
    PS1="$(powerline-rs --shell zsh $?)"
}
precmd_functions+=(prompt)

Fish

function fish_prompt
    powerline-rs --shell bare $status
end

Ion

We can’t display the success status because ion now forbids the use $? from functions as a bi-product of the new namespacing system. This will of course eventually be resolved.

fn PROMPT
    powerline-rs --shell bare
end

Themes

User contributed themes are found in contrib/ You can define usage of a theme with argument –theme ~/.dotfiles/powerline-rs/solarized.theme If no theme is defined the default theme will be used.

powerline-rs's People

Contributors

casonadams avatar esell avatar frol avatar jd91mzm2 avatar jfdhuiz avatar lafleurdeboum avatar lazamar avatar orthoxerox avatar tinnick avatar

Watchers

 avatar  avatar

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.