Created
September 25, 2024 23:06
-
-
Save 3Shoka/7dd081236fec97a18b6d87f08735e6c4 to your computer and use it in GitHub Desktop.
wezterm configuration file on windows with wsl ubuntu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Pull in the wezterm API | |
local wezterm = require("wezterm") | |
-- 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 is where you actually apply your config choices | |
config.default_domain = "WSL:Ubuntu" | |
-- tab width 100% | |
config.tab_max_width = 100 | |
-- For example, changing the color scheme: | |
config.color_scheme = "Dracula (Official)" | |
-- config.font = wezterm.font("JetBrains Mono NL") | |
config.font_size = 10 | |
config.initial_cols = 100 | |
config.initial_rows = 20 | |
config.window_decorations = "RESIZE" | |
-- tmux | |
config.leader = { key = "q", mods = "ALT", timeout_milliseconds = 2000 } | |
config.keys = { | |
{ | |
mods = "LEADER", | |
key = "c", | |
action = wezterm.action.SpawnTab("CurrentPaneDomain"), | |
}, | |
{ | |
mods = "LEADER", | |
key = "x", | |
action = wezterm.action.CloseCurrentPane({ confirm = false }), | |
}, | |
{ | |
mods = "LEADER", | |
key = "b", | |
action = wezterm.action.ActivateTabRelative(-1), | |
}, | |
{ | |
mods = "LEADER", | |
key = "n", | |
action = wezterm.action.ActivateTabRelative(1), | |
}, | |
{ | |
mods = "LEADER", | |
key = "=", | |
action = wezterm.action.SplitHorizontal({ domain = "CurrentPaneDomain" }), | |
}, | |
{ | |
mods = "LEADER", | |
key = "-", | |
action = wezterm.action.SplitVertical({ domain = "CurrentPaneDomain" }), | |
}, | |
{ | |
mods = "LEADER", | |
key = "h", | |
action = wezterm.action.ActivatePaneDirection("Left"), | |
}, | |
{ | |
mods = "LEADER", | |
key = "j", | |
action = wezterm.action.ActivatePaneDirection("Down"), | |
}, | |
{ | |
mods = "LEADER", | |
key = "k", | |
action = wezterm.action.ActivatePaneDirection("Up"), | |
}, | |
{ | |
mods = "LEADER", | |
key = "l", | |
action = wezterm.action.ActivatePaneDirection("Right"), | |
}, | |
{ | |
mods = "LEADER", | |
key = "LeftArrow", | |
action = wezterm.action.AdjustPaneSize({ "Left", 5 }), | |
}, | |
{ | |
mods = "LEADER", | |
key = "RightArrow", | |
action = wezterm.action.AdjustPaneSize({ "Right", 5 }), | |
}, | |
{ | |
mods = "LEADER", | |
key = "DownArrow", | |
action = wezterm.action.AdjustPaneSize({ "Down", 5 }), | |
}, | |
{ | |
mods = "LEADER", | |
key = "UpArrow", | |
action = wezterm.action.AdjustPaneSize({ "Up", 5 }), | |
}, | |
{ | |
mods = 'LEADER', | |
key = 'z', | |
action = wezterm.action.TogglePaneZoomState | |
}, | |
} | |
-- StartWindowDrag | |
config.mouse_bindings = { | |
{ | |
event = { Drag = { streak = 1, button = "Right" } }, | |
mods = "CTRL", | |
action = wezterm.action.StartWindowDrag, | |
}, | |
} | |
for i = 0, 9 do | |
-- leader + number to activate that tab | |
table.insert(config.keys, { | |
key = tostring(i), | |
mods = "LEADER", | |
action = wezterm.action.ActivateTab(i), | |
}) | |
end | |
-- tab bar | |
config.hide_tab_bar_if_only_one_tab = false | |
config.tab_bar_at_bottom = true | |
config.use_fancy_tab_bar = false | |
config.tab_and_split_indices_are_zero_based = true | |
-- tmux status | |
wezterm.on("update-right-status", function(window, _) | |
local SOLID_LEFT_ARROW = "" | |
local ARROW_FOREGROUND = { Foreground = { Color = "#bd93f9" } } -- warna arrow prefix active bd93f9 | |
local prefix = "" | |
if window:leader_is_active() then | |
prefix = " " .. utf8.char(0x1f577) .. " " -- ocean wave | |
SOLID_LEFT_ARROW = utf8.char(0xe0b2) | |
end | |
if window:active_tab():tab_id() ~= 0 then | |
ARROW_FOREGROUND = { Foreground = { Color = "#282a36" } } | |
end -- arrow color based on if tab is first pane | |
window:set_left_status(wezterm.format({ | |
{ Background = { Color = "#b7bdf8" } }, -- background icon prefix 6272a4 | |
{ Text = prefix }, | |
ARROW_FOREGROUND, | |
{ Text = SOLID_LEFT_ARROW }, | |
})) | |
end) | |
config.window_background_gradient = { | |
-- orientation = "Vertical", | |
orientation = { Linear = { angle = -45.0 } }, | |
colors = { | |
"#24243e", | |
-- "#302b63", | |
"#282a36", | |
}, | |
interpolation = "Linear", | |
blend = "Rgb", | |
noise = 0, | |
-- segment_size = 10, | |
-- segment_smoothness = 0.0, | |
} | |
config.window_background_opacity = 0.9 -- Default opacity when not fullscreen | |
config.window_frame = { | |
border_left_width = "0.125cell", | |
border_right_width = "0.125cell", | |
border_bottom_height = "0.125cell", | |
border_top_height = "0.125cell", | |
border_left_color = "#bd93f9", | |
border_right_color = "#bd93f9", | |
border_bottom_color = "#bd93f9", | |
border_top_color = "#bd93f9", | |
} | |
-- and finally, return the configuration to wezterm | |
return config |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment