GithubHelp home page GithubHelp logo

reujab / bronze Goto Github PK

View Code? Open in Web Editor NEW
49.0 4.0 2.0 85 KB

A cross-shell customizable powerline-like prompt with icons

License: The Unlicense

Go 97.73% Shell 2.27%
bash zsh fish prompt powerline agnoster icons theme

bronze's Introduction

bronze

A cross-shell customizable powerline-like prompt heavily inspired by Agnoster.

Rust port

There is a new, compatible, 50% faster port of this called silver written in Rust. Silver is compatible with the same configuration as bronze once you rename variables from BRONZE to SILVER ($BRONZE -> $SILVER, $BRONZE_SHELL -> $SILVER_SHELL, ...). The only main difference is that silver does not support the packages or plugin modules.

How does it work?

Unlike pretty much every other shell prompt, bronze is not written in shell script, but entirely in Go, so all prompt segments are loaded asynchronously for a speed boost.

When bronze init is run, it outputs shell code that sets your prompt to run bronze prompt, which outputs the actual prompt. The bronze prompt command relies on environment variables for configuration.

Getting started

Since bronze is not written in shell script, it should theoretically be compatible with any shell, but the three supported shells are Bash, Zsh, and fish.

Icons

To be able to use the custom icons (which are enabled by default), you must patch your font or install a pre-patched font from Nerd Fonts.

Installation

From source

  • install and setup Go
  • install libgit2 development packages
  • run go get github.com/reujab/bronze

From pre-compiled binary

  • download a binary on the releases page
  • add binary to PATH environment variable

macOS

On macOS, you will have to do a bit more:

  • install Homebrew
  • run brew install coreutils
  • add alias date="gdate" to your shell rc

Configuration

Now that you have bronze installed, you need to configure it. To have your prompt look like the one in the screenshot above, add this to your ~/.bashrc/~/.zshrc:

BRONZE=(status:black:white dir:blue:black git:green:black cmdtime:magenta:black)
export BRONZE_SHELL=$SHELL # bash, zsh, or fish

Or add the following to your ~/.config/fish/config.fish:

set BRONZE status:black:white dir:blue:black git:green:black cmdtime:magenta:black
set -x BRONZE_SHELL fish

Now that bronze is configured, you need to evaluate its bootstrap code.

~/.bashrc/~/.zshrc:

eval "$(bronze init)"

~/.config/fish/config.fish:

eval (bronze init)

Documentation

Documentation is available on the wiki.

Project structure

  • packagesd/
    • main.go
      • source code for the packages module daemon
    • packagesd.service
      • a systemd service file
      • can be placed in /usr/lib/systemd/system/
      • can be enabled with systemctl enable packagesd
      • can be started with systemctl start packagesd
  • static/
    • ab0x.go
      • a file automatically generated with go generate
      • contains the shell script files that are printed when running bronze init
  • types/
  • cmdtime.go
    • source code for the cmdtime module
  • dir.go
    • source code for the dir module
  • env.go
    • source code for the env module
  • git.go
    • source code for the git module
  • icons.go
    • initializes every icon based on BRONZE_ICONS and other environment variables
  • init.bash
    • bootstraps prompt for Bash
  • init.fish
    • bootstraps prompt for fish
  • init.go
    • source code for the init subcommand
  • init.zsh
    • bootstraps prompt for Zsh
  • main.go
    • parses command line arguments
  • modules.go
    • contains logic that determines which module function to call
  • os.go
    • source code for the os module
  • packages.go
  • plugin.go
    • source code for the plugin module
    • invokes code from dynamic libraries (.so files)
  • print.go
    • source code for the print subcommand
  • sh.go
    • contains shell-specific code
  • status.go
    • source code for the status module
  • time.go
    • source code for the time module
  • user.go
    • source code for the user module

Similar projects

powerline-go

bronze's People

Contributors

mexchip avatar reujab 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

mexchip

bronze's Issues

This seems awesome, but...

I'm running on ZSH on MacOS Sierra, and have no idea where to start with this. I don't really know how I can build a binary out of this source, since I don't work with go, and adding it to my path says /Users/wilsonhobbs/.zshrc:16: command not found: bronze. I would love some clarification and improved documentation!

Please add build instructions

go install github.com/reujab/bronze fails with

