Home

Awesome

Archived project. No maintenance.

What does this mean? No further code will be committed and the repository will remain in a read-only state.

Why? I no longer have the time to maintain this project.

Feel free to fork and make your own changes if needed :)

Mímir

GitHub Release Build Status Go Report Card Software License

Mímir is a fast and minimal shell prompt written in Go. The look of Mímir is inspired by Pure and the functionality is inspired by prettyprompt.

asciicast

The Mímir Go binary only displays the (pre) prompt line with all the information. The actual prompt line used for input is configured in the shell's config file. This allows for flexibility:

Features

Installation

Installer script

The simplest way to install Mímir on Linux or macOS is to run:

$ sh -c "$(curl -sL git.io/getmimir)"

This will put the binary in /usr/local/bin/mimir

Pre-compiled binaries

Pre-compiled binaries for Linux and macOS are avaiable on the releases page.

The binaries are static executables.

Homebrew

$ brew install talal/tap/mimir

Building from source

The only required build dependency is Go 1.11 or above.

$ git clone https://github.com/talal/mimir.git
$ cd mimir
$ make install

This will put the binary in /usr/local/bin/mimir

Alternatively, you can also build Mímir directly with the go get command without manually cloning the repository:

$ go get -u github.com/talal/mimir

This will put the binary in $GOPATH/bin/mimir

Usage

The following usage examples are just one example of how Mímir can be configured. The examples below will result in a setup similar to the one shown in the demo above: the prompt symbol () changes to red if the previous command exited with an error.

Bash

Add this to your .bashrc file:

prompt_mimir_cmd() {
  if [ $? != 0 ]; then
    local prompt_symbol="\[\e[0;31m\]❯\[\e[0m\]"
  else
    local prompt_symbol="\[\e[0;35m\]❯\[\e[0m\]"
  fi

  PS1="$(/path/to/mimir)\n${prompt_symbol} "
}
PROMPT_COMMAND=prompt_mimir_cmd

Zsh

Add this to your .zshrc file:

autoload -Uz add-zsh-hook
prompt_mimir_cmd() { /path/to/mimir }
add-zsh-hook precmd prompt_mimir_cmd

prompt_symbol='❯'
PROMPT="%(?.%F{magenta}.%F{red})${prompt_symbol}%f "

Options

OptionDescriptionUsage
MIMIR_DISABLE_KUBEDisable Kubernetes context and namespace info.export MIMIR_DISABLE_KUBE=1
MIMIR_DISABLE_CLOUDDisable OpenStack cloud info.export MIMIR_DISABLE_CLOUD=1
CURRENT_KUBE_CTXDisplay arbitrary info for K8s.export CURRENT_KUBE_CTX='custom info'
CURRENT_OS_CLOUDDisplay arbitrary info for OpenStack.export CURRENT_OS_CLOUD='custom info'

Credits

Most of the source code is borrowed from prettyprompt.