summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md50
-rw-r--r--powerlevel9k.zsh-theme32
2 files changed, 62 insertions, 20 deletions
diff --git a/README.md b/README.md
index 57965bec..46487fd2 100644
--- a/README.md
+++ b/README.md
@@ -22,6 +22,9 @@ information.
* Shows system time in right-prompt
* Indicates background jobs with a gear
* Will conditionally display the `user@host` string
+* Plenty of other segments you can enable if you want them (e.g., ruby, AWS)
+* Can be used as a single or double-lined prompt (see screenshots below)
+* Several built-in color configurations to choose from
**If you would like an OMZ theme that provides most of the same features but
doesn't require Powerline fonts, check out the sister font,
@@ -47,25 +50,26 @@ To install this theme, clone this repository into your Oh-My-Zsh `custom/themes`
directory.
$ cd ~/.oh-my-zsh/custom
- $ mkdir themes # if it doesn't already exist
- $ git clone https://github.com/bhilburn/powerlevel9k.git powerlevel9k
+ $ git clone https://github.com/bhilburn/powerlevel9k.git themes/powerlevel9k
You then need to select this theme in your `~/.zshrc`:
ZSH_THEME="powerlevel9k/powerlevel9k"
-### Customization
+### Segment Customization
-You can choose which segments are shown on each side. The segments that are
+Customizing your prompt is easy! Select the segments you want to have displayed,
+and then assign them to either the left or right prompt. The segments that are
currently available are:
-* **context** - Your username and host.
+* **aws** - The current AWS profile, if active (more info below)
+* **context** - Your username and host (more info below)
* **dir** - Your current working directory.
-* **vcs** - Information about this `git` or `hg` repository (if you are in one).
+* **history** - The command number for the current line.
* **rbenv** - Ruby environment information (if one is active).
* **status** - The return code of the previous command, and status of background jobs.
-* **history** - The command number for the current line.
* **time** - System time.
+* **vcs** - Information about this `git` or `hg` repository (if you are in one).
To specify which segments you want, just add the following variables to your
`~/.zshrc`. If you don't customize this, the below configuration is the default:
@@ -78,7 +82,16 @@ If you want to show the current changeset in a `git` or `hg` repository, enable
POWERLEVEL9K_SHOW_CHANGESET=true
-#### Conditional 'context'
+#### The AWS Profile Segment
+
+If you would like to display the [current AWS
+profile](http://docs.aws.amazon.com/cli/latest/userguide/installing.html), add
+the `aws` segment to one of the prompts, and define `AWS_DEFAULT_PROFILE` in
+your `~/.zshrc`:
+
+ export AWS_DEFAULT_PROFILE=<profile_name>
+
+#### The 'context' Segment
The `context` segment (user@host string) is conditional. This lets you enable it, but only display
it if you are not your normal user or on a remote host (basically, only print it
@@ -89,10 +102,25 @@ elements (it is by default), and define a `DEFAULT_USER` in your `~/.zshrc`:
export DEFAULT_USER=<your username>
-#### Light theme
+### Styling
+
+You can configure the look and feel of your prompt easily with some built-in
+options.
+
+#### Double-Lined Prompt
+
+By default, `powerlevel9k` is a single-lined prompt. If you would like to have
+the segments display on one line, and print the command prompt below it, simply
+define `POWERLEVEL9K_PROMPT_ON_NEWLINE` in your `~/.zshrc`:
+
+ export POWERLEVEL9K_PROMPT_ON_NEWLINE=true
+
+#### Light Color Theme
+
+If you prefer to use "light" colors, simply set `POWERLEVEL9K_COLOR_SCHEME`
+to `light` in your `~/.zshrc`, and you're all set!
-If you want your shell in a "light" variant, just set `POWERLEVEL9K_COLOR_SCHEME`
-to `light` and you are done!
+ POWERLEVEL9K_COLOR_SCHEME='light'
### Bugs / Contact
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index a939d861..55056bf1 100644
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -34,17 +34,17 @@ VCS_STAGED_ICON='✚'
local DEFAULT_COLOR DEFAULT_COLOR_INVERTED DEFAULT_COLOR_DARK
if [[ $POWERLEVEL9K_COLOR_SCHEME == "light" ]]; then
- DEFAULT_COLOR=white
- DEFAULT_COLOR_INVERTED=black
- DEFAULT_COLOR_DARK="252"
+ DEFAULT_COLOR=white
+ DEFAULT_COLOR_INVERTED=black
+ DEFAULT_COLOR_DARK="252"
else
- DEFAULT_COLOR=black
- DEFAULT_COLOR_INVERTED=white
- DEFAULT_COLOR_DARK="236"
+ DEFAULT_COLOR=black
+ DEFAULT_COLOR_INVERTED=white
+ DEFAULT_COLOR_DARK="236"
fi
################################################################
-# vcs_info settings for git
+# VCS Information Settings
################################################################
setopt prompt_subst
@@ -218,7 +218,7 @@ prompt_dir() {
# Virtualenv: current working virtualenv
# More information on virtualenv (Python):
-# https://virtualenv.pypa.io/en/latest/virtualenv.html
+# https://virtualenv.pypa.io/en/latest/
prompt_virtualenv() {
local virtualenv_path="$VIRTUAL_ENV"
if [[ -n $virtualenv_path && -n $VIRTUAL_ENV_DISABLE_PROMPT ]]; then
@@ -285,6 +285,15 @@ prompt_rbenv() {
fi
}
+# AWS Profile
+prompt_aws() {
+ local aws_profile=$AWS_DEFAULT_PROFILE
+ if [[ -n $aws_profile ]];
+ then
+ $1_prompt_segment red white "AWS: $aws_profile"
+ fi
+}
+
# Main prompt
build_left_prompt() {
if (( ${#POWERLEVEL9K_LEFT_PROMPT_ELEMENTS} == 0 )); then
@@ -319,5 +328,10 @@ precmd() {
vcs_info_hookadd set-message vcs-detect-changes
}
-PROMPT='%{%f%b%k%}$(build_left_prompt) '
+if [ $POWERLEVEL9K_PROMPT_ON_NEWLINE ] ; then
+ PROMPT='╭─%{%f%b%k%}$(build_left_prompt)
+╰─ '
+else
+ PROMPT='%{%f%b%k%}$(build_left_prompt) '
+fi
RPROMPT='%{%f%b%k%}$(build_right_prompt)%{$reset_color%}'