windows terminal

  1. CTRL+SHIFT+,打开配置文件。

  2. 终端专注模式:

    1. CTRL+SHIFT+P打开搜索切换专注模式(退出也是这种方式)。

    2. cmd输入wt/f也可进入专注模式(win+R也行)。

    3. 直接在设置中为切换专注模式设置一个快捷键,例如ALT+Z即可。
      image-20230804224101642


powershell
  1. 安装oh-my-posh,实际详细配置参考官网。下面命令均使用管理员权限下的powershell运行。

  2. winget install JanDeDobbeleer.OhMyPosh -s winget --location xxx 安装oh-my-posh到指定位置。当然你也可以使用命令winget upgrade JanDeDobbeleer.OhMyPosh -s winget --location xxx更新。

  3. 配置oh-my-posh环境。
    image-20230802210927729

  4. 安装推荐字体进入Nerd Fonts随便下载一款字体(但个人推荐FiraCode Nerd FontCaskaydia Cove Nerd Font也还行),并在windows上安装。

  5. 终端下使用 CTRL + SHIFT + ,打开配置文件,配置全局字体。当然也可以直接在 windows terminal设置中配置字体。(更推荐FiraCode Nerd Font)。
    image-20230523103456652

  6. 此外建议在设置->呈现中开启windows terminal文本呈现器。此外在设置->外观中开启亚力克材料效果。在各个配置文件的外观->透明度中启用亚力克材料。
    image-20230522230645017
    image-20230523115429689

  7. powershell运行get-Poshthemes查看所有主题。

  8. powershell运行notepad $profile编辑powershell配置文件。其中--config后面接主题配置的文件位置(全部在oh-my-posh安装目录的themes目录下)。(night-owl、neko、montys不错)

    1
    oh-my-posh --init --shell pwsh --config D:\Environment\ohmyposh\themes\neko.omp.json | Invoke-Expression


    image-20230522223158710

  9. 运行. $profile使配置生效。

  10. 使用如下命令,下载美化终端的图标。

    1
    Install-Module -Name Terminal-Icons -Repository PSGallery
  11. notepad $profile编辑powershell配置文件。

    1
    2
    Import-Module -Name Terminal-Icons
    oh-my-posh --init --shell pwsh --config D:\Environment\ohmyposh\themes\atomic.omp.json | Invoke-Expression
  12. 运行. $profile使配置生效。

  13. 强调一下window终端下的一个配置,开启自动调整无法区分的文本的亮度可能会导致某些主题无法正常显示:
    image-20230708173601210


cmd美化
  1. 下载clink工具,安装一个已知位置。

  2. 然后,进入clink安装目录,创建oh-my-posh.lua文件,添加如下内容:

    1
    load(io.popen('oh-my-posh init cmd'):read("*a"))()
  3. ​ 或者使用指定主题:

    1
    load(io.popen('oh-my-posh init cmd --config D:\\Environment\\ohmyposh\\themes\\atomic.omp.json'):read("*a"))()

配色
  1. 自定义配色很繁琐,而且很好费时间,最好的方法是用别人做好的配色。可以在github项目 iTerm2-Color-Schemes)里找,有两百多方案,先在 Screenshots 里挑选好颜色,然后到 windwosterminal 目录对应的 json 文件复制样式。
    image-20230802205915724

  2. 将样式粘贴到windwos terminal配置文件的schemes数组中即可。

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    "schemes": 
    [
    {
    "background": "#F7F7F7",
    "black": "#090300",
    "blue": "#01A0E4",
    "brightBlack": "#5C5855",
    "brightBlue": "#807D7C",
    "brightCyan": "#CDAB53",
    "brightGreen": "#3A3432",
    "brightPurple": "#D6D5D4",
    "brightRed": "#E8BBD0",
    "brightWhite": "#F7F7F7",
    "brightYellow": "#4A4543",
    "cursorColor": "#4A4543",
    "cyan": "#B5E4F4",
    "foreground": "#4A4543",
    "green": "#01A252",
    "name": "3024 Day", //配色方案名称
    "purple": "#A16A94",
    "red": "#DB2D20",
    "selectionBackground": "#A5A2A2",
    "white": "#A5A2A2",
    "yellow": "#FDED02"
    },
    ]
  3. 之后通过name在windwosterminal设置中使用即可。

  4. 其他配色网站


隐藏启动信息
  1. windwosterminal打开powershell时,会有显示一些版本和加载信息。

  2. 我们可以通过设置,对每个配置文件的的命令行配置中添加-nologo参数即可。

    1
    gsudo.exe %SystemRoot%\System32\cmd.exe -nologo


    image-20230523114847261


gsudo
  1. 安装 gsudo 只需要一条 Powershell 指令就行:

    1
    PowerShell -Command "Set-ExecutionPolicy RemoteSigned -scope Process; iwr -useb https://raw.githubusercontent.com/gerardog/gsudo/master/installgsudo.ps1 | iex"
  2. 安装过程中会问你是否要使用 sudo作为 gsudo的别名,我这里选择是。安装完后重启,环境变量生效后就可以使用 sudo来快速跳转到管理员级别的 Powershell 了。


ubuntu子系统(wsl)

