Skip to content

In the year 20XX, one zsh prompt stepped forward to save the world...

License

Notifications You must be signed in to change notification settings

willghatch/zsh-megaprompt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Depends

You must load zsh-hooks before this plugin.

Install

I recommend using zgen. Here is how to do it with zgen:

zgen load willghatch/zsh-hooks
zgen load willghatch/zsh-megaprompt

Otherwise, just source the .zsh files

Features

  • Maximal information
  • Directory coloring based on permissions/ownership
  • shows git/hg branch if in repo
  • shows current keymap indicator (I suggest replacing vi-ins with emacs, then you get the best of both worlds)
  • shows exit status if non-zero
  • shows number of jobs if non-zero
  • shows time (useful when you want to know when you ran an old command)
  • shows history number (useful for history expansion)
  • shows user/host
  • configure which of these are displayed

Configuration

  • MEGAPROMPT_STYLES is an associative array of styles to color codes or strings for different parts
  • MEGAPROMPT_KEYMAP_IND is an associative array of keymap names to their indicators
  • MEGAPROMPT_PRE_FUNCTION is the name of a function to call to generate a prefix to the prompt. This allows you to add something custom before the start of the prompt.
  • MEGAPROMPT_DISPLAY_P is an associative array of display pieces to "true" or "false"
    • git_dirty do you want to be informed when your git repo is dirty? (note: this may be slow)
    • git_untracked do you want to be informed when your git repo is has untracked files?
    • git_ahead_behind do you want to be informed when your git repo ahead or behind of its tracking branch?
    • time do you want the time of the command? (Yes -- it's useful later when you want to know when you ran something)
    • username do you want to see your username? (I recommend setting it to false for your normal username, true otherwise)
    • host do you want to see your hostname? (I recommend setting it to false unless $SSH_CLIENT or $TMUX is set)
    • tty do you want to see what tty you're on?
    • histnum do you want to see what history number you're on? (useful for history expansion)
    • hrule do you want a horizontal line to go to the end of the line to visually delimit output from different commands?
    • truncate do you want to truncate the top line if it is longer than your terminal? (this also happens if hrule is on)
    • branch_style_regex do you want to match branch styles using regex (requires zsh to be compiled with PCRE support)?
  • MEGAPROMPT_GIT_STYLES is an an associative array of regexes to colors for git branch names

These arrays are defined at the top of the source, so just look at it to see what fields exist on the ones I haven't documented. There are a lot of fields.

Screenshots

These screenshots are out of date, but I haven't wanted to bother updating them. Example Example Example Example Example

Issues

  • This was written primarily for zsh version 5. With version 4.3.17 it works fine except that the keymap indicator doesn't initialize properly until after the first command or keymap change.
  • The hrule option (MEGAPROMPT_DISPLAY_P[hrule]=true) and the truncate option don't work well below zsh version 5.0.7 -- they are truncated a little too early and therefore don't span the whole line like they are supposed to.
  • The PCRE module is required for git branch coloring. As far as I know all distributions include it.

About

In the year 20XX, one zsh prompt stepped forward to save the world...

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages