1

Consider the following screenshot

enter image description here

I'm using oh-my-zsh for shell customization. But due to the longer paths , I am unable to write longer linux commands. I want to change the prompt that only showing me the current directly keeping everything to the same.

Theme ZSH_THEME="powerlevel9k/powerlevel9k"

Please help !

1

Powerlevel9k has been discontinued, see the note at the top of https://github.com/powerlevel9k/powerlevel9k. It's highly recommended to upgrade to Powerlevel10k.

Here's how to upgrade:

  1. Add powerlevel10k to the list of Oh My Zsh themes.
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git $ZSH_CUSTOM/themes/powerlevel10k
  1. Replace ZSH_THEME="powerlevel9k/powerlevel9k" with ZSH_THEME="powerlevel10k/powerlevel10k" in ~/.zshrc.
sed -i.bak 's/powerlevel9k/powerlevel10k/g' ~/.zshrc
  1. Restart Zsh.
exec zsh

Once you restart Zsh, prompt configuration wizard should start automatically. If it doesn't, type p10k configure. At some point the wizard will ask whether you want a one-line or a two-line prompt. The two-line version gives you a lot more room for typing commands, so you'll want to choose that. Two-line prompt usually wastes half of terminal's vertical space but with Powerlevel10k you have an option to enable Transient Prompt to avoid this downside.

In addition, you might want to add these lines to ~/.zshrc:

# My Windows home directory.
hash -d w=/mnt/c/Users/Pawar

This establishes bidirectional mapping between ~w and /mnt/c/Users/Pawar. Instead of /mnt/c/Users/Pawar/Downloads prompt will display ~w/Downloads. You can type cd ~w/Downloads instead of cd /mnt/c/Users/Pawar/Downloads, etc. Tab-completion understand this mapping, too. So cd ~w/Tab will work.

6
  • ok I shall upgrade right away – Aashish Pawar Jul 9 '20 at 8:13
  • 1
    @AashishPawar FYI: I've added a recommendation at the bottom of my answer to define a named directory. It'll make working in WSL more pleasant. – Roman Perepelitsa Jul 9 '20 at 8:16
  • it says zsh: command not found p10k – Aashish Pawar Jul 9 '20 at 8:18
  • I got the following error when cloned the git repo => /home/aashish/.oh-my-zsh/oh-my-zsh.sh:source:125: no such file or directory: /home/aashish/.oh-my-zsh/themes/powerlevel10k/powerlevel10k.zsh-theme – Aashish Pawar Jul 9 '20 at 8:23
  • 1
    These errors mean that either you haven't cloned powerlevel10k or you have cloned it to a wrong directory. Run this command: git clone --depth=1 https://github.com/romkatv/powerlevel10k.git /home/aashish/.oh-my-zsh/custom/themes/powerlevel10k && exec zsh – Roman Perepelitsa Jul 9 '20 at 12:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.