Alacritty 命令行配置和使用

44 min read

Alacritty 命令行配置和使用MAC安装

https://github.com/alacritty/alacritty

替换默认的应用图标

https://gw.alipayobjects.com/os/k/41/logo.icns

替换字体

https://www.jetbrains.com/lp/mono/

配置路径

~/.config/alacritty/alacritty.yml

配置文件

# Colors (Aura Theme)
colors:
  # Default colors
  primary:
    background: "#15141b"
    foreground: "#edecee"

  cursor:
    cursor: "#a277ff"

  selection:
    text: CellForeground
    background: "#9A8FE2"

  # Normal colors
  normal:
    black: "#110f18"
    red: "#ff6767"
    green: "#61ffca"
    yellow: "#ffca85"
    blue: "#a277ff"
    magenta: "#a277ff"
    cyan: "#61ffca"
    white: "#edecee"

  # Bright colors
  bright:
    black: "#4d4d4d"
    red: "#ff6767"
    green: "#61ffca"
    yellow: "#ffca85"
    blue: "#a277ff"
    magenta: "#a277ff"
    cyan: "#61ffca"
    white: "#edecee"

  search:
    matches:
      foreground: "#000000"
      background: "#ffffff"
    focused_match:
      foreground: "#ffffff"
      background: "#9F7AF5"

# 设置字体
font:
  normal:
    family: "JetBrains Mono"
    style: Regular
  bold:
    family: "JetBrains Mono"
    style: Regular
  italic:
    family: "JetBrains Mono"
    style: Italic
  bold_italic:
    family: "JetBrains Mono"
    style: Italic

  # 字大小
  size: 14.0

  offset:
    x: 0
    y: 8
  glyph_offset:
    x: 0
    y: 0

window:
  opacity: 0.9
  padding:
    x: 22
    y: 26
  decorations: transparent
  dimensions:
    columns: 106
    lines: 25

scrolling:
  # 回滚缓冲区中的最大行数,指定“0”将禁用滚动。
  history: 100000
  # 滚动行数
  multiplier: 4

cursor:
  style:
    blinking: Always
    blink_interval: 500

# 如果为‘true’,则使用亮色变体绘制粗体文本。
draw_bold_text_with_bright_colors: false

selection:
  semantic_escape_chars: ',│`|:"'' ()[]{}<>'
  save_to_clipboard: true

live_config_reload: true

# 设置键盘映射
key_bindings:
  - { key: R, mods: Command, mode: ~Vi|~Search, chars: "\x0c" }
  - { key: R, mods: Command, mode: ~Vi|~Search, action: ClearHistory }
  # - { key: W, mods: Command, action: Hide }
  - { key: W, mods: Command|Shift, action: Quit }
  - { key: T, mods: Command, action: SpawnNewInstance }
  - { key: N, mods: Command, action: CreateNewWindow }
  - { key: Left, mods: Alt, chars: "\x1bb" } # Skip word left
  - { key: Right, mods: Alt, chars: "\x1bf" } # Skip word right
  - { key: Left, mods: Command, chars: "\x1bOH", mode: AppCursor } # Home
  - { key: Right, mods: Command, chars: "\x1bOF", mode: AppCursor } # End
  - { key: Back, mods: Command, chars: "\x15" } # Delete line
  - { key: Back, mods: Alt, chars: "\x1b\x7f" } # Delete word