侧边栏壁纸
  • 累计撰写 198 篇文章
  • 累计创建 105 个标签
  • 累计收到 36 条评论

记我的linux系统zsh美化之旅——deepin+oh-my-zhs+powerlevel10k

神兵小将
2022-04-07 / 0 评论 / 0 点赞 / 87 阅读 / 4,729 字 / 正在检测是否收录...
温馨提示:
本文最后更新于 2022-04-07,若内容或图片失效,请留言反馈。部分素材来自网络,若不小心影响到您的利益,请联系我们删除。

效果

话不多说,直接上效果。

效果图

我的操作系统是deepin社区20.5版。

前期准备

首先要安装zsh,还有oh-my-zsh.
参考:安装oh-my-zsh

安装powerlevel10k主题

powerlevel10k下载安装

github

git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

gitee

git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

下载后,会保存在 ~/.oh-my-zsh/custom/powerlevel10k目录中。

powerlevel10k配置

修改默认主题
使用命令

# 这里我使用vim编辑
vim ~/.zshrc
# 修改如下内容
ZSH_THEME="powerlevel10k/powerlevel10k"

修改保存完毕。

运行

source ~/.zshrc

重载。

而后关闭命令行。重新打开。

运行配置

使用命令

p10k configure

然后按照提示进行选择即可。
0dWc1s

字体安装

个人推荐 Fira Code 和 MesloLG M DZ 或可以使用这个仓库 https://github.com/powerline/fonts 中的任意字体。

直接使用命令下载安装

# 下载
git clone https://github.com/powerline/fonts.git --depth=1
#打开目录
cd fonts
# 安装字体
./install.sh
#回退删除
cd ..
rm -rf fonts

至此,字体安装完毕。我们还需要在终端字体设置为
截图_选择区域_20220407105024
截图_deepin-terminal_20220407105043

设置完毕后,重启终端即可看到效果。

如果还不行,可使用试一下。

sudo apt-get install powerline-fonts

powerlevel10k自定义显示配置

以下是默认全都打开的状态。
rE1zh8

注意:配置文件是~/.p10k.zsh,而不是插件下载目录。

直接vim或者其他编辑器编辑即可。只需要把对应项前边的注释#号去掉即可,反之添加上#。

这里是左侧显示的内容

typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(
    # =========================[ Line #1 ]=========================
    os_icon                 # os identifier
    dir                     # current directory
    vcs                     # git status
    # =========================[ Line #2 ]=========================
    newline                 # \n
    prompt_char           # prompt symbol
  )

这里是右侧显示的内容

typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(
    # =========================[ Line #1 ]=========================
    status                  # exit code of the last command
    command_execution_time  # duration of the last command
    background_jobs         # presence of background jobs
    direnv                  # direnv status (https://direnv.net/)
    asdf                    # asdf version manager (https://github.com/asdf-vm/asdf)
    virtualenv              # python virtual environment (https://docs.python.org/3/library/venv.html)
    anaconda                # conda environment (https://conda.io/)
    pyenv                   # python environment (https://github.com/pyenv/pyenv)
    goenv                   # go environment (https://github.com/syndbg/goenv)
    nodenv                  # node.js version from nodenv (https://github.com/nodenv/nodenv)
    nvm                     # node.js version from nvm (https://github.com/nvm-sh/nvm)
    nodeenv                 # node.js environment (https://github.com/ekalinin/nodeenv)
    node_version          # node.js version
    # go_version            # go version (https://golang.org)
    # rust_version          # rustc version (https://www.rust-lang.org)
    # dotnet_version        # .NET version (https://dotnet.microsoft.com)
    php_version           # php version (https://www.php.net/)
    laravel_version       # laravel php framework version (https://laravel.com/)
    # java_version          # java version (https://www.java.com/)
    # package               # name@version from package.json (https://docs.npmjs.com/files/package.json)
    rbenv                   # ruby version from rbenv (https://github.com/rbenv/rbenv)
    rvm                     # ruby version from rvm (https://rvm.io)
    fvm                     # flutter version management (https://github.com/leoafarias/fvm)
    luaenv                  # lua version from luaenv (https://github.com/cehoffman/luaenv)
    jenv                    # java version from jenv (https://github.com/jenv/jenv)
    plenv                   # perl version from plenv (https://github.com/tokuhirom/plenv)
    phpenv                  # php version from phpenv (https://github.com/phpenv/phpenv)
    scalaenv                # scala version from scalaenv (https://github.com/scalaenv/scalaenv)
    haskell_stack           # haskell version from stack (https://haskellstack.org/)
    kubecontext             # current kubernetes context (https://kubernetes.io/)
    terraform               # terraform workspace (https://www.terraform.io)
    # terraform_version     # terraform version (https://www.terraform.io)
    aws                     # aws profile (https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html)
    aws_eb_env              # aws elastic beanstalk environment (https://aws.amazon.com/elasticbeanstalk/)
    azure                   # azure account name (https://docs.microsoft.com/en-us/cli/azure)
    gcloud                  # google cloud cli account and project (https://cloud.google.com/)
    google_app_cred         # google application credentials (https://cloud.google.com/docs/authentication/production)
    toolbox                 # toolbox name (https://github.com/containers/toolbox)
    context                 # user@hostname
    nordvpn                 # nordvpn connection status, linux only (https://nordvpn.com/)
    ranger                  # ranger shell (https://github.com/ranger/ranger)
    nnn                     # nnn shell (https://github.com/jarun/nnn)
    xplr                    # xplr shell (https://github.com/sayanarijit/xplr)
    vim_shell               # vim shell indicator (:sh)
    midnight_commander      # midnight commander shell (https://midnight-commander.org/)
    nix_shell               # nix shell (https://nixos.org/nixos/nix-pills/developing-with-nix-shell.html)
    vi_mode                 # vi mode (you don't need this if you've enabled prompt_char)
    # vpn_ip                # virtual private network indicator
    load                  # CPU load
    disk_usage            # disk usage
    ram                   # free RAM
    # swap                  # used swap
    todo                    # todo items (https://github.com/todotxt/todo.txt-cli)
    timewarrior             # timewarrior tracking status (https://timewarrior.net/)
    taskwarrior             # taskwarrior task count (https://taskwarrior.org/)
    time                    # current time
    # =========================[ Line #2 ]=========================
    newline
    # ip                    # ip address and bandwidth usage for a specified network interface
    # public_ip             # public IP address
    # proxy                 # system-wide http/https/ftp proxy
    battery               # internal battery
    wifi                  # wifi speed
    # example               # example user-defined segment (see prompt_example function below)
  )

通过修改

typeset -g POWERLEVEL9K_***_VISUAL_IDENTIFIER_EXPANSION='⭐'

可以改变某功能的图标.

更改完毕后,需要使用命令重载。

source  ~/.zshrc 
0

评论区