• Stars
    star
    117
  • Rank 301,828 (Top 6 %)
  • Language
    Nix
  • License
    MIT License
  • Created almost 7 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

GitLab: https://gitlab.com/jD91mZM2/powerline-rs

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.

More Repositories

1

termplay

GitLab: https://gitlab.com/jD91mZM2/termplay
Rust
540
star
2

xidlehook

GitLab: https://gitlab.com/jD91mZM2/xidlehook
Rust
382
star
3

sslhash

SSL without a certificate authority
Rust
31
star
4

jrust

A Rust macro that parses Java-like syntax and runs it as a Rust program
Rust
27
star
5

dotfiles

Literally just my "dotfiles" (except most don't even have dots in front of them). Not interesting, but 'kay.
Nix
25
star
6

rot26

Pure rust implementation of the rot26 algorithm
Rust
24
star
7

Jointercept

Jointercept stands for Join Intercept and is a replacement for the buggy EventGhost to instead launch your own programs!
Go
19
star
8

rust-lci

A LOLCODE interpreter written in Rust
Rust
15
star
9

rust-import

Attempt at an importer for Rust
Rust
11
star
10

minttp

minttp is an experiment to see if I could create a simple and minimal HTTP library without any dependencies.
Rust
11
star
11

chess-minimax

A chess bot written in Rust using the minimax algorithm
Rust
7
star
12

UndertaleSandbox

Backup your Undertale save files and replace them with new ones temporarily.
Go
7
star
13

insult

"Oh... Sir! The Insult Simulator" - like insults.
Rust
5
star
14

docker-steam

Very simple steam docker image (entirely thanks to x11docker)
Shell
5
star
15

git-subcopy

Link files across repositories
Nix
4
star
16

no-std-compat

A `#![no_std]` compatibility layer that will make porting your crate to no_std *easy*.
Rust
4
star
17

TimeyWimey-Go

No more stuggle with time zones... Thanks Discord!
Go
3
star
18

Join-API-for-Java

Access the Join API simply via Java
Java
2
star
19

termwm

A floating WM of terminals inside your terminal
Rust
2
star
20

pseudoterm

Low-level library for creating PTYs and getting related properties
Rust
2
star
21

spell

Tries to find the word you are looking for and spell it correctly
Rust
2
star
22

DA-DANK-MEEMZ

IT US DANK MEEMZ ONLEIN 2 GIV U AUDIO AND JPEGZ. INVEIT 2 UR DISCORD SERVR 4 MAXIMUM DANKNEZZZ
Go
2
star
23

docker-compiler-explorer

WIP Dockerfile to run compiler explorer locally
Dockerfile
2
star
24

rowan-tools

A few helpers for writing hand-written parsers (Mirror)
Rust
2
star
25

lcs

A project aimed to teach me how to calculate diffs
Rust
1
star
26

cargo-patch

A WIP cargo subcommand for recursively patching dependencies without [patch]
Rust
1
star
27

MCWASM

Mirror from GitLab
Python
1
star
28

math-types

A simple library for a few math types, such as fractions and matrices.
Rust
1
star
29

easyfuse

A high-level idiomatic wrapper around rust-fuse
Rust
1
star
30

configfs

Crazy project that creates a virtual filesystem to translate your config files
Rust
1
star
31

nix-github

Nix Flake action for GitHub
Shell
1
star
32

remoterm

SSH-like application for remote support
Rust
1
star