📜  powerlevel10k - Shell-Bash (1)

📅  最后修改于: 2023-12-03 15:03:51.027000             🧑  作者: Mango

Powerlevel10k - Shell/Bash

Powerlevel10k is a highly customizable and fast Powerline-style prompt for Bash, Zsh and Fish. It is designed to be intuitive and easy to use for developers, with support for various plugins and themes.

Features
  • Customizable prompt layout
  • Blazing-fast prompt rendering
  • Git integration
  • Shows exit code of the last command
  • Shows current time
  • Support for right-side prompt
  • Support for various plugins, including AWS, Docker, etc.
  • Support for various themes, including classic, rainbow, p10k, etc.
Installation
Prerequisites
  • A compatible terminal emulator is required to display Powerlevel10k prompt correctly. Recommended emulators include iTerm2, GNOME Terminal, and Alacritty.
  • Powerline fonts are required for the prompt icons to display correctly. A popular font pack is Nerd Fonts.
Install with git
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k
echo 'source ~/powerlevel10k/powerlevel10k.zsh-theme' >>! ~/.zshrc # For Zsh
echo 'source ~/powerlevel10k/powerlevel10k.sh' >>! ~/.bashrc # For Bash
Customization

Powerlevel10k is highly customizable. You can launch its configuration wizard by running p10k configure in your terminal. The wizard will guide you through various options, including prompt style, font, and color scheme.

To manually customize Powerlevel10k, you can edit its configuration file directly. The file is located at ~/.p10k.zsh for Zsh, and ~/.p10k.bash for Bash.

Here's an example configuration file:

# ~/.p10k.zsh or ~/.p10k.bash

# Set prompt style
typeset -g POWERLEVEL9K_MODE='awesome-patched'

# Set font
typeset -g POWERLEVEL9K_FONT='MesloLGS NF'

# Show exit code of the last command
typeset -g POWERLEVEL9K_STATUS_CROSS=true

# Set color scheme
autoload -U colors && colors
typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(os_icon context dir vcs)
typeset -g POWERLEVEL9K_OS_ICON_FOREGROUND='white'
typeset -g POWERLEVEL9K_OS_ICON_BACKGROUND='magenta'
typeset -g POWERLEVEL9K_CONTEXT_DEFAULT_FOREGROUND='white'
typeset -g POWERLEVEL9K_CONTEXT_DEFAULT_BACKGROUND='black'
typeset -g POWERLEVEL9K_DIR_FOREGROUND='red'
typeset -g POWERLEVEL9K_DIR_BACKGROUND='white'
typeset -g POWERLEVEL9K_VCS_BRANCH_FOREGROUND='green'
typeset -g POWERLEVEL9K_VCS_BRANCH_BACKGROUND='black'
Conclusion

Powerlevel10k is a powerful and highly customizable prompt for developers. It provides a fast and intuitive way to navigate your shell, with support for various plugins and themes. Give it a try and see how it can improve your workflow!