A lightning fast reimplementation of the Powerline prompt generator in Haskell.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
R D'Netto 08cbbcbe5b
Merge pull request #17 from mgttlinger/zlib-dep
3 years ago
bench Added benchmarks 5 years ago
docs Added benchmarks 5 years ago
powerline@067261e613 Replaced logic for finding the path powerline was installed at with a git-submodule. 5 years ago
src Add support to show count of git untracked files 4 years ago
test Added func tests 5 years ago
.gitignore Added benchmarks 5 years ago
.gitmodules Replaced logic for finding the path powerline was installed at with a git-submodule. 5 years ago
.travis.yml Travis script: now that we're using a submodule, we don't need pip. 5 years ago
LICENSE Initial commit. 5 years ago
Notes.md Added other segments 5 years ago
README.md Add support to show count of git untracked files 4 years ago
Setup.hs Initial commit. 5 years ago
powerline-hs.cabal Replaced logic for finding the path powerline was installed at with a git-submodule. 5 years ago
stack.yaml Added dependency on zlib that is required for building 3 years ago
test-case.sh Added wrapping of ANSI literals with prompt escape codes. 5 years ago

README.md

Powerline-hs

Build Status

Powerline-hs is a Powerline clone written in Haskell. It is significantly faster than the original implementation, and makes the shell noticeably more responsive.

Benchmarks

Powerline-hs takes just 79.1 ms to render both prompts, in comparison to Powerline which took 1.25 seconds. (The execution time for a Python Hello World program is included for context.)

Complete benchmark (Click on the graph for an interactive version.)

You can find the source for these benchmarks here, and the Powerline configuration they were run against here. To run the benchmarks, use:

stack bench --benchmark-arguments '--output=bench.html -L 10'

Limitations

Powerline-hs currently only supports shell prompt generation (Bash, ZSH). It does not support the following segments:

  • powerline.segments.common.net.network_load
  • powerline.segments.common.wthr.weather
  • powerline.segments.common.time.fuzzy_time
  • powerline.segments.common.mail.email_imap_alert
  • powerline.segments.common.players.*

Support for other segments and usages may be added on request, time permitting. Pull requests are always welcome.

Installation

You will need to have Powerline installed, since Powerline-hs uses its config files and shell scripts.

You can download a pre-compiled binary from the Releases page - just extract the tarball and you're good to go.

Alternatively, you can compile from source using Stack with:

stack install

Configuration

Powerline-hs is intended to be a drop-in replacement for Powerline. This means that most of Powerline's documentation still applies, and that it should produce the same output without any additional configuration. If it does not, please file a bug.

To try out Powerline-hs in your current shell, just run:

export POWERLINE_COMMAND=$HOME/.local/bin/powerline-hs

(~/.local/bin is the path stack install copies it into - you may need to change it if you placed the executable somewhere else.)

To make it the default, add the following to your shell's RC file (e.g. .zshrc):

POWERLINE_COMMAND=$HOME/.local/bin/powerline-hs
POWERLINE_CONFIG_COMMAND=/bin/true
source /usr/share/zsh/site-contrib/powerline.zsh

The path of the shell script will depend on where you have Powerline installed and which distro you are using.

Git status

Powerline only provides a basic git information segment. There is an implementation here that adds a more advance git status support. Powerline-hs follows powerline-gistatus convention and only provides partial support.

Features supported:

  • n commits ahead. Colorscheme group gitstatus_ahead, e.g. "gitstatus_ahead":{ "fg": "gray10", "bg": "gray2", "attrs": [] }.
{
  "function": "powerline_gitstatus.gitstatus_ahead",
  "priority": 40
}
  • n commits behind. Colorscheme group gitstatus_behind, e.g. "gitstatus_behind":{ "fg": "gray10", "bg": "gray2", "attrs": [] }.
{
  "function": "powerline_gitstatus.gitstatus_behind",
  "priority": 40
}
  • n staged files. Colorscheme group gitstatus_staged, e.g. "gitstatus_staged":{ "fg": "gray10", "bg": "gray2", "attrs": [] }.
{
  "function": "powerline_gitstatus.gitstatus_staged",
  "priority": 40
}
  • n unmerged files. Colorscheme group gitstatus_unmerged, e.g. "gitstatus_unmerged":{ "fg": "gray10", "bg": "gray2", "attrs": [] }.
{
  "function": "powerline_gitstatus.gitstatus_unmerged",
  "priority": 40
}
  • n changed files. Colorscheme group gitstatus_changed, e.g. "gitstatus_changed":{ "fg": "gray10", "bg": "gray2", "attrs": [] }.
{
  "function": "powerline_gitstatus.gitstatus_changed",
  "priority": 40
}
  • n untracked files. Colorscheme group gitstatus_untracked, e.g. "gitstatus_untracked":{ "fg": "gray10", "bg": "gray2", "attrs": [] }.
{
  "function": "powerline_gitstatus.gitstatus_untracked",
  "priority": 40
}