Coder Social home page Coder Social logo

bash-powerline's Introduction

bash-powerline

Powerline for Bash in pure Bash script.

bash-powerline

Features

  • Git: show branch name, tag name, or unique short hash.
  • Git: show "*" symbol with uncommited modifications.
  • Git: show "โ†‘" symbol and number of commits ahead of remote.
  • Git: show "โ†“" symbol and number of commits behind remote.
  • Platform-dependent prompt symbols.
  • Color-coded prompt symbol according to previous command execution status.
  • Use Bash builtin when possible to reduce delay. Delay sucks!
  • No need for patched fonts.

Installation

Download the Bash script

curl https://raw.githubusercontent.com/riobard/bash-powerline/master/bash-powerline.sh > ~/.bash-powerline.sh

And source it in your .bashrc

source ~/.bash-powerline.sh

For best result, use Solarized colorscheme for your terminal emulator. Or hack your own colorscheme by modifying the script. It's really easy.

Why?

This script is inspired by powerline-shell, which is implemented in Python. Python scripts are much easier to write and maintain than Bash scripts, but invoking Python interpreter introduces noticable delay to draw. I hate delays, so I ported just the part I need to pure Bash script.

The other reason is that I don't like the idea of patching fonts. The font patching mechanism from the original Powerline does not work with the bitmap font (Apple Monaco without anti-aliasing) I use on non-retina screens. I'd rather stick with existing unicode symbols.

See also

  • zsh-powerline: Same thing but for Zsh.
  • powerline: Unified Powerline written in Python. This is the future of all Powerline derivatives.
  • vim-powerline: Powerline in Vim writtien in pure Vimscript. Deprecated.
  • tmux-powerline: Powerline for Tmux written in Bash script. Deprecated.
  • powerline-shell: Powerline for Bash/Zsh/Fish implemented in Python. Might be merged into the unified Powerline.
  • emacs powerline: Powerline for Emacs

bash-powerline's People

Contributors

ealeksandrov avatar hexcles avatar jkesanen avatar riobard avatar zacstewart 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  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  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bash-powerline's Issues

Doesn't seem to start up in WSL

~ $ sh ~/.bash-powerline.sh
/home/dnesteruk/.bash-powerline.sh: 50: /home/dnesteruk/.bash-powerline.sh: Syntax error: "(" unexpected (expecting "fi")

support for sourced python virtual environments

Using a default terminal, after sourcing a python virtual environment script

cd ~
mkdir folder
cd folder
python -m venv venv
source ven/bin/activate

This action modifies the bash prompt to something like this

(venv) ~/folder

Using this bash script drops that part. Is it possible to add support for this?

Can't work in Mac

I try to use the bash_powerline.sh file to replace my .bash_profile. But after that, I open a new terminal, I try to open ipython which is working well before, but it shows command not found. What should I do to make it work?

terminal title

XTERM_TITLE='\[\e]0;\u@\H: \w\a\]'
then change
PS1="$XTERM_TITLE$cwd$git$symbol"

(I am too lazy to do a pull request)

Slow all of a sudden.

I have to say this is perfect and I have been using this for some time, however all of a sudden it's taking several minutes to load terminal and I have narrowed this down to powerline.

Do you have any suggestion on how I could debug this to find the root cause?

Would you please use the following code

I like bash-powerline very much. I think the following code is much portable

readonly SYMBOL_GIT_BRANCH=$(echo -e '\ue0a0')

I use Linux and Windows. I think the branch glyphs can not display on my environment.

'Open new tab' In MacOS Sierra Terminal opens in the home folder always

#.. when it is supposed to open the new tab in the same folder from where Cmd+T (Shell | New Tab | New Tab with [same] Settings) was pressed. Oh, and I am using the default bash terminal.

This works fine in Ubuntu 16.04 (when I press Ctrl+Shift+T to open a new tab).

The only change I have made to the bash-powerline.sh file (in Mac and Ubuntu) is to add one line to the function ps1() to add a new line #character:
PS1+="\e[m \n$ "

And, in .bashrc, the last line is this
source ~/.bash-powerline.sh

It works fine in MacOS if I uncomment the above last line in .bashrc.

Any idea how to resolve this? Thanks.

Project activity

Hi,

I see a few good pull requests. Is there someone up to review and apply them ?

I'm able to help if needed.

Thanks.

Thing of beauty

Not an issue, just a thank you. I've tried alternatives that turned out to be too slow on my machine. What a brilliant idea to use bash in this.

It's sooo much faster. Thank you ๐Ÿ‘ ๐Ÿ’ฏ

PS1 for short prompt possible?

Is it possible to add a short prompt?

something like:

PS1='[\u@\h \W]\$ '

E.g.

~/Documents/folder/foo/bar

will be displayed as

[user@machine .bar]$

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.