GithubHelp home page GithubHelp logo

willeccles / promptus Goto Github PK

View Code? Open in Web Editor NEW
15.0 2.0 0.0 20 KB

๐ŸŒต Very quick shell prompt that supports multiple shells.

License: MIT License

Makefile 8.30% C 91.70%
shell-prompt c cactus bash-prompt zsh-prompt bash zsh

promptus's Introduction

Promptus

Simple and configurable shell prompt program in C which can be used to make your prompt the same on any shell.

preview of promptus

Features

Promptus is very simple, but has some convenience features for those who want them:

  • Display of the PWD (enabled by default)
  • Basename of PWD (enabled by default)
  • Abbreviation of $HOME to ~ (enabled by default)
  • Coloring of prompt based on exit code of previous program (enabled by default)
  • Customizable color set
  • Python venv prefix support

Configuration

See config.h for configuration options.

Building

Modify config.h to suit your needs and then do make. Use make install to install and make uninstall to uninstall.

Usage

Simply running promptus is enough. If PROMPT_STATUS is enabled in config.h, pass the exit code of the previous process as the first argument (or don't, which allows you to disable this feature at runtime without rebuilding promptus).

Bash

If you are using bash and want to use promptus for your prompt, this is how I would do it. Put this in your .bashrc:

export PROMPT_COMMAND=__prompt_command

if command -v promptus >/dev/null; then
    __prompt_command() { PS1="$(promptus $?)" }
else
    __prompt_command() {
        # if you have a default prompt you'd like to use when promptus isn't
        # installed, you should set PS1 here
    }
fi

Zsh

If you are using zsh, things are a little weirder than bash, but work about the same way. Try this:

if command -v promptus >/dev/null; then
    precmd() { PROMPT="$(eval 'promptus $?')" }
fi

# this won't get used if promptus is found above
export PROMPT="my cool prompt $ "

promptus's People

Contributors

willeccles avatar

Stargazers

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

Watchers

 avatar  avatar

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.