/alien-minimal

An asynchronous minimal zsh prompt

Primary LanguageShellMIT LicenseMIT

alien-minimal

GitHub tag

Contributors GitHub last commit (branch) license GitHub issues GitHub closed issues GitHub pull requests GitHub closed pull requests

alien-minimal theme is faster than a lot other themes.

Why? It updates part of the prompt asyncronously - the time consuming processings like git status checking, git dirty copy checking etc.

How? It starts a background job for these process, and in the mean time shows initial prompt and lets you use the terminal as you would normally.

alien-minimal is independent of any library/framework like Oh-My-Zsh or Prezto. Whatever it needs already included.

Installation

Add the following line to your .zshrc depending on your zsh plugin manager

antigen theme eendroroy/alien-minimal alien-minimal
zgen load eendroroy/alien-minimal
zplug "eendroroy/alien-minimal"

Asciicast

asciicast

Customizations

add configurations before plugin definitions

Add start tag and end tag:

export PROMPT_START_TAG='-->'
export PROMPT_END_TAG=' $'
export PROMPT_START_TAG_COLOR=81
export PROMPT_END_TAG_COLOR=81

Result:

 --> ~ $
 --> ~ $ 1
(venv) --> python-project $
(venv) --> python-project $ 130

You can additionally show the error color on prompt start tag:

export AM_ERROR_ON_START_TAG=1

Note: if PROMPT_START_TAG is empty, this configuration will be ignored.

Show versions:

Available version are: RUBY PYTHON JAVA GO CRYSTAL

export AM_VERSIONS_PROMPT=(RUBY PYTHON JAVA GO CRYSTAL)

Note: Prompt maintain declaration order.

Show execution time for each process:

export AM_SHOW_PROCESS_TIME=0 # hide
export AM_SHOW_PROCESS_TIME=1 # show
export AM_SHOW_PROCESS_TIME=2 # show if not 0

Note: Unset AM_SHOW_PROCESS_TIME to hide process time.

Configure dirname in prompt:

export AM_SHOW_FULL_DIR=1 # shows the full dir path
export AM_SHOW_FULL_DIR=0 # shows the current dir name

Update left prompt asynchrononusly (initially show full directory path, update to short form later, this is just a fancy option)

export AM_UPDATE_L_PROMPT=1

Note: this overrides AM_SHOW_FULL_DIR configuration.

The effect may be un-noticable on faster CPUs.

Hide exit code:

export AM_HIDE_EXIT_CODE=1

Color themes:

1. export AM_THEME=mono
2. export AM_THEME=mono_bright
2. export AM_THEME=terminal
2. export AM_THEME=soft
2. export AM_THEME=default

Note: Unset AM_THEME to use default color scheme.

Apart from these default themes, custom colors can be defined:

export am_vcs_color=1          # color for VCS (G: M: V:)
export am_ssh_color=11         # color for ssh indicaator
export am_normal_color=12      # color for normal text
export am_error_color=1        # color for ERROR
export am_rev_color=14         # color for VCS Revision number
export am_branch_color=10      # color for VCS BRANCH name
export am_left_right_color=3   # color for GIT Left-Right status
export am_commit_since_color=6 # color for last commit time
export am_fade_color=8         # color for fade text color
export am_venv_color=8         # color fir python virtual env text
export am_python_color=2       # color for python version text
export am_ruby_color=1         # color for ruby version text
export am_java_color=15        # color for java version text
export am_node_color=15        # color for node version text
export am_timer_color=14       # color for command execution time

Or creating a new theme file:

/path/to/custom/theme.zsh

#!/usr/bin/env zsh

am_theme(){
  [[ -z $am_vcs_color ]]          && am_vcs_color=248
  [[ -z $am_ssh_color ]]          && am_ssh_color=143
  [[ -z $am_normal_color ]]       && am_normal_color=39
  [[ -z $am_error_color ]]        && am_error_color=208
  [[ -z $am_rev_color ]]          && am_rev_color=248
  [[ -z $am_branch_color ]]       && am_branch_color=78
  [[ -z $am_left_right_color ]]   && am_left_right_color=222
  [[ -z $am_commit_since_color ]] && am_commit_since_color=244
  [[ -z $am_fade_color ]]         && am_fade_color=242
  [[ -z $am_venv_color ]]         && am_venv_color=245
  [[ -z $am_python_color ]]       && am_python_color=40
  [[ -z $am_ruby_color ]]         && am_ruby_color=196
  [[ -z $am_java_color ]]         && am_java_color=178
  [[ -z $am_node_color ]]         && am_node_color=64
  [[ -z $am_timer_color ]]        && am_timer_color=248
}

Then activate the theme using:

export AM_CUSTOM_THEME_PATH=/path/to/custom/theme.zsh

Nerd Font:

Nerd Font must be installed nerd-fonts

Enable Nerd Font

export USE_NERD_FONT=1

promptlib-zsh Configs:

customize symbols

export AM_JAVA_SYM='J:'     # JAVA Version Symbol
export AM_PY_SYM='P:'       # Python Version Symbol
export AM_NODE_SYM='N:'     # Python Version Symbol
export AM_RB_SYM='R:'       # Ruby Version Symbol
export AM_GIT_SYM=G         # Git Symbol
export AM_HG_SYM=M          # Mercurial Symbol
export AM_SSH_SYM=[S]       # SSH Indicator Symbol
export PLIB_GIT_ADD_SYM=+   # Git New Tracked File Symbol
export PLIB_GIT_DEL_SYM=-   # Git Deleted File Symbol
export PLIB_GIT_MOD_SYM=⭑   # Git Modified File Symbol
export PLIB_GIT_NEW_SYM=?   # Git New Untracked File Symbol
export PLIB_GIT_PUSH_SYM=↑  # Git Unpushed Commit Symbol
export PLIB_GIT_PULL_SYM=↓  # Git New Commit Symbol

Note: this overrides USE_NERD_FONT configuration.

customize colors

export PLIB_GIT_TRACKED_COLOR=green
export PLIB_GIT_UNTRACKED_COLOR=red

Libraries Used

Contributing

Bug reports and pull requests are welcome on GitHub at alien-minimal repository. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

Author

License

The project is available as open source under the terms of the MIT License.