最后活跃于 1 year ago

修订 da8b0b4881bd1410e4e3524883c05d448db24fe5

wezterm.lua 原始文件
1local wt = require("wezterm");
2local TabBackground = "#000"
3local TabForeground = "#aaa"
4local TabForegroundActive = "#fff"
5function string.split(str, sep)
6 local t = {}
7 for s in string.gmatch(str, "([^" .. sep .. "]+)") do
8 table.insert(t, s)
9 end
10 return t
11end
12
13function reduce_title(title)
14 title = title:gsub("\\", "/")
15 title = title:split("/")
16 return title[#title]
17end
18
19wt.on("format-tab-title", function(tab, tabs, panes, config, hover, max_width)
20 return reduce_title(tab.active_pane.title)
21end)
22wt.on("format-window-title", function(tab, pane, tabs, panes, config)
23 return reduce_title(tab.active_pane.title)
24end)
25return {
26 color_scheme = "Monokai Remastered",
27 colors = {
28 tab_bar = {
29 background = TabBackground,
30 active_tab = {
31 bg_color = TabBackground,
32 fg_color = TabForegroundActive,
33 intensity = "Bold",
34 },
35 inactive_tab = {
36 bg_color = TabBackground,
37 fg_color = TabForeground,
38 intensity = "Normal",
39 },
40 inactive_tab_hover = {
41 bg_color = TabBackground,
42 fg_color = TabForegroundActive,
43 intensity = "Normal",
44 },
45 new_tab = {
46 bg_color = TabBackground,
47 fg_color = TabForeground,
48 },
49 new_tab_hover = {
50 bg_color = TabBackground,
51 fg_color = TabForegroundActive,
52 },
53 },
54 },
55 initial_cols = 100,
56 initial_rows = 30,
57 font = wt.font("等距更纱黑体 SC"),
58 font_size = 14,
59 default_cursor_style = "BlinkingBar",
60 cursor_blink_rate = 500,
61 -- hide_tab_bar_if_only_one_tab = true,
62 -- window_background_opacity = 0.85,
63 default_prog = { "D:/PowerShell/7/pwsh.exe"},
64 alternate_buffer_wheel_scroll_speed = 1,
65 window_padding = {
66 left = 0,
67 right = 0,
68 top = 0,
69 bottom = 0,
70 },
71 keys = {
72 {
73 key = "t",
74 mods = "CTRL",
75 action = wt.action {
76 SpawnTab = "DefaultDomain",
77 },
78 },
79 {
80 key = "V",
81 mods = "SHIFT|CTRL",
82 action = wt.action.PasteFrom 'Clipboard'
83 },
84 {
85 key = "RightArrow",
86 mods = "ALT",
87 action = wt.action {
88 ActivateTabRelative = 1,
89 },
90 },
91 {
92 key = "LeftArrow",
93 mods = "ALT",
94 action = wt.action {
95 ActivateTabRelative = -1,
96 },
97 },
98 },
99 mouse_bindings = {
100 -- Change the default click behavior so that it populates
101 -- the Clipboard rather the PrimarySelection.
102 {
103 event = { Up = { streak = 1, button = 'Left' } },
104 mods = 'NONE',
105 action = wt.action.CompleteSelectionOrOpenLinkAtMouseCursor 'Clipboard',
106 },
107 {
108 event = { Up = { streak = 1, button = 'Right' } },
109 mods = 'NONE',
110 action = wt.action.PasteFrom 'Clipboard',
111 }
112 },
113}
114