Init
No files matched your search
@@ -0,0 +1,2 @@
|
||||
node_modules/
|
||||
.DS_Store
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2016 Caio Gondim
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,366 @@
|
||||
<img src="http://rawgit.com/caiogondim/bullet-train-oh-my-zsh-theme/master/img/icon.svg" width="100%" />
|
||||
|
||||
# Bullet Train for oh-my-zsh <a href="http://webchat.freenode.net/?channels=bullettrain-sh" target="_blank"><img src="https://img.shields.io/badge/IRC-bullettrain–sh-1e72ff.svg?style=flat" height="20"></a>
|
||||
|
||||
Bullet Train is a [oh-my-zsh shell](https://github.com/robbyrussell/oh-my-zsh)
|
||||
theme based on the
|
||||
[Powerline Vim plugin](https://github.com/Lokaltog/vim-powerline). It aims for
|
||||
simplicity, showing information only when it's relevant.
|
||||
|
||||
It currently shows:
|
||||
- Current Python virtualenv; when using Pyenv and no active virtualenv shows the current Python version the shell uses
|
||||
- Current Ruby version using chruby; version and gemset when on RVM or Rbenv
|
||||
- Current Node.js version, through NVM (if present) or Node.js
|
||||
- Current Perl version using plenv
|
||||
- Current Elixir version
|
||||
- Git status
|
||||
- Timestamp
|
||||
- Current directory
|
||||
- Background jobs
|
||||
- Exit code of last command
|
||||
|
||||
If you want add some new feature, of fix some bug, open an issue and lets hack
|
||||
together.
|
||||
|
||||
For a tmux theme to work with it, I suggest [Maglev](https://github.com/caiogondim/maglev).
|
||||
|
||||
## Preview
|
||||
|
||||

|
||||
|
||||
|
||||
## Requirements
|
||||
|
||||
In order to use the theme, you will first need:
|
||||
|
||||
* Powerline compatible fonts like [Vim Powerline patched fonts](https://github.com/Lokaltog/powerline-fonts), [Input Mono](http://input.fontbureau.com/) or [Monoid](http://larsenwork.com/monoid/).
|
||||
* On Ubuntu like systems you'll need the `ttf-ancient-fonts` package to correctly display some unicode symbols that are not covered by the Powerline fonts above.
|
||||
* A ZSH framework like [antigen](https://github.com/zsh-users/antigen), [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh) or [zgen](https://github.com/tarjoilija/zgen)
|
||||
* Make sure terminal is using 256-colors mode with `export TERM="xterm-256color"`
|
||||
* For [iTerm 2](http://iterm2.com/) users, make sure you go into your settings and set both the regular font and the non-ascii font to powerline compatible [fonts](https://github.com/powerline/fonts) or the prompt separators and special characters will not display correctly.
|
||||
|
||||
|
||||
## Installing
|
||||
|
||||
### For oh-my-zsh users
|
||||
|
||||
1. Download the theme [here](http://raw.github.com/caiogondim/bullet-train-oh-my-zsh-theme/master/bullet-train.zsh-theme)
|
||||
|
||||
2. Put the file **bullet-train.zsh-theme** in **$ZSH_CUSTOM/themes/**
|
||||
|
||||
3. Configure the theme in your **~/.zshrc** file:
|
||||
|
||||
```bash
|
||||
ZSH_THEME="bullet-train"
|
||||
```
|
||||
|
||||
### For antigen users
|
||||
|
||||
Add the following snippet to your **.zshrc** somewhere after the line
|
||||
`antigen use oh-my-zsh`.
|
||||
|
||||
```bash
|
||||
antigen theme https://github.com/caiogondim/bullet-train-oh-my-zsh-theme bullet-train
|
||||
```
|
||||
|
||||
### For Zgen users
|
||||
|
||||
If you're using [zgen](https://github.com/tarjoilija/zgen), add the following line to your **~/.zshrc** where you're adding your other zsh plugins **after** the line `zgen oh-my-zsh`.
|
||||
|
||||
```bash
|
||||
zgen load caiogondim/bullet-train-oh-my-zsh-theme bullet-train
|
||||
```
|
||||
|
||||
### For Zplug users
|
||||
|
||||
If you're using [zplug](https://github.com/zplug/zplug), add the following line
|
||||
to your **~/.zshrc** where you're adding your other zsh plugins.
|
||||
|
||||
```bash
|
||||
setopt prompt_subst # Make sure prompt is able to be generated properly.
|
||||
zplug "caiogondim/bullet-train.zsh", use:bullet-train.zsh-theme, defer:3 # defer until other plugins like oh-my-zsh is loaded
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
Bullet Train is configurable. You can change colors and which segments you want
|
||||
or don't want to see. All options must be overridden in your **.zshrc** file.
|
||||
|
||||
### Order
|
||||
`BULLETTRAIN_PROMPT_ORDER` defines order of prompt segments. Use zsh array
|
||||
syntax to specify your own order, e.g:
|
||||
|
||||
```bash
|
||||
BULLETTRAIN_PROMPT_ORDER=(
|
||||
git
|
||||
context
|
||||
dir
|
||||
time
|
||||
)
|
||||
```
|
||||
|
||||
NOTE: You do not need to specify *end* segment - it will be added automatically. With this you can also specify custom segments.
|
||||
|
||||
### Prompt
|
||||
|
||||
|Variable|Default|Meaning
|
||||
|--------|-------|-------|
|
||||
|`BULLETTRAIN_PROMPT_CHAR`|`\$`|Character to be show before any command
|
||||
|`BULLETTRAIN_PROMPT_ROOT`|`true`|Highlight if running as root
|
||||
|`BULLETTRAIN_PROMPT_SEPARATE_LINE`|`true`|Make the prompt span across two lines
|
||||
|`BULLETTRAIN_PROMPT_ADD_NEWLINE`|`true`|Adds a newline character before each prompt line
|
||||
|
||||
|
||||
### Status
|
||||
|
||||
|Variable|Default|Meaning
|
||||
|--------|-------|-------|
|
||||
|`BULLETTRAIN_STATUS_EXIT_SHOW`|`false`|Show/hide exit code of last command
|
||||
|`BULLETTRAIN_STATUS_BG`|`green`|Background color
|
||||
|`BULLETTRAIN_STATUS_ERROR_BG`|`red`|Background color of segment when last command exited with an error
|
||||
|`BULLETTRAIN_STATUS_FG`|`black`|Foreground color
|
||||
|
||||
### Time
|
||||
|
||||
|Variable|Default|Meaning
|
||||
|--------|-------|-------|
|
||||
|`BULLETTRAIN_TIME_12HR`|`false`|Format time using 12-hour clock (am/pm)
|
||||
|`BULLETTRAIN_TIME_BG`|`white`|Background color
|
||||
|`BULLETTRAIN_TIME_FG`|`black`|Foreground color
|
||||
|
||||
### Custom
|
||||
|
||||
|Variable|Default|Meaning
|
||||
|--------|-------|-------|
|
||||
|`BULLETTRAIN_CUSTOM_MSG`|`false`|Free segment you can put a custom message which will be eval'ed for every prompt
|
||||
|`BULLETTRAIN_CUSTOM_BG`|`black`|Background color
|
||||
|`BULLETTRAIN_CUSTOM_FG`|`default`|Foreground color
|
||||
|
||||
### Context
|
||||
|
||||
|Variable|Default|Meaning
|
||||
|--------|-------|-------|
|
||||
|`BULLETTRAIN_CONTEXT_BG`|`black`|Background color
|
||||
|`BULLETTRAIN_CONTEXT_FG`|`default`|Foreground color
|
||||
|`BULLETTRAIN_CONTEXT_DEFAULT_USER`|none|Default user. If you are running with other user other than default, the segment will be showed.
|
||||
|`BULLETTRAIN_CONTEXT_HOSTNAME`|`%m`|Hostname. Set %M to display the full qualified domain name.
|
||||
|`BULLETTRAIN_IS_SSH_CLIENT`|none|If `true`, the segment will be showed.
|
||||
|
||||
### Python virtualenv (+Pyenv)
|
||||
|
||||
|Variable|Default|Meaning
|
||||
|--------|-------|-------|
|
||||
|`BULLETTRAIN_VIRTUALENV_BG`|`yellow`|Background color
|
||||
|`BULLETTRAIN_VIRTUALENV_FG`|`white`|Foreground color
|
||||
|`BULLETTRAIN_VIRTUALENV_PREFIX`|`🐍`|Prefix of the segment
|
||||
|
||||
### node.js nvm
|
||||
|
||||
|Variable|Default|Meaning
|
||||
|--------|-------|-------|
|
||||
|`BULLETTRAIN_NVM_BG`|`green`|Background color
|
||||
|`BULLETTRAIN_NVM_FG`|`white`|Foreground color
|
||||
|`BULLETTRAIN_NVM_PREFIX`|`"⬡ "`|Prefix of the segment
|
||||
|
||||
### Ruby RVM/Rbenv
|
||||
|
||||
|Variable|Default|Meaning
|
||||
|--------|-------|-------|
|
||||
|`BULLETTRAIN_RUBY_BG`|`magenta`|Background color
|
||||
|`BULLETTRAIN_RUBY_FG`|`white`|Foreground color
|
||||
|`BULLETTRAIN_RUBY_PREFIX`|`"♦"`|Prefix of the segment
|
||||
|
||||
### Elixir
|
||||
|
||||
|Variable|Default|Meaning
|
||||
|--------|-------|-------|
|
||||
|`BULLETTRAIN_ELIXIR_BG`|`magenta`|Background color
|
||||
|`BULLETTRAIN_ELIXIR_FG`|`white`|Foreground color
|
||||
|`BULLETTRAIN_ELIXIR_PREFIX`|`"💧"`|Prefix of the segment
|
||||
|
||||
### Go
|
||||
|
||||
|Variable|Default|Meaning
|
||||
|--------|-------|-------|
|
||||
|`BULLETTRAIN_GO_BG`|`green`|Background color
|
||||
|`BULLETTRAIN_GO_FG`|`white`|Foreground color
|
||||
|`BULLETTRAIN_GO_PREFIX`|`go`|Prefix of the segment
|
||||
|
||||
### Kubernetes Context
|
||||
|
||||
|Variable|Default|Meaning
|
||||
|--------|-------|-------|
|
||||
|`BULLETTRAIN_KCTX_BG`|`yellow`|Background color
|
||||
|`BULLETTRAIN_KCTX_FG`|`white`|Foreground color
|
||||
|`BULLETTRAIN_KCTX_PREFIX`|`⎈`|[Kubernetes](https://unicode-table.com/de/2388/) prefix of the segment
|
||||
|`BULLETTRAIN_KCTX_KUBECTL`|`true`|If `false` disable `kubectl` usage
|
||||
|`BULLETTRAIN_KCTX_NAMESPACE`|`true`|If `false` will not show the default namespace. Namespace is only visible if `kubectl` is installed
|
||||
|`BULLETTRAIN_KCTX_KCONFIG`|`${HOME}/.kube/config`|Location of kube config file (e.g. /Users/Hugo/.kube/config)
|
||||
|
||||
The prompt will first check if `BULLETTRAIN_KCTX_KUBECTL=true` and `kubectl` is installed than it will use `kubectl config view --minify` to determine the context and default namespace in use.
|
||||
If `BULLETTRAIN_KCTX_KUBECTL=false` or `kubectl` is not installed, `BULLETTRAIN_KCTX_KCONFIG` will be parsed to get the current context.
|
||||
|
||||
The usage of `kubectl` allow the prompt to get the default namespace even if you are using multiple kube config files (e.g. KUBECONFIG=~/.kube/config:path-to-config1:path-to-config2)
|
||||
|
||||
|
||||
### AWS Profile
|
||||
|
||||
Displays which AWS (Amazon Web Services) credentials profile is currently set.
|
||||
This environment var is used by aws-cli and other tools to use the right access keys and other parameters.
|
||||
|
||||
|Variable|Default|Meaning
|
||||
|--------|-------|-------|
|
||||
|`BULLETTRAIN_AWS_BG`|`yellow`|Background color
|
||||
|`BULLETTRAIN_AWS_FG`|`black`|Foreground color
|
||||
|`BULLETTRAIN_AWS_PREFIX`|`☁️`|Prefix of the segment
|
||||
|
||||
### Perl
|
||||
|
||||
|Variable|Default|Meaning
|
||||
|--------|-------|-------|
|
||||
|`BULLETTRAIN_PERL_BG`|`yellow`|Background color
|
||||
|`BULLETTRAIN_PERL_FG`|`black`|Foreground color
|
||||
|`BULLETTRAIN_PERL_PREFIX`|`🐪`|Prefix of the segment
|
||||
|
||||
### Dir
|
||||
|
||||
|Variable|Default|Meaning
|
||||
|--------|-------|-------|
|
||||
|`BULLETTRAIN_DIR_BG`|`blue`|Background color
|
||||
|`BULLETTRAIN_DIR_FG`|`white`|Foreground color
|
||||
|`BULLETTRAIN_DIR_CONTEXT_SHOW`|`false`|Show user and machine in an SCP formatted style
|
||||
|`BULLETTRAIN_DIR_EXTENDED`|`1`|Extended path (0=short path, 1=medium path, 2=complete path, everything else=medium path)
|
||||
|
||||
### Git
|
||||
|
||||
|Variable|Default|Meaning
|
||||
|--------|-------|-------|
|
||||
|`BULLETTRAIN_GIT_COLORIZE_DIRTY`|`false`|Set `BULLETTRAIN_GIT_BG` to `BULLETTRAIN_GIT_COLORIZE_DIRTY_COLOR` in dirty state
|
||||
|`BULLETTRAIN_GIT_COLORIZE_DIRTY_BG_COLOR`|`yellow`|`BULLETTRAIN_GIT_BG` in dirty state
|
||||
|`BULLETTRAIN_GIT_COLORIZE_DIRTY_FG_COLOR`|`black`|`BULLETTRAIN_GIT_FG` in dirty state
|
||||
|`BULLETTRAIN_GIT_BG`|`white`|Background color
|
||||
|`BULLETTRAIN_GIT_FG`|`black`|Foreground color
|
||||
|`BULLETTRAIN_GIT_PROMPT_CMD`|`git_prompt_info`|Function to display details about your git segment.
|
||||
|`BULLETTRAIN_GIT_EXTENDED`|`true`|
|
||||
|`BULLETTRAIN_GIT_PREFIX`|`""`|Prefix
|
||||
|`BULLETTRAIN_GIT_SUFFIX`|`""`|Suffix
|
||||
|`BULLETTRAIN_GIT_DIRTY`|`"✘"`|Icon for dirty state
|
||||
|`BULLETTRAIN_GIT_CLEAN`|`"✔"`|Icon for clean state
|
||||
|`BULLETTRAIN_GIT_ADDED`|`"%F{green}✚%F{black}"`|Icon for added files on stage
|
||||
|`BULLETTRAIN_GIT_MODIFIED`|`"%F{blue}✹%F{black}"`|Icon for modified files
|
||||
|`BULLETTRAIN_GIT_DELETED`|`"%F{red}✖%F{black}"`|Icon for delete files on stage
|
||||
|`BULLETTRAIN_GIT_UNTRACKED`|`"%F{yellow}✭%F{black}"`|Icon for untracked files
|
||||
|`BULLETTRAIN_GIT_RENAMED`|`"➜"`|Icon for renamed
|
||||
|`BULLETTRAIN_GIT_UNMERGED`|`"═"`|Icon for unmerged state
|
||||
|`BULLETTRAIN_GIT_AHEAD`|`" ⬆"`|Icon for ahead state from remote
|
||||
|`BULLETTRAIN_GIT_BEHIND`|`" ⬇"`|Icon for behind state from remote
|
||||
|`BULLETTRAIN_GIT_DIVERGED`|`" ⬍"`|Icon for diverged state from remote
|
||||
|
||||
The git prompt can be disabled for a specific repository by setting a git config flag: `git config oh-my-zsh.hide-status 1`. This is useful to avoid performance issues for particularly huge repositories.
|
||||
|
||||
### Screen
|
||||
|
||||
|Variable|Default|Meaning
|
||||
|--------|-------|-------|
|
||||
|`BULLETTRAIN_SCREEN_BG`|`white`|Background color
|
||||
|`BULLETTRAIN_SCREEN_FG`|`black`|Foreground color
|
||||
|`BULLETTRAIN_SCREEN_PREFIX`|`⬗`|Prefix of the segment
|
||||
|
||||
### Mercurial/HG
|
||||
|
||||
|Variable|Default|Meaning
|
||||
|--------|-------|-------|
|
||||
|
||||
### Command execution time
|
||||
|
||||
|Variable|Default|Meaning
|
||||
|--------|-------|-------|
|
||||
|`BULLETTRAIN_EXEC_TIME_ELAPSED`|5|Minimum elapsed time of command execution. If the execution time of a command is smaller than this, the segment will be hidden.
|
||||
|`BULLETTRAIN_EXEC_TIME_BG`|`yellow`|Background color
|
||||
|`BULLETTRAIN_EXEC_TIME_FG`|`black`|Foreground color
|
||||
|
||||
## Wiki
|
||||
|
||||
- [FAQ](https://github.com/caiogondim/bullet-train-oh-my-zsh-theme/wiki/FAQ)
|
||||
- [Screenshots](https://github.com/caiogondim/bullet-train-oh-my-zsh-theme/wiki/Screenshots)
|
||||
- [Tips](https://github.com/caiogondim/bullet-train-oh-my-zsh-theme/wiki/Tips)
|
||||
|
||||
## Contributors
|
||||
|
||||
That project was originally a fork from
|
||||
[Powerline](https://github.com/jeremyFreeAgent/oh-my-zsh-powerline-theme), but
|
||||
most of the code was later erased and its now more closely related to
|
||||
[Agnoster](https://gist.github.com/agnoster/3712874). Below is a `git summary`
|
||||
of the project:
|
||||
|
||||
```
|
||||
156 Caio Gondim
|
||||
33 Jérémy Romey
|
||||
14 Greg Fitzgerald
|
||||
8 Dan Kaplun
|
||||
8 Viktor (Icon) VAD
|
||||
7 Jocelyn Mallon
|
||||
7 Dawid Kurek
|
||||
6 Joe Block
|
||||
6 Jérémy Romey
|
||||
5 Arthur Wang
|
||||
4 Flavius Aspra
|
||||
3 Mario Zigliotto
|
||||
3 Michael Robinson
|
||||
3 Michael Cornell
|
||||
3 Iulian Onofrei
|
||||
2 itsZero (Chien-An Cho)
|
||||
2 Daniel Loader
|
||||
2 Charlie Smith
|
||||
2 wujtruj
|
||||
2 Jiri Tyr
|
||||
1 Sébastien Bordenave
|
||||
1 Yongqian Li
|
||||
1 alysson
|
||||
1 gvillalta99
|
||||
1 illuminatis
|
||||
1 krischer
|
||||
1 m.kuehn
|
||||
1 timfeirg
|
||||
1 Adrien Brault
|
||||
1 yachi
|
||||
1 Andreas Galauner
|
||||
1 Dale Davis
|
||||
1 Fabio Poloni
|
||||
1 Faure Hu
|
||||
1 Guillaume BINET
|
||||
1 Hannes Frank
|
||||
1 Heng-Yi Wu
|
||||
1 Jack Chu
|
||||
1 Jason Hollis
|
||||
1 KVoll
|
||||
1 Kevin
|
||||
1 Lyncredible
|
||||
1 Manuel Hoffmann
|
||||
1 Marius Krämer
|
||||
1 Maxime Bruguet
|
||||
1 Mertcan Mermerkaya
|
||||
1 Nicholas
|
||||
1 Peter Nagy
|
||||
1 Sen Jiang
|
||||
```
|
||||
|
||||
## Credits
|
||||
|
||||
This theme is highly inspired by the following themes:
|
||||
- [Powerline](https://github.com/jeremyFreeAgent/oh-my-zsh-powerline-theme)
|
||||
- [Agnoster](https://gist.github.com/agnoster/3712874)
|
||||
|
||||
## Donating
|
||||
|
||||
If you found this project useful and are willing to donate, transfer some
|
||||
bitcoins to `1BqqKiZA8Tq43CdukdBEwCdDD42jxuX9UY` or through the
|
||||
[URL](https://www.coinbase.com/caiogondim) https://www.coinbase.com/caiogondim
|
||||
|
||||
Or via [PayPal.me](https://www.paypal.me/caiogondim) https://www.paypal.me/caiogondim.
|
||||
|
||||
---
|
||||
|
||||
[caiogondim.com](https://caiogondim.com) ·
|
||||
GitHub [@caiogondim](https://github.com/caiogondim) ·
|
||||
Twitter [@caio_gondim](https://twitter.com/caio_gondim)
|
||||
@@ -0,0 +1,696 @@
|
||||
# README
|
||||
#
|
||||
# In order for this theme to render correctly, you will need a
|
||||
# [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts).
|
||||
#
|
||||
# In addition, I recommend the
|
||||
# [Tomorrow Night theme](https://github.com/chriskempson/tomorrow-theme) and, if
|
||||
# you're using it on Mac OS X, [iTerm 2](http://www.iterm2.com/) over
|
||||
# Terminal.app - it has significantly better color fidelity.
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# CONFIGURATION
|
||||
# The default configuration, that can be overwrite in your .zshrc file
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
VIRTUAL_ENV_DISABLE_PROMPT=true
|
||||
|
||||
# Define order and content of prompt
|
||||
if [ ! -n "${BULLETTRAIN_PROMPT_ORDER+1}" ]; then
|
||||
BULLETTRAIN_PROMPT_ORDER=(
|
||||
time
|
||||
status
|
||||
custom
|
||||
context
|
||||
dir
|
||||
screen
|
||||
perl
|
||||
ruby
|
||||
virtualenv
|
||||
nvm
|
||||
aws
|
||||
go
|
||||
rust
|
||||
elixir
|
||||
git
|
||||
hg
|
||||
cmd_exec_time
|
||||
)
|
||||
fi
|
||||
|
||||
# PROMPT
|
||||
if [ ! -n "${BULLETTRAIN_PROMPT_CHAR+1}" ]; then
|
||||
BULLETTRAIN_PROMPT_CHAR="\$"
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_PROMPT_ROOT+1}" ]; then
|
||||
BULLETTRAIN_PROMPT_ROOT=true
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_PROMPT_SEPARATE_LINE+1}" ]; then
|
||||
BULLETTRAIN_PROMPT_SEPARATE_LINE=true
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_PROMPT_ADD_NEWLINE+1}" ]; then
|
||||
BULLETTRAIN_PROMPT_ADD_NEWLINE=true
|
||||
fi
|
||||
|
||||
# STATUS
|
||||
if [ ! -n "${BULLETTRAIN_STATUS_EXIT_SHOW+1}" ]; then
|
||||
BULLETTRAIN_STATUS_EXIT_SHOW=false
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_STATUS_BG+1}" ]; then
|
||||
BULLETTRAIN_STATUS_BG=green
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_STATUS_ERROR_BG+1}" ]; then
|
||||
BULLETTRAIN_STATUS_ERROR_BG=red
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_STATUS_FG+1}" ]; then
|
||||
BULLETTRAIN_STATUS_FG=white
|
||||
fi
|
||||
|
||||
# TIME
|
||||
if [ ! -n "${BULLETTRAIN_TIME_BG+1}" ]; then
|
||||
BULLETTRAIN_TIME_BG=white
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_TIME_FG+1}" ]; then
|
||||
BULLETTRAIN_TIME_FG=black
|
||||
fi
|
||||
|
||||
# CUSTOM
|
||||
if [ ! -n "${BULLETTRAIN_CUSTOM_MSG+1}" ]; then
|
||||
BULLETTRAIN_CUSTOM_MSG=false
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_CUSTOM_BG+1}" ]; then
|
||||
BULLETTRAIN_CUSTOM_BG=black
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_CUSTOM_FG+1}" ]; then
|
||||
BULLETTRAIN_CUSTOM_FG=default
|
||||
fi
|
||||
|
||||
# VIRTUALENV
|
||||
if [ ! -n "${BULLETTRAIN_VIRTUALENV_BG+1}" ]; then
|
||||
BULLETTRAIN_VIRTUALENV_BG=yellow
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_VIRTUALENV_FG+1}" ]; then
|
||||
BULLETTRAIN_VIRTUALENV_FG=white
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_VIRTUALENV_PREFIX+1}" ]; then
|
||||
BULLETTRAIN_VIRTUALENV_PREFIX=🐍
|
||||
fi
|
||||
|
||||
# NVM
|
||||
if [ ! -n "${BULLETTRAIN_NVM_BG+1}" ]; then
|
||||
BULLETTRAIN_NVM_BG=green
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_NVM_FG+1}" ]; then
|
||||
BULLETTRAIN_NVM_FG=white
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_NVM_PREFIX+1}" ]; then
|
||||
BULLETTRAIN_NVM_PREFIX="⬡ "
|
||||
fi
|
||||
|
||||
# AWS
|
||||
if [ ! -n "${BULLETTRAIN_AWS_BG+1}" ]; then
|
||||
BULLETTRAIN_AWS_BG=yellow
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_AWS_FG+1}" ]; then
|
||||
BULLETTRAIN_AWS_FG=black
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_AWS_PREFIX+1}" ]; then
|
||||
BULLETTRAIN_AWS_PREFIX="☁️"
|
||||
fi
|
||||
|
||||
# RUBY
|
||||
if [ ! -n "${BULLETTRAIN_RUBY_BG+1}" ]; then
|
||||
BULLETTRAIN_RUBY_BG=red
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_RUBY_FG+1}" ]; then
|
||||
BULLETTRAIN_RUBY_FG=white
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_RUBY_PREFIX+1}" ]; then
|
||||
BULLETTRAIN_RUBY_PREFIX=♦️
|
||||
fi
|
||||
|
||||
# Go
|
||||
if [ ! -n "${BULLETTRAIN_GO_BG+1}" ]; then
|
||||
BULLETTRAIN_GO_BG=cyan
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_GO_FG+1}" ]; then
|
||||
BULLETTRAIN_GO_FG=white
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_GO_PREFIX+1}" ]; then
|
||||
BULLETTRAIN_GO_PREFIX="go"
|
||||
fi
|
||||
|
||||
# Rust
|
||||
if [ ! -n "${BULLETTRAIN_RUST_BG+1}" ]; then
|
||||
BULLETTRAIN_RUST_BG=black
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_RUST_FG+1}" ]; then
|
||||
BULLETTRAIN_RUST_FG=white
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_RUST_PREFIX+1}" ]; then
|
||||
BULLETTRAIN_RUST_PREFIX="🦀"
|
||||
fi
|
||||
|
||||
# Kubernetes Context
|
||||
if [ ! -n "${BULLETTRAIN_KCTX_BG+1}" ]; then
|
||||
BULLETTRAIN_KCTX_BG=yellow
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_KCTX_FG+1}" ]; then
|
||||
BULLETTRAIN_KCTX_FG=white
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_KCTX_PREFIX+1}" ]; then
|
||||
BULLETTRAIN_KCTX_PREFIX="⎈"
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_KCTX_KCONFIG+1}" ]; then
|
||||
BULLETTRAIN_KCTX_KCONFIG="${HOME}/.kube/config"
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_KCTX_KUBECTL+1}" ]; then
|
||||
BULLETTRAIN_KCTX_KUBECTL="true"
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_KCTX_NAMESPACE+1}" ]; then
|
||||
BULLETTRAIN_KCTX_NAMESPACE="true"
|
||||
fi
|
||||
|
||||
# ELIXIR
|
||||
if [ ! -n "${BULLETTRAIN_ELIXIR_BG+1}" ]; then
|
||||
BULLETTRAIN_ELIXIR_BG=magenta
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_ELIXIR_FG+1}" ]; then
|
||||
BULLETTRAIN_ELIXIR_FG=white
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_ELIXIR_PREFIX+1}" ]; then
|
||||
BULLETTRAIN_ELIXIR_PREFIX="💧"
|
||||
fi
|
||||
|
||||
# DIR
|
||||
if [ ! -n "${BULLETTRAIN_DIR_BG+1}" ]; then
|
||||
BULLETTRAIN_DIR_BG=blue
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_DIR_FG+1}" ]; then
|
||||
BULLETTRAIN_DIR_FG=white
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_DIR_CONTEXT_SHOW+1}" ]; then
|
||||
BULLETTRAIN_DIR_CONTEXT_SHOW=false
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_DIR_EXTENDED+1}" ]; then
|
||||
BULLETTRAIN_DIR_EXTENDED=1
|
||||
fi
|
||||
|
||||
# GIT
|
||||
if [ ! -n "${BULLETTRAIN_GIT_COLORIZE_DIRTY+1}" ]; then
|
||||
BULLETTRAIN_GIT_COLORIZE_DIRTY=false
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_GIT_COLORIZE_DIRTY_FG_COLOR+1}" ]; then
|
||||
BULLETTRAIN_GIT_COLORIZE_DIRTY_FG_COLOR=black
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_GIT_COLORIZE_DIRTY_BG_COLOR+1}" ]; then
|
||||
BULLETTRAIN_GIT_COLORIZE_DIRTY_BG_COLOR=yellow
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_GIT_BG+1}" ]; then
|
||||
BULLETTRAIN_GIT_BG=white
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_GIT_FG+1}" ]; then
|
||||
BULLETTRAIN_GIT_FG=black
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_GIT_EXTENDED+1}" ]; then
|
||||
BULLETTRAIN_GIT_EXTENDED=true
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_GIT_PROMPT_CMD+1}" ]; then
|
||||
BULLETTRAIN_GIT_PROMPT_CMD="\$(git_prompt_info)"
|
||||
fi
|
||||
|
||||
# PERL
|
||||
if [ ! -n "${BULLETTRAIN_PERL_BG+1}" ]; then
|
||||
BULLETTRAIN_PERL_BG=yellow
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_PERL_FG+1}" ]; then
|
||||
BULLETTRAIN_PERL_FG=black
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_PERL_PREFIX+1}" ]; then
|
||||
BULLETTRAIN_PERL_PREFIX=🐪
|
||||
fi
|
||||
|
||||
# CONTEXT
|
||||
if [ ! -n "${BULLETTRAIN_CONTEXT_BG+1}" ]; then
|
||||
BULLETTRAIN_CONTEXT_BG=black
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_CONTEXT_FG+1}" ]; then
|
||||
BULLETTRAIN_CONTEXT_FG=default
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_CONTEXT_HOSTNAME+1}" ]; then
|
||||
BULLETTRAIN_CONTEXT_HOSTNAME=%m
|
||||
fi
|
||||
|
||||
# GIT PROMPT
|
||||
if [ ! -n "${BULLETTRAIN_GIT_PREFIX+1}" ]; then
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="\ue0a0 "
|
||||
else
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX=$BULLETTRAIN_GIT_PREFIX
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_GIT_SUFFIX+1}" ]; then
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX=""
|
||||
else
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX=$BULLETTRAIN_GIT_SUFFIX
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_GIT_DIRTY+1}" ]; then
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY=" %F{red}✘%F{black}"
|
||||
else
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY=$BULLETTRAIN_GIT_DIRTY
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_GIT_CLEAN+1}" ]; then
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN=" %F{green}✔%F{black}"
|
||||
else
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN=$BULLETTRAIN_GIT_CLEAN
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_GIT_ADDED+1}" ]; then
|
||||
ZSH_THEME_GIT_PROMPT_ADDED=" %F{green}✚%F{black}"
|
||||
else
|
||||
ZSH_THEME_GIT_PROMPT_ADDED=$BULLETTRAIN_GIT_ADDED
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_GIT_MODIFIED+1}" ]; then
|
||||
ZSH_THEME_GIT_PROMPT_MODIFIED=" %F{blue}✹%F{black}"
|
||||
else
|
||||
ZSH_THEME_GIT_PROMPT_MODIFIED=$BULLETTRAIN_GIT_MODIFIED
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_GIT_DELETED+1}" ]; then
|
||||
ZSH_THEME_GIT_PROMPT_DELETED=" %F{red}✖%F{black}"
|
||||
else
|
||||
ZSH_THEME_GIT_PROMPT_DELETED=$BULLETTRAIN_GIT_DELETED
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_GIT_UNTRACKED+1}" ]; then
|
||||
ZSH_THEME_GIT_PROMPT_UNTRACKED=" %F{yellow}✭%F{black}"
|
||||
else
|
||||
ZSH_THEME_GIT_PROMPT_UNTRACKED=$BULLETTRAIN_GIT_UNTRACKED
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_GIT_RENAMED+1}" ]; then
|
||||
ZSH_THEME_GIT_PROMPT_RENAMED=" ➜"
|
||||
else
|
||||
ZSH_THEME_GIT_PROMPT_RENAMED=$BULLETTRAIN_GIT_RENAMED
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_GIT_UNMERGED+1}" ]; then
|
||||
ZSH_THEME_GIT_PROMPT_UNMERGED=" ═"
|
||||
else
|
||||
ZSH_THEME_GIT_PROMPT_UNMERGED=$BULLETTRAIN_GIT_UNMERGED
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_GIT_AHEAD+1}" ]; then
|
||||
ZSH_THEME_GIT_PROMPT_AHEAD=" ⬆"
|
||||
else
|
||||
ZSH_THEME_GIT_PROMPT_AHEAD=$BULLETTRAIN_GIT_AHEAD
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_GIT_BEHIND+1}" ]; then
|
||||
ZSH_THEME_GIT_PROMPT_BEHIND=" ⬇"
|
||||
else
|
||||
ZSH_THEME_GIT_PROMPT_BEHIND=$BULLETTRAIN_GIT_BEHIND
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_GIT_DIVERGED+1}" ]; then
|
||||
ZSH_THEME_GIT_PROMPT_DIVERGED=" ⬍"
|
||||
else
|
||||
ZSH_THEME_GIT_PROMPT_DIVERGED=$BULLETTRAIN_GIT_PROMPT_DIVERGED
|
||||
fi
|
||||
|
||||
# SCREEN
|
||||
if [ ! -n "${BULLETTRAIN_SCREEN_BG+1}" ]; then
|
||||
BULLETTRAIN_SCREEN_BG=white
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_SCREEN_FG+1}" ]; then
|
||||
BULLETTRAIN_SCREEN_FG=black
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_SCREEN_PREFIX+1}" ]; then
|
||||
BULLETTRAIN_SCREEN_PREFIX="⬗"
|
||||
fi
|
||||
|
||||
# COMMAND EXECUTION TIME
|
||||
if [ ! -n "${BULLETTRAIN_EXEC_TIME_ELAPSED+1}" ]; then
|
||||
BULLETTRAIN_EXEC_TIME_ELAPSED=5
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_EXEC_TIME_BG+1}" ]; then
|
||||
BULLETTRAIN_EXEC_TIME_BG=yellow
|
||||
fi
|
||||
if [ ! -n "${BULLETTRAIN_EXEC_TIME_FG+1}" ]; then
|
||||
BULLETTRAIN_EXEC_TIME_FG=black
|
||||
fi
|
||||
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# SEGMENT DRAWING
|
||||
# A few functions to make it easy and re-usable to draw segmented prompts
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
CURRENT_BG='NONE'
|
||||
SEGMENT_SEPARATOR=''
|
||||
|
||||
# Begin a segment
|
||||
# Takes three arguments, background, foreground and text. All of them can be omitted,
|
||||
# rendering default background/foreground and no text.
|
||||
prompt_segment() {
|
||||
local bg fg
|
||||
[[ -n $1 ]] && bg="%K{$1}" || bg="%k"
|
||||
[[ -n $2 ]] && fg="%F{$2}" || fg="%f"
|
||||
if [[ $CURRENT_BG != 'NONE' && $1 != $CURRENT_BG ]]; then
|
||||
echo -n " %{$bg%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR%{$fg%} "
|
||||
else
|
||||
echo -n "%{$bg%}%{$fg%} "
|
||||
fi
|
||||
CURRENT_BG=$1
|
||||
[[ -n $3 ]] && echo -n $3
|
||||
}
|
||||
|
||||
# End the prompt, closing any open segments
|
||||
prompt_end() {
|
||||
if [[ -n $CURRENT_BG ]]; then
|
||||
echo -n " %{%k%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR"
|
||||
else
|
||||
echo -n "%{%k%}"
|
||||
fi
|
||||
echo -n "%{%f%}"
|
||||
CURRENT_BG=''
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# PROMPT COMPONENTS
|
||||
# Each component will draw itself, and hide itself if no information needs
|
||||
# to be shown
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Context: user@hostname (who am I and where am I)
|
||||
context() {
|
||||
local user="$(whoami)"
|
||||
[[ "$user" != "$BULLETTRAIN_CONTEXT_DEFAULT_USER" || -n "$BULLETTRAIN_IS_SSH_CLIENT" ]] && echo -n "${user}@$BULLETTRAIN_CONTEXT_HOSTNAME"
|
||||
}
|
||||
|
||||
prompt_context() {
|
||||
local _context="$(context)"
|
||||
[[ -n "$_context" ]] && prompt_segment $BULLETTRAIN_CONTEXT_BG $BULLETTRAIN_CONTEXT_FG "$_context"
|
||||
}
|
||||
|
||||
# Based on http://stackoverflow.com/a/32164707/3859566
|
||||
function displaytime {
|
||||
local T=$1
|
||||
local D=$((T/60/60/24))
|
||||
local H=$((T/60/60%24))
|
||||
local M=$((T/60%60))
|
||||
local S=$((T%60))
|
||||
[[ $D > 0 ]] && printf '%dd' $D
|
||||
[[ $H > 0 ]] && printf '%dh' $H
|
||||
[[ $M > 0 ]] && printf '%dm' $M
|
||||
printf '%ds' $S
|
||||
}
|
||||
|
||||
# Prompt previous command execution time
|
||||
preexec() {
|
||||
cmd_timestamp=`date +%s`
|
||||
}
|
||||
|
||||
precmd() {
|
||||
local stop=`date +%s`
|
||||
local start=${cmd_timestamp:-$stop}
|
||||
let BULLETTRAIN_last_exec_duration=$stop-$start
|
||||
cmd_timestamp=''
|
||||
}
|
||||
|
||||
prompt_cmd_exec_time() {
|
||||
[ $BULLETTRAIN_last_exec_duration -gt $BULLETTRAIN_EXEC_TIME_ELAPSED ] && prompt_segment $BULLETTRAIN_EXEC_TIME_BG $BULLETTRAIN_EXEC_TIME_FG "$(displaytime $BULLETTRAIN_last_exec_duration)"
|
||||
}
|
||||
|
||||
# Custom
|
||||
prompt_custom() {
|
||||
if [[ $BULLETTRAIN_CUSTOM_MSG == false ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
local custom_msg
|
||||
eval custom_msg=$BULLETTRAIN_CUSTOM_MSG
|
||||
[[ -n "${custom_msg}" ]] && prompt_segment $BULLETTRAIN_CUSTOM_BG $BULLETTRAIN_CUSTOM_FG "${custom_msg}"
|
||||
}
|
||||
|
||||
# Git
|
||||
prompt_git() {
|
||||
if [[ "$(command git config --get oh-my-zsh.hide-status 2>/dev/null)" == "1" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
local ref dirty mode repo_path git_prompt
|
||||
repo_path=$(git rev-parse --git-dir 2>/dev/null)
|
||||
|
||||
if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
|
||||
if [[ $BULLETTRAIN_GIT_COLORIZE_DIRTY == true && -n $(git status --porcelain --ignore-submodules) ]]; then
|
||||
BULLETTRAIN_GIT_BG=$BULLETTRAIN_GIT_COLORIZE_DIRTY_BG_COLOR
|
||||
BULLETTRAIN_GIT_FG=$BULLETTRAIN_GIT_COLORIZE_DIRTY_FG_COLOR
|
||||
fi
|
||||
prompt_segment $BULLETTRAIN_GIT_BG $BULLETTRAIN_GIT_FG
|
||||
|
||||
eval git_prompt=${BULLETTRAIN_GIT_PROMPT_CMD}
|
||||
if [[ $BULLETTRAIN_GIT_EXTENDED == true ]]; then
|
||||
echo -n ${git_prompt}$(git_prompt_status)
|
||||
else
|
||||
echo -n ${git_prompt}
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
prompt_hg() {
|
||||
local rev status
|
||||
if $(hg id >/dev/null 2>&1); then
|
||||
if $(hg prompt >/dev/null 2>&1); then
|
||||
if [[ $(hg prompt "{status|unknown}") = "?" ]]; then
|
||||
# if files are not added
|
||||
prompt_segment red white
|
||||
st='±'
|
||||
elif [[ -n $(hg prompt "{status|modified}") ]]; then
|
||||
# if any modification
|
||||
prompt_segment yellow black
|
||||
st='±'
|
||||
else
|
||||
# if working copy is clean
|
||||
prompt_segment green black
|
||||
fi
|
||||
echo -n $(hg prompt "☿ {rev}@{branch}") $st
|
||||
else
|
||||
st=""
|
||||
rev=$(hg id -n 2>/dev/null | sed 's/[^-0-9]//g')
|
||||
branch=$(hg id -b 2>/dev/null)
|
||||
if $(hg st | grep -Eq "^\?"); then
|
||||
prompt_segment red black
|
||||
st='±'
|
||||
elif $(hg st | grep -Eq "^(M|A)"); then
|
||||
prompt_segment yellow black
|
||||
st='±'
|
||||
else
|
||||
prompt_segment green black
|
||||
fi
|
||||
echo -n "☿ $rev@$branch" $st
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Dir: current working directory
|
||||
prompt_dir() {
|
||||
local dir=''
|
||||
local _context="$(context)"
|
||||
[[ $BULLETTRAIN_DIR_CONTEXT_SHOW == true && -n "$_context" ]] && dir="${dir}${_context}:"
|
||||
|
||||
if [[ $BULLETTRAIN_DIR_EXTENDED == 0 ]]; then
|
||||
#short directories
|
||||
dir="${dir}%1~"
|
||||
elif [[ $BULLETTRAIN_DIR_EXTENDED == 2 ]]; then
|
||||
#long directories
|
||||
dir="${dir}%0~"
|
||||
else
|
||||
#medium directories (default case)
|
||||
dir="${dir}%4(c:...:)%3c"
|
||||
fi
|
||||
|
||||
prompt_segment $BULLETTRAIN_DIR_BG $BULLETTRAIN_DIR_FG $dir
|
||||
}
|
||||
|
||||
# RUBY
|
||||
# RVM: only shows RUBY info if on a gemset that is not the default one
|
||||
# RBENV: shows current ruby version active in the shell; also with non-global gemsets if any is active
|
||||
# CHRUBY: shows current ruby version active in the shell
|
||||
prompt_ruby() {
|
||||
if command -v rvm-prompt > /dev/null 2>&1; then
|
||||
prompt_segment $BULLETTRAIN_RUBY_BG $BULLETTRAIN_RUBY_FG $BULLETTRAIN_RUBY_PREFIX" $(rvm-prompt i v g)"
|
||||
elif command -v chruby > /dev/null 2>&1; then
|
||||
prompt_segment $BULLETTRAIN_RUBY_BG $BULLETTRAIN_RUBY_FG $BULLETTRAIN_RUBY_PREFIX" $(chruby | sed -n -e 's/ \* //p')"
|
||||
elif command -v rbenv > /dev/null 2>&1; then
|
||||
current_gemset() {
|
||||
echo "$(rbenv gemset active 2&>/dev/null | sed -e 's/ global$//')"
|
||||
}
|
||||
|
||||
if [[ -n $(current_gemset) ]]; then
|
||||
prompt_segment $BULLETTRAIN_RUBY_BG $BULLETTRAIN_RUBY_FG $BULLETTRAIN_RUBY_PREFIX" $(rbenv version | sed -e 's/ (set.*$//')"@"$(current_gemset)"
|
||||
else
|
||||
prompt_segment $BULLETTRAIN_RUBY_BG $BULLETTRAIN_RUBY_FG $BULLETTRAIN_RUBY_PREFIX" $(rbenv version | sed -e 's/ (set.*$//')"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# ELIXIR
|
||||
prompt_elixir() {
|
||||
if command -v elixir > /dev/null 2>&1; then
|
||||
prompt_segment $BULLETTRAIN_ELIXIR_BG $BULLETTRAIN_ELIXIR_FG $BULLETTRAIN_ELIXIR_PREFIX" $(elixir -v | tail -n 1 | awk '{print $2}')"
|
||||
fi
|
||||
}
|
||||
|
||||
# PERL
|
||||
# PLENV: shows current PERL version active in the shell
|
||||
prompt_perl() {
|
||||
if command -v plenv > /dev/null 2>&1; then
|
||||
prompt_segment $BULLETTRAIN_PERL_BG $BULLETTRAIN_PERL_FG $BULLETTRAIN_PERL_PREFIX" $(plenv version | sed -e 's/ (set.*$//')"
|
||||
fi
|
||||
}
|
||||
|
||||
# Go
|
||||
prompt_go() {
|
||||
setopt extended_glob
|
||||
if [[ (-f *.go(#qN) || -d Godeps || -f glide.yaml) ]]; then
|
||||
if command -v go > /dev/null 2>&1; then
|
||||
prompt_segment $BULLETTRAIN_GO_BG $BULLETTRAIN_GO_FG $BULLETTRAIN_GO_PREFIX" $(go version | grep --colour=never -oE '[[:digit:]].[[:digit:]]+')"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Rust
|
||||
prompt_rust() {
|
||||
if [[ (-f Cargo.toml) ]]; then
|
||||
if command -v rustc > /dev/null 2>&1; then
|
||||
prompt_segment $BULLETTRAIN_RUST_BG $BULLETTRAIN_RUST_FG $BULLETTRAIN_RUST_PREFIX" $(rustc -V version | cut -d' ' -f2)"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Kubernetes Context
|
||||
prompt_kctx() {
|
||||
if [[ "$BULLETTRAIN_KCTX_KUBECTL" == "true" ]] && command -v kubectl > /dev/null 2>&1; then
|
||||
local jsonpath='{.current-context}'
|
||||
if [[ "$BULLETTRAIN_KCTX_NAMESPACE" == "true" ]]; then
|
||||
jsonpath="${jsonpath}{':'}{..namespace}"
|
||||
fi
|
||||
prompt_segment $BULLETTRAIN_KCTX_BG $BULLETTRAIN_KCTX_FG $BULLETTRAIN_KCTX_PREFIX" $(kubectl config view --minify --output "jsonpath=${jsonpath}" 2>/dev/null)"
|
||||
elif [[ -f $BULLETTRAIN_KCTX_KCONFIG ]]; then
|
||||
prompt_segment $BULLETTRAIN_KCTX_BG $BULLETTRAIN_KCTX_FG $BULLETTRAIN_KCTX_PREFIX" $(cat $BULLETTRAIN_KCTX_KCONFIG | grep current-context | awk '{print $2}')"
|
||||
fi
|
||||
}
|
||||
|
||||
# Virtualenv: current working virtualenv
|
||||
prompt_virtualenv() {
|
||||
local virtualenv_path="$VIRTUAL_ENV"
|
||||
if [[ -n $virtualenv_path && -n $VIRTUAL_ENV_DISABLE_PROMPT ]]; then
|
||||
prompt_segment $BULLETTRAIN_VIRTUALENV_BG $BULLETTRAIN_VIRTUALENV_FG $BULLETTRAIN_VIRTUALENV_PREFIX" $(basename $virtualenv_path)"
|
||||
elif which pyenv &> /dev/null; then
|
||||
if [[ "$(pyenv version | sed -e 's/ (set.*$//' | tr '\n' ' ' | sed 's/.$//')" != "system" ]]; then
|
||||
prompt_segment $BULLETTRAIN_VIRTUALENV_BG $BULLETTRAIN_VIRTUALENV_FG $BULLETTRAIN_VIRTUALENV_PREFIX" $(pyenv version | sed -e 's/ (set.*$//' | tr '\n' ' ' | sed 's/.$//')"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# NVM: Node version manager
|
||||
prompt_nvm() {
|
||||
local nvm_prompt
|
||||
if type nvm >/dev/null 2>&1; then
|
||||
nvm_prompt=$(nvm current 2>/dev/null)
|
||||
[[ "${nvm_prompt}x" == "x" || "${nvm_prompt}" == "system" ]] && return
|
||||
elif type node >/dev/null 2>&1; then
|
||||
nvm_prompt="$(node --version)"
|
||||
else
|
||||
return
|
||||
fi
|
||||
nvm_prompt=${nvm_prompt}
|
||||
prompt_segment $BULLETTRAIN_NVM_BG $BULLETTRAIN_NVM_FG $BULLETTRAIN_NVM_PREFIX$nvm_prompt
|
||||
}
|
||||
|
||||
#AWS Profile
|
||||
prompt_aws() {
|
||||
local spaces=" "
|
||||
|
||||
if [[ -n "$AWS_PROFILE" ]]; then
|
||||
prompt_segment $BULLETTRAIN_AWS_BG $BULLETTRAIN_AWS_FG $BULLETTRAIN_AWS_PREFIX$spaces$AWS_PROFILE
|
||||
fi
|
||||
}
|
||||
|
||||
# SCREEN Session
|
||||
prompt_screen() {
|
||||
local session_name="$STY"
|
||||
if [[ "$session_name" != "" ]]; then
|
||||
prompt_segment $BULLETTRAIN_SCREEN_BG $BULLETTRAIN_SCREEN_FG $BULLETTRAIN_SCREEN_PREFIX" $session_name"
|
||||
fi
|
||||
}
|
||||
|
||||
prompt_time() {
|
||||
if [[ $BULLETTRAIN_TIME_12HR == true ]]; then
|
||||
prompt_segment $BULLETTRAIN_TIME_BG $BULLETTRAIN_TIME_FG %D{%r}
|
||||
else
|
||||
prompt_segment $BULLETTRAIN_TIME_BG $BULLETTRAIN_TIME_FG %D{%T}
|
||||
fi
|
||||
}
|
||||
|
||||
# Status:
|
||||
# - was there an error
|
||||
# - am I root
|
||||
# - are there background jobs?
|
||||
prompt_status() {
|
||||
local symbols
|
||||
symbols=()
|
||||
[[ $RETVAL -ne 0 && $BULLETTRAIN_STATUS_EXIT_SHOW != true ]] && symbols+="✘"
|
||||
[[ $RETVAL -ne 0 && $BULLETTRAIN_STATUS_EXIT_SHOW == true ]] && symbols+="✘ $RETVAL"
|
||||
[[ $UID -eq 0 ]] && symbols+="%{%F{yellow}%}⚡%f"
|
||||
[[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="⚙"
|
||||
|
||||
if [[ -n "$symbols" && $RETVAL -ne 0 ]]; then
|
||||
prompt_segment $BULLETTRAIN_STATUS_ERROR_BG $BULLETTRAIN_STATUS_FG "$symbols"
|
||||
elif [[ -n "$symbols" ]]; then
|
||||
prompt_segment $BULLETTRAIN_STATUS_BG $BULLETTRAIN_STATUS_FG "$symbols"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
# Prompt Character
|
||||
prompt_chars() {
|
||||
local bt_prompt_chars="${BULLETTRAIN_PROMPT_CHAR}"
|
||||
|
||||
if [[ $BULLETTRAIN_PROMPT_ROOT == true ]]; then
|
||||
bt_prompt_chars="%(!.%F{red}# .%F{green}${bt_prompt_chars}%f)"
|
||||
fi
|
||||
|
||||
if [[ $BULLETTRAIN_PROMPT_SEPARATE_LINE == false ]]; then
|
||||
bt_prompt_chars="${bt_prompt_chars}"
|
||||
fi
|
||||
|
||||
echo -n "$bt_prompt_chars"
|
||||
|
||||
if [[ -n $BULLETTRAIN_PROMPT_CHAR ]]; then
|
||||
echo -n " "
|
||||
fi
|
||||
}
|
||||
|
||||
# Prompt Line Separator
|
||||
prompt_line_sep() {
|
||||
if [[ $BULLETTRAIN_PROMPT_SEPARATE_LINE == true ]]; then
|
||||
# newline wont print without a non newline character, so add a zero-width space
|
||||
echo -e '\n%{\u200B%}'
|
||||
fi
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# MAIN
|
||||
# Entry point
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
build_prompt() {
|
||||
RETVAL=$?
|
||||
for segment in $BULLETTRAIN_PROMPT_ORDER
|
||||
do
|
||||
prompt_$segment
|
||||
done
|
||||
prompt_end
|
||||
}
|
||||
|
||||
NEWLINE='
|
||||
'
|
||||
PROMPT=''
|
||||
[[ $BULLETTRAIN_PROMPT_ADD_NEWLINE == true ]] && PROMPT="$PROMPT$NEWLINE"
|
||||
PROMPT="$PROMPT"'%{%f%b%k%}$(build_prompt)'
|
||||
[[ $BULLETTRAIN_PROMPT_SEPARATE_LINE == true ]] && PROMPT="$PROMPT$NEWLINE"
|
||||
PROMPT="$PROMPT"'%{${fg_bold[default]}%}'
|
||||
[[ $BULLETTRAIN_PROMPT_SEPARATE_LINE == false ]] && PROMPT="$PROMPT "
|
||||
PROMPT="$PROMPT"'$(prompt_chars)%{$reset_color%}'
|
||||
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 29 KiB |
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg width="980px" height="400px" viewBox="0 0 980 400" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<!-- Generator: Sketch 3.6.1 (26313) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>icon</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs>
|
||||
<circle id="path-1" cx="127.785004" cy="128.175003" r="127.785004"></circle>
|
||||
</defs>
|
||||
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<path d="M381.920665,131.630005 C404.600143,96.0153239 444.433578,72.3899994 489.785004,72.3899994 C560.358712,72.3899994 617.570007,129.601294 617.570007,200.175003 C617.570007,270.748712 560.358712,327.960007 489.785004,327.960007 C444.101682,327.960007 404.017411,303.987622 381.4255,267.936161 L437.146203,267.936161 L437.146203,131.630005 L381.920665,131.630005 Z" id="Combined-Shape" fill="#3B3B3B"></path>
|
||||
<g id="Group-2" transform="translate(362.000000, 72.000000)">
|
||||
<mask id="mask-2" fill="white">
|
||||
<use xlink:href="#path-1"></use>
|
||||
</mask>
|
||||
<use id="Oval-1" fill-opacity="0" fill="#3B3B3B" xlink:href="#path-1"></use>
|
||||
<g id="Group" mask="url(#mask-2)">
|
||||
<g transform="translate(-75.820300, 59.633943)">
|
||||
<path d="M224.965576,136.306156 L70.2828619,136.306156 L70.2828619,0 L224.965576,0 L293.016665,68.1530782 L224.965576,136.300887 Z" id="Rectangle-2" fill="#78AAD6"></path>
|
||||
<path d="M113.827177,136.209291 L113.827177,136.306156 L0,136.306156 L0,0 L113.827177,0 L113.827177,0.096865154 L181.7868,68.1530782 L113.827177,136.209291 Z" id="Combined-Shape" fill="#A8D4AA"></path>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 492 KiB |
|
After Width: | Height: | Size: 144 KiB |
|
After Width: | Height: | Size: 144 KiB |
|
After Width: | Height: | Size: 143 KiB |
|
After Width: | Height: | Size: 145 KiB |
|
After Width: | Height: | Size: 5.5 KiB |
|
After Width: | Height: | Size: 5.4 KiB |
|
After Width: | Height: | Size: 5.3 KiB |
|
After Width: | Height: | Size: 7.4 KiB |