go install github.com/reujab/bronze
# pkg-config --cflags libgit2
Package libgit2 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libgit2.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libgit2' found
pkg-config: exit status 1

Add an option for moving the prompt to newline

Thank you for the project, feels like a more customizable powerline-go. Would it be possible to add an env var option for moving the prompt to newline, much like the flag functionality in powerline-go?

can not compile on Ubuntu 16.04

go version: 1.6.2 linux/amd64

The error I get is:

$ go get github.com/reujab/bronze
# cd /opt/go/src/gopkg.in/libgit2/git2go.v26; git submodule update --init --recursive
Submodule 'vendor/libgit2' (https://github.com/libgit2/libgit2) registered for path 'vendor/libgit2'
Cloning into 'vendor/libgit2'...                         
Submodule path 'vendor/libgit2': checked out '15e119375018fba121cf58e02a9f17fe22df0df8'
fatal: no submodule mapping found in .gitmodules for path 'tests/resources/rebase-submodule/my-submodule'
Failed to recurse into submodule path 'vendor/libgit2' 
package gopkg.in/libgit2/git2go.v26: exit status 128
package plugin: unrecognized import path "plugin" (import path does not begin with hostname)

Todo

  • License
  • Document all modules and settings
  • Individual files for init scripts
  • Fix git branch on detached HEAD
  • Emoji/no icons setting
  • Remove segment#visible
  • Allow changing segment separator
  • Support generic Linux and BSD
  • cmdtime threshold
  • time module
  • user module
  • Merge dir and shortdir into one module
  • Add separator for same background colors
  • Add images of os icons to the wiki
  • packages module
  • Add packages systemd unit
  • Update pacman database before checking for packages
  • Allow custom segments with shared objects
  • Improve error messages
  • Don't rely on $SHELL
  • Document BRONZE_DIR_LENGTH
  • Document plugin
  • Document packages
  • Fix BRONZE_DIR_LENGTH
  • env module
  • Merge Home, Icons and Bronze wiki pages
  • Allow icon prefixes other than home
  • Allow 256/24-bit colors.
  • Release v1.0.0
  • Improve installation instructions
  • rss module

weird prompt issue?

omf theme bullet-train-fish-theme Fri 08 Jun 2018 10:05:29 AM EDT
set --erase: Expected 1 args, got 2
~/.local/share/omf/lib/autoload.fish (line 85):
and set -e fish_function_path[$function_indexes]
^
in function “__autoload_erase”
called on line 6 of file ~/.local/share/omf/lib/autoload.fish
with parameter list “/home/solaraquarion/.config/omf/themes/bobthefish /home/solaraquarion/.local/share/omf/themes/bobthefish /home/solaraquarion/.config/omf/themes/bobthefish/functions /home/solaraquarion/.local/share/omf/themes/bobthefish/functions”

in function “autoload”
called on line 25 of file ~/.local/share/omf/pkg/omf/functions/themes/omf.theme.set.fish
with parameter list “-e /home/solaraquarion/.config/omf/themes/bobthefish /home/solaraquarion/.local/share/omf/themes/bobthefish /home/solaraquarion/.config/omf/themes/bobthefish/functions /home/solaraquarion/.local/share/omf/themes/bobthefish/functions”

in function “omf.theme.set”
called on line 18 of file ~/.local/share/omf/pkg/omf/functions/cli/omf.cli.theme.fish
with parameter list “bullet-train-fish-theme”

in function “omf.cli.theme”
called on line 3 of file -
with parameter list “bullet-train-fish-theme”

in function “__omf_last_command”
called on line 51 of file ~/.local/share/omf/pkg/omf/functions/omf.fish

in function “omf”
called on standard input
with parameter list “theme bullet-train-fish-theme”

   set

Synopsis
set [SCOPE_OPTIONS]
set [OPTIONS] VARIABLE_NAME VALUES...
set [OPTIONS] VARIABLE_NAME[INDICES]... VALUES...
set ( -q | --query ) [SCOPE_OPTIONS] VARIABLE_NAMES...
set ( -e | --erase ) [SCOPE_OPTIONS] VARIABLE_NAME
set ( -e | --erase ) [SCOPE_OPTIONS] VARIABLE_NAME[INDICES]...
set ( -S | --show ) [SCOPE_OPTIONS] [VARIABLE_NAME]...

set: Type “help set” for related documentation

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.