Test your skills on our all Hosting services and get 15% off!

Use code at checkout:

Skills
08.10.2024
No categories

Installation and Usage of Powerlevel10k in Zsh

Installation and Usage of Powerlevel10k in Zsh

The terminal is a powerful tool, and customizing it can greatly enhance your productivity. One of the most popular ways to do this is by using Zsh (Z Shell) combined with the Powerlevel10k theme. Powerlevel10k offers a beautiful and highly customizable prompt that can display useful information, such as git status, Python environment, and much more.

In this guide, we will walk you through the process of installing Zsh, setting up Powerlevel10k, and customizing it to create a beautiful and efficient terminal experience.

What is Powerlevel10k?

Powerlevel10k is a theme for the Zsh shell that focuses on speed, flexibility, and a visually appealing prompt. It provides features like:

  • Customizable prompts with various styles.
  • Support for displaying git status, user information, time, and more.
  • A fast and responsive user interface.
  • Easy configuration wizard for new users.

Installation and Usage of Powerlevel10k in Zsh

The terminal is a powerful tool, and customizing it can greatly enhance your productivity. One of the most popular ways to do this is by using Zsh (Z Shell) combined with the Powerlevel10k theme. Powerlevel10k offers a beautiful and highly customizable prompt that can display useful information, such as git status, Python environment, and much more.

In this guide, we will walk you through the process of installing Zsh, setting up Powerlevel10k, and customizing it to create a beautiful and efficient terminal experience.

What is Powerlevel10k?

Powerlevel10k is a theme for the Zsh shell that focuses on speed, flexibility, and a visually appealing prompt. It provides features like:

  • Customizable prompts with various styles.
  • Support for displaying git status, user information, time, and more.
  • A fast and responsive user interface.
  • Easy configuration wizard for new users.

Step 1: Installing Zsh

Before we install Powerlevel10k, we need to ensure that Zsh is installed on your system. Most modern Linux distributions come with Zsh available in their repositories. If Zsh is not already installed, you can install it using the following commands:

For Ubuntu/Debian:

sudo apt update

sudo apt install zsh -y

For Fedora:

sudo dnf install zsh -y

For Arch Linux:

sudo pacman -S zsh

After installation, you can check the Zsh version with:

zsh --version

Make Zsh the default shell by running:

chsh -s $(which zsh)

Log out and log back in for the changes to take effect.

Step 2: Installing Oh My Zsh

To simplify the management of Zsh plugins and themes, it’s recommended to use Oh My Zsh, a framework that makes it easy to work with Zsh. Install it with the following command:

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

After the installation, your default shell will be switched to Zsh, and you’ll have access to a variety of plugins and themes.

Step 3: Installing Powerlevel10k

With Zsh and Oh My Zsh installed, you can now install Powerlevel10k. Clone the Powerlevel10k repository into the custom themes directory of Oh My Zsh:

git clone --depth=1 https://github.com/romkatv/powerlevel10k.git $ZSH_CUSTOM/themes/powerlevel10k

Next, set Powerlevel10k as your active theme by editing the .zshrc file:

nano ~/.zshrc

Find the line that sets the theme (it will look like ZSH_THEME=”robbyrussell”) and replace it with:

ZSH_THEME="powerlevel10k/powerlevel10k"

Save the file and exit the editor. Apply the changes by restarting your terminal or running:

source ~/.zshrc

Step 4: Configuring Powerlevel10k

The first time you restart your terminal with Powerlevel10k enabled, a configuration wizard will start. This wizard allows you to customize your prompt appearance based on your preferences.

You can choose from several styles:

  • Classic: A clean, minimalistic prompt.
  • Rainbow: A colorful prompt with various segments.
  • Lean: A simple and compact prompt.
  • Pure: A prompt similar to the Pure theme, with a focus on minimalism.

The wizard will also ask if you want to display information like time, user, and status icons. As you make each choice, you will see a live preview, allowing you to fine-tune your setup.

To re-run the configuration wizard at any time, simply execute:

p10k configure

Step 5: Installing Fonts for Powerlevel10k

Powerlevel10k uses special fonts to display icons and symbols correctly. To ensure everything looks as intended, you need to install a Nerd Font.

Download a Nerd Font of your choice from the Nerd Fonts repository or directly download the MesloLGS NF font, which is recommended by Powerlevel10k:

  1. Download MesloLGS NF fonts from this link.
  2. Install the fonts by double-clicking each
    .ttf
    file and selecting “Install.”

After installing the fonts, change your terminal emulator’s font to MesloLGS NF to ensure proper display of Powerlevel10k symbols.

Step 6: Using Powerlevel10k with Plugins

To further enhance your Zsh setup, you can add plugins like zsh-syntax-highlighting and zsh-autosuggestions:

Install zsh-syntax-highlighting:

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_CUSTOM/plugins/zsh-syntax-highlighting

Install zsh-autosuggestions:

git clone https://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions

Edit the .zshrc file again to enable these plugins:

nano ~/.zshrc

Find the line starting with plugins=() and add the new plugins inside the parentheses:

plugins=(git zsh-syntax-highlighting zsh-autosuggestions)

Save the file, exit, and reload the configuration:

source ~/.zshrc

Conclusion

By following these steps, you now have a beautifully customized Zsh terminal with the Powerlevel10k theme. The combination of Zsh, Oh My Zsh, and Powerlevel10k provides a powerful, aesthetically pleasing, and highly configurable terminal experience that can boost your productivity.

With the ability to customize the prompt appearance, utilize plugins, and access various helpful features, you’ll find that working in the terminal becomes much more enjoyable. Happy customizing!

Test your skills on our all Hosting services and get 15% off!

Use code at checkout:

Skills