dotfiles.nix/home-manager/sajenim/features/desktop/wezterm/config/wezterm.lua

119 lines
3.8 KiB
Lua
Raw Normal View History

2023-05-02 16:39:42 +08:00
-- Pull in the wezterm API
local wezterm = require 'wezterm'
local act = wezterm.action
-- This table will hold the configuration.
local config = {}
-- In newer versions of wezterm, use the config_builder which will
-- help provide clearer error messages
if wezterm.config_builder then
config = wezterm.config_builder()
end
-- This function returns the suggested title for a tab.
-- It prefers the title that was set via `tab:set_title()`
-- or `wezterm cli set-tab-title`, but falls back to the
-- title of the active pane in that tab.
function tab_title(tab_info)
local title = tab_info.tab_title
-- if the tab title is explicitly set, take that
if title and #title > 0 then
return title
end
-- Otherwise, use the title from the active pane
-- in that tab
return tab_info.active_pane.title
end
wezterm.on(
'format-tab-title',
function(tab, tabs, panes, config, hover, max_width)
local title = tab_title(tab)
return { { Text = ' ' .. title .. '' }, }
end
)
-- Do not check for or show window with update information
config.check_for_updates = false
config.show_update_window = false
2023-07-10 06:44:26 +08:00
--| Font Configuration
2023-10-10 19:01:52 +08:00
config.font = wezterm.font 'Fisa Code'
2023-05-02 16:39:42 +08:00
config.font_size = 10.0
2023-07-10 06:44:26 +08:00
--| Color scheme
2023-05-02 16:39:42 +08:00
config.color_scheme = 'gruvbox_material_dark_hard'
2024-01-29 22:57:12 +08:00
--| Cursor style
config.default_cursor_style = 'SteadyBar'
2023-07-10 06:44:26 +08:00
--| Padding
2023-05-02 16:39:42 +08:00
config.window_padding = {
2024-01-29 22:27:40 +08:00
left = 10,
right = 10,
top = 10,
bottom = 10,
2023-05-02 16:39:42 +08:00
}
2023-07-09 20:16:43 +08:00
--| Style Inactive Panes
config.inactive_pane_hsb = {
saturation = 1.0,
brightness = 1.0,
}
2023-07-10 06:44:26 +08:00
--| Tab Bar Appearance
2023-05-02 16:39:42 +08:00
config.use_fancy_tab_bar = false
config.enable_tab_bar = true
2024-01-29 22:27:56 +08:00
config.hide_tab_bar_if_only_one_tab = true
2023-07-09 20:16:18 +08:00
config.tab_bar_at_bottom = false
2023-05-02 16:39:42 +08:00
config.tab_max_width = 24
config.show_tab_index_in_tab_bar = false
2023-07-10 06:44:26 +08:00
--| Colors
2023-05-02 16:39:42 +08:00
config.colors = {
2023-07-10 06:44:26 +08:00
2023-05-02 16:39:42 +08:00
tab_bar = {
2023-07-10 06:44:26 +08:00
--| Tab Bar Colors
2023-07-09 20:16:18 +08:00
background = '#282828',
2023-07-10 06:44:26 +08:00
--| Tab Colors
2024-01-29 22:28:25 +08:00
active_tab = { bg_color = '#282828', fg_color = '#7daea3', intensity = 'Normal', italic = false, },
inactive_tab = { bg_color = '#282828', fg_color = '#a89984', intensity = 'Normal', italic = false, },
inactive_tab_hover = { bg_color = '#282828', fg_color = '#a89984', intensity = 'Normal', italic = false, },
new_tab = { bg_color = '#282828', fg_color = '#a89984', intensity = 'Normal', italic = false, },
new_tab_hover = { bg_color = '#282828', fg_color = '#a89984', intensity = 'Normal', italic = false, },
2023-05-02 16:39:42 +08:00
}
}
2023-07-10 06:44:26 +08:00
--| Key Assignments
2023-05-02 16:39:42 +08:00
config.disable_default_key_bindings = true
config.keys = {
2023-07-10 06:44:26 +08:00
--| Spawn Tab
2024-08-07 20:59:24 +08:00
{ key = 'n', mods = 'ALT', action = act.SpawnTab 'CurrentPaneDomain', },
2023-07-10 06:44:26 +08:00
--| Tab Navigation
{ key = 'LeftArrow', mods = 'ALT', action = act.ActivateTabRelative(-1) },
{ key = 'RightArrow', mods = 'ALT', action = act.ActivateTabRelative(1) },
2023-05-02 16:39:42 +08:00
2023-07-10 06:44:26 +08:00
--| Split Panes
{ key = 'v', mods = 'ALT', action = act.SplitVertical { domain = 'CurrentPaneDomain' }, },
2024-02-06 20:18:20 +08:00
{ key = 's', mods = 'ALT', action = act.SplitHorizontal { domain = 'CurrentPaneDomain' }, },
2023-07-10 06:44:26 +08:00
--| Adjust Pane Size
2023-07-10 07:21:40 +08:00
{ key = 'PageDown', mods = 'ALT', action = act.AdjustPaneSize { 'Down', 5 } },
{ key = 'PageUp', mods = 'ALT', action = act.AdjustPaneSize { 'Up', 5 } },
2023-07-10 06:44:26 +08:00
--| Pane Navigation
{ key = 'DownArrow', mods = 'ALT', action = act.ActivatePaneDirection 'Next', },
{ key = 'UpArrow', mods = 'ALT', action = act.ActivatePaneDirection 'Prev', },
--| Close Pane
2024-08-07 20:59:24 +08:00
{ key = 'Escape', mods = "ALT", action = act.CloseCurrentPane { confirm = false }, },
2023-05-02 16:39:42 +08:00
2023-07-10 06:44:26 +08:00
--| Copy Mode / Clipboard
2023-05-02 16:39:42 +08:00
{ key = 'X', mods = 'CTRL', action = act.ActivateCopyMode, },
{ key = 'V', mods = 'CTRL', action = act.PasteFrom 'Clipboard', },
--| This lets us unify delete word across programs
{ key = 'Backspace', mods = 'CTRL', action = act.SendKey {key = 'w', mods = 'CTRL'} },
2023-05-02 16:39:42 +08:00
}
return config