Git Product home page Git Product 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!

punctual-zsh-theme's People

Contributors

dannynimmo avatar gijsvermarien 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

punctual-zsh-theme's Issues

bold text

Is there anyway to make some text bold like username?

Idea: Removing initial blank line; it is possible?

When you start the terminal there is a space between the top and the initial text output. Can this space be removed to better identify the starting point?

I love your theme. Excellent job!

_diortem

Align conda env name

Could you align conda env name with the second line prompt?
image
I think this may be like "virtualenv could be integrated a little more nicelyβ€œ in #1.

The environment name seems to be added by conda. There are two environment variables set by conda. When a conda env is activated, CONDA_DEFAULT_ENV and CONDA_PROMPT_MODIFIER are set. For examples,

CONDA_DEFAULT_ENV=base
CONDA_PROMPT_MODIFIER=(base)

When conda env not activated, these env variables don't exit.
However, as for #2 , virtualenv may use different enc variables.

And changeps1: False in conda config file can prevent conda change prompt.

Thank you!

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.