Skip to content

Syphdias/powerlevel9k

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Join the chat at https://gitter.im/bhilburn/powerlevel9k

Powerlevel9k is a theme for ZSH which uses Powerline Fonts. It can be used with vanilla ZSH or ZSH frameworks such as Oh-My-Zsh, Prezto, Antigen, and many others.

Get more out of your terminal. Be a badass. Impress everyone in 'Screenshot Your Desktop' threads. Use powerlevel9k.

You can check out some other users' configurations in our wiki: Show Off Your Config.

There are a number of Powerline ZSH themes available, now. The developers of this theme focus on four primary goals:

  1. Give users a great out-of-the-box configuration with no additional configuration required.
  2. Make customization easy for users who do want to tweak their prompt.
  3. Provide useful segments that you can enable to make your prompt even more effective and helpful. We have prompt segments for everything from unit test coverage to your AWS instance.
  4. Optimize the code for execution speed as much as possible. A snappy terminal is a happy terminal.

Powerlevel9k can be used to create both very useful and beautiful terminal environments:

Table of Contents

  1. Installation
  2. Customization
    1. Stylizing Your Prompt
    2. Customizing Prompt Segments
    3. Available Prompt Segments
  3. Troubleshooting

Be sure to also check out the Wiki!

Installation

There are two installation steps to go from a vanilla terminal to a PL9k terminal. Once you are done, you can optionally customize your prompt.

Installation Instructions

  1. Install the Powerlevel9k Theme
  2. Install Powerline Fonts

No configuration is necessary post-installation if you like the default settings, but there are plenty of segment customization options available if you are interested.

Prompt Customization

Be sure to check out the wiki page on the additional prompt customization options, including color and icon settings: Stylizing Your Prompt

Customizing Prompt Segments

Customizing your prompt is easy! Select the segments you want to have displayed, and then assign them to either the left or right prompt by adding the following variables to your ~/.zshrc.

Variable Default Value Description
P9K_LEFT_PROMPT_ELEMENTS (context dir vcs) Segment list for left prompt
P9K_RIGHT_PROMPT_ELEMENTS (status root_indicator background_jobs history time) Segment list for right prompt

The table above shows the default values, so if you wanted to set these variables manually, you would put the following in your ~/.zshrc:

P9K_LEFT_PROMPT_ELEMENTS=(context dir vcs)
P9K_RIGHT_PROMPT_ELEMENTS=(status root_indicator background_jobs history time)

Available Prompt Segments

The segments that are currently available are:

System Status Segments:

  • background_jobs - Indicator for background jobs.
  • battery - Current battery status.
  • context - Your username and host, conditionalized based on $USER and SSH status.
  • date - System date.
  • dir - Your current working directory.
  • dir_writable - Displays a lock icon, if you do not have write permissions on the current folder.
  • disk_usage - Disk usage of your current partition.
  • history - The command number for the current line.
  • host - Your current host name
  • ip - Shows the current IP address.
  • vpn_ip - Shows the current VPN IP address.
  • public_ip - Shows your public IP address.
  • load - Your machine's load averages.
  • os_icon - Display a nice little icon, depending on your operating system.
  • ram - Show free RAM.
  • root_indicator - An indicator if the user has superuser status.
  • status - The return code of the previous command.
  • swap - Prints the current swap size.
  • time - System time.
  • user - Your current username
  • vi_mode- Your prompt's Vi editing mode (NORMAL|INSERT).
  • ssh - Indicates whether or not you are in an SSH session.

Development Environment Segments:

  • gitstatus - Information about this git repository (if you are in one).
  • vcs - Information about this git or hg repository (if you are in one).

