alacritty

警告
本文最后更新于 2023-11-03,文中内容可能已过时。

alacrittyterminator 更加强大。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
apt install cmake pkg-config libfreetype6-dev libfontconfig1-dev libxcb-xfixes0-dev libxkbcommon-dev python3
apt-get update --fix-missing
sudo apt install git curl cargo
cd /tmp
git clone https://github.com/alacritty/alacritty.git
cd alacritty/
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source "$HOME/.cargo/env"
rustup override set stable
sudo apt install cmake pkg-config libfreetype6-dev libfontconfig1-dev libxcb-xfixes0-dev python3
cargo build --release
cargo build --release
sudo cp target/release/alacritty /usr/local/bin # or anywhere else in $PATH
sudo cp extra/logo/alacritty-term.svg /usr/share/pixmaps/Alacritty.svg
sudo desktop-file-install extra/linux/Alacritty.desktop
sudo update-desktop-database

处理 tmux 问题

1
2
3
4
5
6
## https://github.com/alacritty/alacritty/issues/2487
export TERM=xterm-256color

## 或者尝试使用以下配置
export TERM=xterm
tmux kill-server

处理 nvim 颜色显示问题

1
2
3
## https://github.com/alacritty/alacritty/issues/3354
set-option -ga terminal-overrides ",alacritty:Tc"
set -g default-terminal "alacritty"

color issues

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## tmux.conf
## alacrrity: https://github.com/alacritty/alacritty/issues/3354
set-option -ga terminal-overrides ",alacritty:Tc"
set -g default-terminal "alacritty"
## https://www.reddit.com/r/tmux/comments/onom6t/nvim_colors_change_if_on_tmux_on_alacritty/
set -g default-terminal 'xterm-256color'
set -as terminal-overrides ',xterm*:Tc:sitm=\E[3m'

## .zshrc
## alacritty
export TERM=xterm-256color

## .bashrc

## colo
## .zshrc
export TERM=xterm-256color
## .bashrc
export TERM=xterm-256color

从 yaml 转换到 toml

1
2
3
4
alacritty migrate -c xxx.yaml

## 或者批量转换
find . -type f -name '*.yaml' | xargs -I {} alacritty migrate -c {}

我的配置

  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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
## -----------------------------------------------------------------------------color
import = [ "~/.config/alacritty/git/alacritty-theme/themes/tokyo-night-storm.toml" ]

## https://github.com/enkia/tokyo-night-vscode-theme/blob/master/themes/tokyo-night-storm-color-theme.json
#[colors.primary]
#background = "0x24283b"
##foreground = "0xa9b1d6"
#foreground = "#7982a9"

live_config_reload = true

[[colors.indexed_colors]]
color = "#FAB387"
index = 16

[[colors.indexed_colors]]
color = "#F5E0DC"
index = 17

[colors.cursor]
## 注释掉表示颜色反转
#cursor = "#F5E0DC"
#text = "#1E1E2E"
[colors.primary]
#background = "#1E1E2E"
#foreground = "#CDD6F4"
bright_foreground = "#CDD6F4"
dim_foreground = "#CDD6F4"
## tokyonight
#background= '#24283b'
#foreground= '#a9b1d6'

[colors.normal]
green = "0x449dab"

[colors.dim]
black = "#45475A"
blue = "#89B4FA"
cyan = "#94E2D5"
green = "#A6E3A1"
magenta = "#F5C2E7"
red = "#F38BA8"
white = "#BAC2DE"
yellow = "#F9E2AF"

[colors.hints.end]
background = "#A6ADC8"
foreground = "#1E1E2E"

[colors.hints.start]
background = "#F9E2AF"
foreground = "#1E1E2E"

[colors.search.focused_match]
background = "#A6E3A1"
foreground = "#1E1E2E"

[colors.search.matches]
background = "#A6ADC8"
foreground = "#1E1E2E"

[colors.selection]
background = "#F5E0DC"
text = "#1E1E2E"

[colors.vi_mode_cursor]
cursor = "#B4BEFE"
text = "#1E1E2E"

## ----------------------------------------------------------------------------env
[env]
TERM='xterm-256color'
# TERM='Alacritty'

## -----------------------------------------------------------------------------window
[window]
opacity = 0.90
padding.x = 12 ## width
padding.y =  0 ## height
decorations = "Transparent"
# decorations = "None" ## Full, Transparent, Buttonless, None
decorations_theme_variant = "Dark" #"Light", "Dark"
startup_mode = 'Maximized'

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

## -----------------------------------------------------------------------------font
[font]
size = 12.6
[font.normal]
#family = "FiraCode Nerd Font"
# family = "SauceCodePro Nerd Font"
family = "JetBrainsMono Nerd Font"
style = "Regular"
[font.italic]
# family = "SauceCodePro Nerd Font"
family = "JetBrainsMono Nerd Font"
style = "Italic"
[font.bold]
# family = "SauceCodePro Nerd Font"
family = "JetBrainsMono Nerd Font"
style = "Bold"

[[keyboard.bindings]]
action = "SpawnNewInstance"
key = "Return"
mods = "Control|Shift"

## https://alacritty.org/config-alacritty.html
[[keyboard.bindings]]
# action = "DecreaseFontSize"
action = "None"
key = "Minus"
mods = "Control"
[[keyboard.bindings]]
# action = "IncreaseFontSize"
action = "None"
key = "Equals"
mods = "Control"
[[keyboard.bindings]]
action = "DecreaseFontSize"
key = "Minus"
mods = "Control | Alt"
[[keyboard.bindings]]
action = "IncreaseFontSize"
key = "Equals"
mods = "Control | Alt"

## ----------------------------------------------------------------------------shell
[shell]
program = "/usr/bin/zsh"

## ----------------------------------------------------------------------------selection: copy and paste
[selection]
# This string contains all characters that are used as separators for "semantic words" in Alacritty.
semantic_escape_chars=",│`|:\"' ()[]{}<>\t"
# When set to `true`, selected text will be copied to the primary clipboard.
save_to_clipboard=true

## https://github.com/alacritty/alacritty/issues/6592
[[mouse.bindings]]
action = "PasteSelection"
mouse = "Middle"
[[mouse.bindings]]
action = "PasteSelection"
mouse = "Right"
[[keyboard.bindings]]
key = "V"
mods = "ALT"
action = "Paste"
# [keyboard]
# bindings = [
#   { key = "C", mods = "Control|Shift", mode = "Vi|Search", action = "ClearSelection" },
#   { key = "Insert", mods = "Shift", action = "Paste" }
# ]
]

Ref

相关内容

william 支付宝支付宝
william 微信微信
0%