美化WindowsTerminal

203 阅读1分钟

官方教程

一. Windows PowerShell美化

  1. 安装系统字体:Nerd Font

    • 下载地址
    • 解压后,右键点击ttf文件,选择“安装”。
    • 打开 “终端-设置-PowerShell-外观-字体:选择下载的字体xxx Nerd Font”。
  2. 安装Oh My Posh

    • 安装命令:winget install oh-my-posh
    • 选择Microsoft Store版本:winget install XP8K0HKJFRXGCK
    • 查看是否安装成功:oh-my-posh version
  3. 选择并应用主题

    • 修改配置文件: notepad $PROFILE
    • 在打开的编辑器内输入:
      oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\aliens.omp.json" | Invoke-Expression
      可选择自己喜欢的[主题](https://ohmyposh.dev/docs/themes#agnosterminimal),替换上面的 "aliens"
      

二. WSL美化

  1. 安装Homebrew for Linux

        /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    
  2. ~/.profile 配置文件加上。

        # ps:好像配不配无所谓
        test -d ~/.linuxbrew && eval "$(~/.linuxbrew/bin/brew shellenv)"
        test -d /home/linuxbrew/.linuxbrew && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
        test -r ~/.bash_profile && echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >> ~/.bash_profile
        echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >> ~/.profile
    
        # 配置主题
        eval "$(oh-my-posh init bash --config /mnt/c/Users/"hf"/AppData/Local/Programs/oh-my-posh/themes/aliens.omp.json)"
    可选择自己喜欢的[主题](https://ohmyposh.dev/docs/themes#agnosterminimal),替换上面的 "aliens"
    
  3. 安装oh-my-posh。教程里安装是jandedobbeleer/oh-my-posh/,但是不成功。

        brew install oh-my-posh