Giter VIP home page Giter VIP logo

punctual-zsh-theme's Introduction

Punctual, a Zsh prompt theme

Screenshot of Punctual in action

Add a bit of flavour to your prompt! My personal Zsh prompt theme, influenced heavily by denysdovhan's Spaceship theme.

Features

  • Customisable colours & output
  • Git branch & status display
  • Username turns red when root
  • Prompt turns red if the last command finishes with non-zero exit code

Installation

In the screenshot above I'm using Solarized colours for iTerm2, along with the Inconsolata font.

Oh My Zsh

  1. Download punctual.zsh-theme into your custom theme directory, $ZSH_CUSTOM/themes
  2. Update ZSH_THEME="punctual" in your ~/.zshrc
  3. Open a new terminal to see the theme

Antigen

Include the following line to ~/.zshrc as part of your antigen setup (after any configuration settings).

antigen theme dannynimmo/punctual-zsh-theme punctual

Configuration

By setting variables before loading the theme, you can customise the output format of Punctual.

Hiding parts

Set any of the following variables to "false" to hide the output.

PUNCTUAL_SHOW_BLANK_LINE="false";
PUNCTUAL_SHOW_TIMESTAMP="false";
PUNCTUAL_SHOW_USER="false";
PUNCTUAL_SHOW_HOSTNAME="false";
PUNCTUAL_SHOW_CURRENT_DIR="false";
PUNCTUAL_SHOW_GIT="false";

Colours

Set any of the following variables to one of the 8 ANSI colour names.

PUNCTUAL_TIMESTAMP_COLOUR="red";
PUNCTUAL_USER_COLOUR="green";
PUNCTUAL_ROOT_USER_COLOUR="yellow";
PUNCTUAL_HOSTNAME_COLOUR="blue";
PUNCTUAL_CURRENT_DIR_COLOUR="magenta";
PUNCTUAL_GIT_COLOUR="cyan";

Possible values are:

  • black
  • red
  • green
  • yellow
  • blue
  • magenta
  • cyan
  • white

Bold fonts

Set any of the following variables to "true" to use the terminal's bold font.

PUNCTUAL_TIMESTAMP_BOLD="true";
PUNCTUAL_USER_BOLD="true";
PUNCTUAL_ROOT_USER_BOLD="true";
PUNCTUAL_HOSTNAME_BOLD="true";
PUNCTUAL_CURRENT_DIR_BOLD="true";
PUNCTUAL_GIT_BOLD="true";

Timestamp format

Set the below variable to customise the timestamp format. See man strftime for format options.

PUNCTUAL_TIMESTAMP_FORMAT="%l:%M%P";

Prompt symbol

Set the below variable to your favourite prompt symbol (or emoji ๐Ÿ˜…).

PUNCTUAL_PROMPT="$";

Git status symbols

If you already have your ZSH_THEME_GIT_PROMPT_* variables set, Punctual will respect those. Alternatively, set the following variables to customise the Git status symbols.

PUNCTUAL_GIT_SYMBOL_UNTRACKED="?";
PUNCTUAL_GIT_SYMBOL_ADDED="+";
PUNCTUAL_GIT_SYMBOL_MODIFIED="!";
PUNCTUAL_GIT_SYMBOL_RENAMED="!";
PUNCTUAL_GIT_SYMBOL_DELETED="!";
PUNCTUAL_GIT_SYMBOL_STASHED="*";
PUNCTUAL_GIT_SYMBOL_UNMERGED="M";
PUNCTUAL_GIT_SYMBOL_AHEAD="โ†‘";
PUNCTUAL_GIT_SYMBOL_BEHIND="โ†“";
PUNCTUAL_GIT_SYMBOL_DIVERGED="~";

Python environments

The Python environment being used (conda or virtualenvironment) will be added if the following flag is set to true (false by default) in your .zshrc:

PUNCTUAL_SHOW_PYTHON_ENVIRONMENT=true

For conda, run the following command to disable the prompt that appears at the start of the line by default:

conda config --set changeps1 False

```zsh
And similarly for python virtual environments you can add (either of) the following commands to your .zshrc to disable the prompt:
       
```zsh
export VIRTUAL_ENV_DISABLE_PROMPT=1;
export PYENV_VIRTUALENV_DISABLE_PROMPT=1;

Changelog

0.4.0 โ€” 2022-12-12

  • Added Python support

0.3.0 โ€” 2020-11-19

  • Added ability to disable the initial new line

0.2.0 โ€” 2016-09-16

  • Added ability to use bold fonts

0.1.0 โ€” 2016-08-01

  • Released!

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.