Alacritty

1.26

介绍

Alacritty:速度非常快的跨平台终端。

A cross-platform, GPU-accelerated terminal emulator.

Config

https://alacritty.org/config-alacritty.html

Color theme

https://github.com/alacritty/alacritty-theme

Example

# https://alacritty.org/config-alacritty.html
# ~/.config/alacritty/alacritty.toml

import = ["/path/to/local/alacritty.toml"]
# https://alacritty.org/config-alacritty.html

[font]
normal = { family = "FiraCode Nerd Font", style = "Retina" }
size = 16
offset = {x = 1}

[window]
padding = {x = 10, y = 10}
# decorations = "Transparent"

[cursor]
style = { shape = "Block" }
vi_mode_style = { shape = "Block" }
# thickness = 0.5

[mouse]
hide_when_typing = true

[scrolling]
multiplier = 3

[[hints.enabled]]
# command = "xdg-open" # On Linux/BSD
command = "open" # On macOS
# command = { program = "cmd", args = [ "/c", "start", "" ] } # On Windows
hyperlinks = true
post_processing = true
persist = false
mouse.enabled = true
binding = { key = "f", mods = "Command" }
regex = "(ipfs:|ipns:|magnet:|mailto:|gemini://|gopher://|https://|http://|news:|file:|git://|ssh:|ftp://)[^\u0000-\u001F\u007F-\u009F<>\"\\s{-}\\^⟨⟩`]+"


[keyboard]
bindings = [
    { key = "K", mods = "Command", action = "ScrollHalfPageUp" }, 
    { key = "J", mods = "Command", action = "ScrollHalfPageDown" }, 
    { key = "Escape", mode = "~Alt|~Vi", action = "ToggleViMode" }, 
    { key = "K", mods = "Shift", mode = "Vi", action = "ScrollHalfPageUp" }, 
    { key = "J", mods = "Shift", mode = "Vi", action = "ScrollHalfPageDown" }, 
    { key = "p", mode = "Vi", action = "Paste" }, 
    { key = "a", mode = "Vi", action = "ToggleViMode" }, 
    { key = "Tab", mods = "Control", action = "SelectNextTab" }, 
    { key = "Tab", mods = "Control|Shift", action = "SelectPreviousTab" }, 
]

[colors]
vi_mode_cursor = { cursor = "#eee000" }

# Colors (One Dark)

# Default colors
[colors.primary]
background = '#1e2127'
foreground = '#abb2bf'

# Normal colors
[colors.normal]
black   = '#1e2127'
red     = '#e06c75'
green   = '#98c379'
yellow  = '#d19a66'
blue    = '#61afef'
magenta = '#c678dd'
cyan    = '#56b6c2'
white   = '#abb2bf'

# Bright colors
[colors.bright]
black   = '#5c6370'
red     = '#e06c75'
green   = '#98c379'
yellow  = '#d19a66'
blue    = '#61afef'
magenta = '#c678dd'
cyan    = '#56b6c2'
white   = '#ffffff'

Key mapping with Tmux

参考:https://twitter.com/fatih/status/956248969503498240?lang=en

假如要使用Command + T来新建 Tmux tab,可以先在终端检测 ctrl-b c对应的编码

$ xxd -c1
^Bc
00000000: 02  .
00000001: 63  c

* First "c-b" line corresponds to 02
* Second "c" line corresponds to 63

配置 alacritty.yml

key_bindings:
  - {  mods: Command, keys: T, chars: "\x02\x63" }
📖