目录

打造一个赏心悦目的终端

本文基于Windows平台,系统用的是WSL(ubuntu 20.04),shell用的是zsh,linux系统应该类似

先看效果:
Windows Terminal: /images/oh-my-zsh_windows_terminal.jpg

VsCode: /images/oh-my-zsh_vscode.png

oh-my-zsh

官方页面:https://ohmyz.sh/ github地址:https://github.com/ohmyzsh/ohmyzsh

安装

apt install zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

配置

主题

我使用的是https://github.com/romkatv/powerlevel10k

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

常用命令:

命令 作用
p10k configure 重新配置powerlevel10k
p10k help 查看帮助

插件

插件地址:https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins

git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

修改配置 vim ~/.zshrc

plugins=(
    git
    zsh-autosuggestions
)

字体

建议使用带emoji的poweline字体, 推荐Nert Fonts, 我用的是jetbrains

关于等宽字体

顾名思义,等宽字体就是宽度相等的字体,举个例子:普通字体中M看体型就比i要宽,但是等宽字体中他俩是一样宽的,在编辑器中就可以对齐了

等宽字体一般文件名中带Mono,如JetBrains Mono,但是大部分等宽字体只对英文生效,中文字体和中文符号是不对齐的
想要中文也对齐的小伙伴可以使用这个字体:Ubuntu Mono derivative Powerline,此字体一个汉字和两个英文一样宽。再也不怕终端符号对不齐啦。

windows terminal配置

改字体

“fontFace”: “JetBrainsMono NF”,

新版本的Windows Terminal可以有图形界面配置了

改配色

ayu配色: https://github.com/ayu-theme/ayu-colors

        {
            "background": "#0A0E14",
            "black": "#01060E",
            "blue": "#53BDFA",
            "brightBlack": "#686868",
            "brightBlue": "#59C2FF",
            "brightCyan": "#95E6CB",
            "brightGreen": "#C2D94C",
            "brightPurple": "#FFEE99",
            "brightRed": "#F07178",
            "brightWhite": "#FFFFFF",
            "brightYellow": "#FFB454",
            "cursorColor": "#FFFFFF",
            "cyan": "#90E1C6",
            "foreground": "#B3B1AD",
            "green": "#91B362",
            "name": "Ayu Dark",
            "purple": "#FAE994",
            "red": "#EA6C73",
            "selectionBackground": "#FFFFFF",
            "white": "#C7C7C7",
            "yellow": "#F9AF4F"
        },
        {
            "background": "#FAFAFA",
            "black": "#000000",
            "blue": "#3199E1",
            "brightBlack": "#686868",
            "brightBlue": "#399EE6",
            "brightCyan": "#4CBF99",
            "brightGreen": "#86B300",
            "brightPurple": "#A37ACC",
            "brightRed": "#F07171",
            "brightWhite": "#D1D1D1",
            "brightYellow": "#F2AE49",
            "cursorColor": "#FFFFFF",
            "cyan": "#46BA94",
            "foreground": "#6C7680",
            "green": "#99BF4D",
            "name": "Ayu Light",
            "purple": "#9E75C7",
            "red": "#EA6C6D",
            "selectionBackground": "#FFFFFF",
            "white": "#C7C7C7",
            "yellow": "#ECA944"
        },
        {
            "background": "#1F2430",
            "black": "#191E2A",
            "blue": "#6DCBFA",
            "brightBlack": "#686868",
            "brightBlue": "#73D0FF",
            "brightCyan": "#95E6CB",
            "brightGreen": "#BAE67E",
            "brightPurple": "#D4BFFF",
            "brightRed": "#F28779",
            "brightWhite": "#FFFFFF",
            "brightYellow": "#FFD580",
            "cursorColor": "#FFFFFF",
            "cyan": "#90E1C6",
            "foreground": "#CBCCC6",
            "green": "#A6CC70",
            "name": "Ayu Mirage",
            "purple": "#CFBAFA",
            "red": "#ED8274",
            "selectionBackground": "#FFFFFF",
            "white": "#C7C7C7",
            "yellow": "#FAD07B"
        },

透明背景

首先来个背景图: /images/background.png

设置背景图像路径
背景图像的不透明度:70
启用acrylic
acrylic不透明度:1

vscode 配置

设置➡️控制字体系列(editor.fontFamily)➡️在最前面添加 'MeslolGS NF',

/images/oh-my-zsh_vscode_settings.png

ubuntu 自带terminal配置

系统目录和用户目录二选一

  • 安装字体(系统目录)

    sudo mkdir -p /usr/share/fonts/custom
    sudo mv *.ttf /usr/share/fonts/custom
    
    sudo mkfontscale
    sudo mkfontdir
    sudo fc-cache -fv
    
  • 安装字体(用户目录)

    mv *.ttf ~/.local/share/fonts
    

terminal设置

自定义字体勾选,然后选择字体即可