Language Segments:

  • GoLang Segments:
  • Javascript / Node.js Segments:
    • node_version - Show the version number of the installed Node.js.
    • nodeenv - nodeenv prompt for displaying node version and environment name.
    • nvm - Show the version of Node that is currently active, if it differs from the version used by NVM
  • PHP Segments:
  • Python Segments:
    • virtualenv - Your Python VirtualEnv.
    • anaconda - Your active Anaconda environment.
    • pyenv - Your active python version as reported by the first word of pyenv version. Note that the segment is not displayed if that word is system i.e. the segment is inactive if you are using system python.
  • Ruby Segments:
    • chruby - Ruby environment information using chruby (if one is active).
    • rbenv - Ruby environment information using rbenv (if one is active).
    • rspec_stats - Show a ratio of test classes vs code classes for RSpec.
    • rvm - Ruby environment information using $GEM_HOME and $MY_RUBY_HOME (if one is active).
  • Rust Segments:
  • Swift Segments:
    • swift_version - Show the version number of the installed Swift.
  • Java Segments:
  • Haskell Segments:
    • stack_project - Show if you are in a Haskell Stack project directory.

Cloud Segments:

  • AWS Segments:
    • aws - The current AWS profile, if active.
    • aws_eb_env - The current Elastic Beanstalk Environment.
  • docker_machine - The current Docker Machine.
  • kubecontext - The current context of your kubectl configuration.
  • dropbox - Indicates Dropbox directory and syncing status using dropbox-cli

Other:

  • custom_command - Create a custom segment to display the output of an arbitrary command.
  • command_execution_time - Display the time the current command took to execute.
  • todo - Shows the number of tasks in your todo.txt tasks file.
  • detect_virt - Virtualization detection with systemd
  • newline - Continues the prompt on a new line.
  • openfoam - Shows the currently sourced OpenFOAM environment.
  • vagrant - Detects if you are in a folder with a running VM.

custom_command

The custom_... segment allows you to turn the output of a custom command into a prompt segment. As an example, if you wanted to create a custom segment to display your WiFi signal strength, you might define a custom segment called custom_wifi_signal like this:

P9K_LEFT_PROMPT_ELEMENTS=(context time battery dir vcs virtualenv custom_wifi_signal)
P9K_CUSTOM_WIFI_SIGNAL="echo signal: \$(nmcli device wifi | grep yes | awk '{print \$8}')"
P9K_CUSTOM_WIFI_SIGNAL_BACKGROUND="blue"
P9K_CUSTOM_WIFI_SIGNAL_FOREGROUND="yellow"

If you prefer, you can also define the function in your .zshrc rather than putting it in-line with the variable export, as shown above. Just don't forget to invoke your function from your segment! Example code that achieves the same result as the above:

zsh_wifi_signal(){
    local signal=$(nmcli device wifi | grep yes | awk '{print $8}')
    local color='%F{yellow}'
    [[ $signal -gt 75 ]] && color='%F{green}'
    [[ $signal -lt 50 ]] && color='%F{red}'
    echo -n "%{$color%}\uf230  $signal%{%f%}" # \uf230 is 
}

P9K_CUSTOM_WIFI_SIGNAL="zsh_wifi_signal"
P9K_LEFT_PROMPT_ELEMENTS=(context time battery dir vcs virtualenv custom_wifi_signal)

The command, above, gives you the wireless signal segment shown below:

signal

You can define as many custom segments as you wish. If you think you have a segment that others would find useful, please consider upstreaming it to the main theme distribution so that everyone can use it!

Disabling / Enabling Powerlevel9k

You can disable P9k and return to a very basic prompt at any time simply by calling:

$ prompt_powerlevel9k_teardown

You can then re-enable it by calling:

$ prompt_powerlevel9k_setup

tl; dr

Want to just get a quick start? Check out the Show Off Your Config portion of the wiki to get going.

The Wiki also has a ton of other useful information!

License

Project: MIT

Logo: CC-BY-SA. Source repository: https://github.com/bhilburn/powerlevel9k-logo

About

The most awesome Powerline theme for ZSH around!

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 96.8%
  • Ruby 1.6%
  • Dockerfile 1.6%