Giter Site home page Giter Site logo

prompt's Introduction

prompt

A fast, simple bash prompt.

prompt screenshot

Installation

$ cd $WHERE_YOU_KEEP_GITHUB_REPOS
$ git clone https://github.com/skeswa/prompt
$ cd prompt
$ make install
$ . ~/.bashrc

Features

  • Path shortening (~/some/really/long/path/like/this/you/might/see โ†’ ~/some/really/l/p/l/t/y/might/see)
  • Basic git branch or ref information
  • Relatively good performance (we try to limit sub-shells as much as possible)
  • Customizable colors
  • Good documentation (lotsa comments - just in case you want to tweak something)
  • Git tab-completion
  • Autocomplete command history with arrow keys
  • Makes bash feel a little more modern

Assumptions

  • We assume that you have bash installed at version 3.0.0 or higher
  • We assume that you have git installed at version 2.0.0 or higher
  • We assume that your terminal supports 256 colors
  • We assume that your terminal color scheme has a dark(ish) background

How to update

$ cd $WHERE_YOU_KEEP_GITHUB_REPOS/prompt
$ git pull
$ . ~/.bashrc

Configuration

Colors

Colors can be customized by editing the following environment variables:

  • PROMPT_PWD_COLOR - Color for the current working directory (e.g. ~/a/b/c), defaults to 38;5;43
  • PROMPT_GIT_COLOR - Color for the current git branch/ref (e.g. :master), defaults to 38;5;105
  • PROMPT_USERHOST_COLOR - Color for the current user session info (e.g. corey@desktop), defaults to 38;5;39
  • PROMPT_DOLLAR_COLOR - Color for the dollar sign, defaults to 38;5;255
  • PROMPT_ERROR_COLOR - Color for the dollar sign when the previous command failed, defaults to 38;5;204

To come up with your own colors, take a look at the reference graphic below from wikipedia:

color table

Custom hostname

You can override the host name of your prompt (the desktop part of corey@desktop) by setting the PROMPT_HOST_NAME environment variable. For example, if your desired prompt is corey@inthehouse, then you might stick this in your ~/.bashrc before the . ~/.prompt/prompt.bash:

export PROMPT_HOST_NAME='inthehouse'

How does it work?

bash provides a special set of variables for your prompts. PS1 is the one used by default. The install script adds a command to ~/.bashrc, a file that is run every time a new terminal opens. Inside of the new command, we run our script and set your PS1 which runs some git commands to determine its current state and outputs them as a string.

Support

Linux and Mac OSX are supported platforms.

Try on Windows at your own peril.

Uninstallation

To uninstall prompt, perform the following steps:

  • Remove . ~/.prompt/prompt.bash and . ~/.prompt/git-completion.bash from ~/.bashrc
  • Delete ~/.prompt (e.g. rm ~/.prompt)
  • Remove the repository folder from which prompt was originally installed
  • During installation, we may have added a . ~/.bashrc invocation to ~/.bash_profile, ~/.bash_login, or ~/.profile
    • Feel free to remove this if it's no longer necessary

License

Copyright (c) 2017 Sandile Keswa

Licensed under the MIT license.

prompt's People

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

Watchers

 avatar  avatar  avatar  avatar  avatar

prompt's Issues

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.