终端配置

Alacritty + Zsh + Oh-My-Zsh + Starship

  1. 下载
  2. 字体,推荐JetBrainsMono Nerd Font
  3. 主题,推荐gruvbox_dark
  4. 配置文件。
    • Windows:C:\Users\backt\AppData\Roaming\alacritty\alacritty.yml
    • MacOS:
  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
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# 自动刷新
live_config_reload: true


# Tab 缩进
tabspaces: 4


# 默认终端
shell:
  # WSL
  program: C:/WINDOWS/system32/wsl.exe
  args:
    - -d Ubuntu


# 默认目录
working_directory: C:/Users/backt


# 字体配置
font:
  size: 10
  normal:
    family: JetBrainsMono Nerd Font
    style: Medium
  bold:
    family: JetBrainsMono Nerd Font
    style: Bold
  italic:
    family: JetBrainsMono Nerd Font
    style: Italic


# 光标配置
cursor:
  style:
    # - Block: 方块
    # - Underline: 下划线
    # - Beam: 竖线
    shape: Beam


# 窗口设置
window:
  # 背景透明度
  opacity: 0.9

  # 窗口大小
  dimensions:
    columns: 100
    lines: 30

  # 窗口位置
  position:
    x: 100
    y: 100

  # 窗口内边距
  padding:
    x: 5
    y: 5

  # 显示模式
  # - Windowed: 窗口化
  # - Maximized: 最大化
  # - Fullscreen: 全屏
  startup_mode: Windowed

  # 窗口修饰
  # - full: 有边界 + 标题栏
  # - none: 无边界 + 标题栏
  decorations: full
  dynamic_padding: true
  dynamic_title: true


# 滚动
scrolling:
  history: 100000       # 历史保留行数
  multiplier: 3         # 每次滚动行数
  faux_multiplier: 100  # 每次滚动行数(分屏时)
  auto_scroll: true     # 自动滚动至最新行


# 主题 (Gruvbox dark)
colors:
  # Default colors
  primary:
    # hard contrast: background = '0x1d2021'
    background: '0x282828'
    # soft contrast: background = '0x32302f'
    foreground: '0xebdbb2'

  # Normal colors
  normal:
    black:   '0x282828'
    red:     '0xcc241d'
    green:   '0x98971a'
    yellow:  '0xd79921'
    blue:    '0x458588'
    magenta: '0xb16286'
    cyan:    '0x689d6a'
    white:   '0xa89984'

  # Bright colors
  bright:
    black:   '0x928374'
    red:     '0xfb4934'
    green:   '0xb8bb26'
    yellow:  '0xfabd2f'
    blue:    '0x83a598'
    magenta: '0xd3869b'
    cyan:    '0x8ec07c'
    white:   '0xebdbb2'

1
2
3
4
5
6
7
8
# 查看是否安装zsh
cat /etc/shells | grep zsh

# 安装zsh
sudo apt install zsh

# 设置zsh为默认终端
sudo chsh -s /bin/zsh

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

# 插件
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-completions ${ZSH_CUSTOM:=~/.oh-my-zsh/custom}/plugins/zsh-completions

# 配置
vim ~/.zshrc
# plugins=(
#     git
#     zsh-autosuggestions
#     zsh-syntax-highlighting
#     zsh-completions
# )
source ~/.zshrc

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# 安装starship
curl -sS https://starship.rs/install.sh | sh

# 配置
vim ~/.zshrc
# eval "$(starship init zsh)"
source ~/.zshrc

# [主题](https://starship.rs/presets/#plain-text-symbols)
starship preset plain-text-symbols -o ~/.config/starship.toml