zsh和oh-my-zsh
  1. 运行apt-get install zsh安装zsh。并用zsh --version检查是否安装成功 。

  2. 运行sudo vim /etc/passwdzsh设为当前用户默认。或者使用chsh -s $(which zsh)命令将当前用户的shell修改为zsh。注意只需添加当前用户即可。

    1
    fish:x:1001:1001::/home/fish:/bin/zsh  
  3. 安装oh-my-zsh,三种方式:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    # curl
    sudo apt install curl
    sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

    # wget
    sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

    # fetch
    sh -c "$(fetch -o - https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

    # 前几种不行,就手动安装(这里注意文件夹是oh-my-zsh,没有.)(建议使用国内镜像)
    git clone https://github.com/robbyrussell/oh-my-zsh # 下载源码
    cd ~/oh-my-zsh/tools # 执行安装命令
    sh install.sh # 安装
    ls -a ~ # 查看.oh-my-zsh/目录

    uninstall_oh_my_zsh #卸载
  4. 安装目录是~/.oh-my-zsh/themes/,可以使用ls 命令查看主题(~表示当前用户目录)。

  5. vim ~/.zshrc 编辑文件设置喜欢的主题,其实就是修改 ZSH_THEME,过程如下:

    1
    2
    ls ~/.oh-my-zsh/themes
    vim ~/.zshrc # 设置 ZSH_THEME="cloud"
  6. 运行source ~/.zshrc重新加载配置文件。

  7. 当然你也可以在官网查看不同主题。

  8. 由于 oh-my-zsh下主题的表现没有oh-my-posh的表现好,我决定装一个powerlevel10k,这款主题也是非常得受欢迎。git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

  9. 装完后使用 vim ~/.zshrc配置好 ZSH_THEME="powerlevel10k/powerlevel10k"

  10. 重启终端你就可以看到配置界面(没有看到也可以使用 p10k configure指令手动调出)。其他一些命令:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    # 列出主题中包含的所有图标的名称
    get_icon_names

    # 禁用P9k/P10k
    prompt_powerlevel9k_teardown

    # 启用P9k/P10k
    prompt_powerlevel9k_setup

    # 配置p10k
    p10k configure
  11. zsh自带了很多的插件,相关的文件都放在了~/.oh-my-zsh/plugins目录中。默认使用Git插件,能提供 Git状态颜色编码和提示符。要想使用其他自带的插件,只需要编辑~/.zshrc文件,添加插件名称即可。

  12. 安装几个插件:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    # ubuntu安装git
    sudo apt update
    sudo apt install git

    # zsh-syntax-highlighting:终端命令语法高亮
    git clone https://github.com/zsh-users/zsh-syntax-highlighting ~/.oh-my-zsh/plugins/zsh-syntax-highlighting


    # zsh-autosuggestions:自动补全
    git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/plugins/zsh-autosuggestions

  13. vim ~/.zshrc编辑文件,添加插件:

    1
    2
    3
    4
    5
    plugins=(
    ... # 之前已经声明的插件名称
    zsh-autosuggestions
    zsh-syntax-highlighting
    )
  14. 运行source ~/.zshrc重新加载配置文件。

  15. 提一下,上述配置只对当前用户生效,文件都在用户目录下。

  1. 似乎使用zsh在配置环境变量方面有些不同,后续待补。
  2. 可参考https://zhuanlan.zhihu.com/p/166103184

oh-my-posh
  1. 说实话oh-my-zsh太丑了。我发现wsl也是可以安装oh-my-posh的。

  2. 先运行sudo vim /etc/passwd编辑文件,将用户的shell修改回为bash

  3. 安装oh-my-posh(更新就重新下载,覆原文件夹)。

    1
    2
    sudo wget https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/posh-linux-amd64 -O /usr/local/bin/oh-my-posh
    sudo chmod +x /usr/local/bin/oh-my-posh
  4. 下载主题:

    1
    2
    3
    4
    5
    mkdir ~/.poshthemes
    wget https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/themes.zip -O ~/.poshthemes/themes.zip
    unzip ~/.poshthemes/themes.zip -d ~/.poshthemes
    chmod u+rw ~/.poshthemes/*.omp.*
    rm ~/.poshthemes/themes.zip
  5. 可以在bash的配置文件(~/.bashrc~/.profile~/.bash_profile)中配置一下,在最后一行加入喜欢的主题:

    1
    eval "$(oh-my-posh --init --shell bash --config ~/.poshthemes/catppuccin_macchiato.omp.json)"
  6. 运行bash生效(有的是运行. ~/.profile )。

  7. 其他详细内容参考官方文档


window美化

鼠标样式
  1. github下载对应的鼠标样式。
  2. 解压,选择喜欢的鼠标样式,右键.inf文件安装鼠标样式。

mybockfinder
  1. steam安装mybockfinder,按照自己的喜好设置即可。
  2. 为了保证开机自启,相关设置选择服务选项。

雨滴插件
  1. 官网安装
  2. 下载安装主题即可,推荐致美化

Wallpaper Engine
  1. steam安装壁纸引擎(Wallpaper Engine,收费),按照自己的喜好设置壁纸。
  2. 设置为开机自启。