Show your wezterms #628
Replies: 47 comments 55 replies
-
Would be great to see wezterm.lua along with picture. |
Beta Was this translation helpful? Give feedback.
-
Thats a good Idea. Will update |
Beta Was this translation helpful? Give feedback.
-
Here's mine! |
Beta Was this translation helpful? Give feedback.
-
Thx for your cool term 👍 , the below is my quick config to work on wsl2 mainly local wezterm = require 'wezterm';
if wezterm.target_triple == 'x86_64-pc-windows-msvc' then
-- Configs for Windows only
-- font_dirs = {
-- 'C:\\Users\\whoami\\.dotfiles\\.fonts'
-- }
default_prog = {'wsl.exe', '~', '-d', 'Ubuntu-20.04'}
end
if wezterm.target_triple == 'x86_64-apple-darwin' then
-- Configs for OSX only
-- font_dirs = { '$HOME/.dotfiles/.fonts' }
end
if wezterm.target_triple == 'x86_65-unknown-linux-gnu' then
-- Configs for Linux only
-- font_dirs = { '$HOME/.dotfiles/.fonts' }
end
return {
default_prog = default_prog,
hide_tab_bar_if_only_one_tab = true,
-- Do not hold on exit by default.
-- Because the default 'CloseOnCleanExit' can be annoying when exiting with
-- Ctrl-D and the last command exited with non-zero: the shell will exit
-- with non-zero and the terminal would hang until the window is closed manually.
exit_behavior = 'Close',
-- Pad window to avoid the content to be too close to the border,
-- so it's easier to see and select.
window_padding = {
left = 3, right = 3,
top = 3, bottom = 3,
},
inactive_pane_hsb = {
saturation = 0.9,
brightness = 0.8,
},
-- Fonts
font_size = 12,
line_height = 1.1,
font = wezterm.font('Iosevka Fixed', { stretch = 'Expanded', weight = 'Light' }),
}
|
Beta Was this translation helpful? Give feedback.
-
Playing with random colors. wezterm.luamath.randomseed(os.time())
local hue = math.random(0, 360);
return {
window_background_gradient = {
colors = {string.format("hwb(%f,%f%%,0%%)", hue, math.random(25, 40)), string.format("hwb(%f,0%%,%f%%)", hue, math.random(70, 100))},
blend = "Oklab",
orientation = {
Radial = {
cx = 0.8,
cy = 0.8,
radius = 1.2,
}
},
}
} |
Beta Was this translation helpful? Give feedback.
-
Feature:
https://github.com/azzamsa/dotfiles/blob/master/wezterm/.config/wezterm/wezterm.lua |
Beta Was this translation helpful? Give feedback.
-
Features
|
Beta Was this translation helpful? Give feedback.
-
wezterm.lualocal wezterm = require 'wezterm';
-- The filled in variant of the < symbol
local SOLID_LEFT_ARROW = utf8.char(0xe0ba)
local SOLID_LEFT_MOST = utf8.char(0x2588)
-- The filled in variant of the > symbol
local SOLID_RIGHT_ARROW = utf8.char(0xe0bc)
local ADMIN_ICON = utf8.char(0xf49c)
local CMD_ICON = utf8.char(0xe62a)
local NU_ICON = utf8.char(0xe7a8)
local PS_ICON = utf8.char(0xe70f)
local ELV_ICON = utf8.char(0xfc6f)
local WSL_ICON = utf8.char(0xf83c)
local YORI_ICON = utf8.char(0xf1d4)
local NYA_ICON = utf8.char(0xf61a)
local VIM_ICON = utf8.char(0xe62b)
local SUP_IDX = {"¹","²","³","⁴","⁵","⁶","⁷","⁸","⁹","¹⁰",
"¹¹","¹²","¹³","¹⁴","¹⁵","¹⁶","¹⁷","¹⁸","¹⁹","²⁰"}
local SUB_IDX = {"₁","₂","₃","₄","₅","₆","₇","₈","₉","₁₀",
"₁₁","₁₂","₁₃","₁₄","₁₅","₁₆","₁₇","₁₈","₁₉","₂₀"}
wezterm.on("format-tab-title", function(tab, tabs, panes, config, hover, max_width)
local edge_background = "#121212"
local background = "#4E4E4E"
local foreground = "#1C1B19"
local dim_foreground = "#3A3A3A"
if tab.is_active then
background = "#FBB829"
foreground = "#1C1B19"
elseif hover then
background = "#FF8700"
foreground = "#1C1B19"
end
local edge_foreground = background
local shell_cmd, shell_name
if tab.active_pane.title:find("nvim") then
shell_cmd = ""
shell_name = VIM_ICON .. tab.active_pane.title:gsub("^(%S+)%s+(%d+/%d+) %- nvim", " %2 %1")
elseif tab.active_pane.title:find("NYAGOS") then
shell_cmd = tab.active_pane.title
shell_name = NYA_ICON .. " " .. shell_cmd:gsub(".*: (.+) %- .+", "%1")
elseif tab.active_pane.title:find("Yori") then
shell_cmd = tab.active_pane.title:gsub(" %- Yori", "")
shell_name = YORI_ICON .. " " .. shell_cmd
else
shell_cmd, shell_name = tab.active_pane.title:match("^(.*\\(%w+)%.exe)")
end
local real_title = tab.active_pane.title:match(".*\\cmd%.exe %- (.+)$") or "CMD"
local clean_title
if shell_name == "nu" then
clean_title = NU_ICON .. " NuShell"
elseif shell_name == "pwsh" then
clean_title = PS_ICON .. " PS"
elseif shell_name == "cmd" then
clean_title = CMD_ICON .. " " .. real_title
elseif shell_name == "elvish" then
clean_title = ELV_ICON .. " Elvish"
elseif shell_name == "wsl" then
clean_title = WSL_ICON .. " WSL"
else
clean_title = shell_name
end
if shell_cmd and shell_cmd:match("Administrator: ") then
clean_title = clean_title .. " " .. ADMIN_ICON
end
local left_arrow = SOLID_LEFT_ARROW
if tab.tab_index == 0 then
left_arrow = SOLID_LEFT_MOST
end
local id = SUB_IDX[tab.tab_index+1]
local pid = SUP_IDX[tab.active_pane.pane_index+1]
local title = " " .. wezterm.truncate_right(clean_title, max_width-6) .. " "
return {
{Attribute={Intensity="Bold"}},
{Background={Color=edge_background}},
{Foreground={Color=edge_foreground}},
{Text=left_arrow},
{Background={Color=background}},
{Foreground={Color=foreground}},
{Text=id},
{Text=title},
{Foreground={Color=dim_foreground}},
{Text=pid},
{Background={Color=edge_background}},
{Foreground={Color=edge_foreground}},
{Text=SOLID_RIGHT_ARROW},
{Attribute={Intensity="Normal"}},
}
end)
return {
color_scheme = "srcery",
font_dirs = {"fonts"},
font_size = 11.0,
dpi = 96.0,
freetype_load_target = "Normal",
font = wezterm.font_with_fallback({
"Iosevka Mayukai Codepro",
"Sarasa Mono Slab CL"
}),
tab_max_width = 60,
enable_scroll_bar = true,
exit_behavior = "Close",
window_background_opacity = 0.94,
default_prog = {"nu.exe"},
set_environment_variables = {
LANG = "en_US.UTF-8",
PATH = "D:/dev_env/WezTerm;" .. os.getenv("PATH"),
},
colors = {
tab_bar = {
background = "#121212",
new_tab = {bg_color = "#121212", fg_color = "#FCE8C3", intensity = "Bold"},
new_tab_hover = {bg_color = "#121212", fg_color = "#FBB829", intensity = "Bold"},
active_tab = {bg_color = "#121212", fg_color = "#FCE8C3"},
}
},
window_background_gradient = {
orientation = "Vertical",
interpolation = "Linear",
blend = "Rgb",
colors = {
"#121212",
"#202020"
}
},
visual_bell = {
fade_in_duration_ms = 75,
fade_out_duration_ms = 75,
target = "CursorColor",
},
launch_menu = {
{
label = "Bottom",
args = {"btm.exe"},
},
{
label = "ntop",
args = {"ntop.exe"},
},
{
label = "Cmder",
args = {"cmd.exe", "/k", "D:/Scoop/apps/cmder/current/vendor/init.bat", "/f", "/nix_tools", "0"},
},
{
label = "Pwsh",
args = {"pwsh.exe", "-nol", "-noe"},
},
{
label = "NyaGOS",
args = {"nyagos.exe", "--glob"},
},
{
label = "NuShell",
args = {"nu.exe"},
},
{
label = "Elvish",
args = {"elvish.exe"},
},
{
label = "Yori",
args = {"yori.exe"},
},
{
label = "VS",
args = {"cmd.exe", "/k", "D:/Scoop/apps/cmder/current/vendor/init.bat", "/f", "/nix_tools", "0", "/VS"},
},
{
label = "PSVS",
args = {"pwsh.exe", "-noe", "-c", "&{Import-Module \"D:\\dev_env\\vs\\Common7\\Tools\\Microsoft.VisualStudio.DevShell.dll\"; Enter-VsDevShell 1c952f20}"},
}
},
disable_default_key_bindings = true,
leader = { key="`"},
keys = {
{key="Tab", mods="CTRL", action=wezterm.action{ActivateTabRelative=1}},
{key="Tab", mods="CTRL|SHIFT", action=wezterm.action{ActivateTabRelative=-1}},
{key="Enter", mods="ALT", action="ToggleFullScreen"},
{key="Insert", mods="SHIFT", action=wezterm.action{PasteFrom="PrimarySelection"}},
{key="Insert", mods="CTRL", action=wezterm.action{CopyTo="PrimarySelection"}},
{key="v", mods="LEADER", action=wezterm.action{SplitHorizontal={domain="CurrentPaneDomain"}}},
{key="s", mods="LEADER", action=wezterm.action{SplitVertical={domain="CurrentPaneDomain"}}},
{key="h", mods="LEADER", action=wezterm.action{ActivatePaneDirection="Left"}},
{key="l", mods="LEADER", action=wezterm.action{ActivatePaneDirection="Right"}},
{key="j", mods="LEADER", action=wezterm.action{ActivatePaneDirection="Down"}},
{key="k", mods="LEADER", action=wezterm.action{ActivatePaneDirection="Up"}},
{key="z", mods="LEADER", action="TogglePaneZoomState"},
{key="/", mods="LEADER", action=wezterm.action{Search={CaseInSensitiveString=""}}},
{key="q", mods="LEADER", action="QuickSelect"},
{key="1", mods="LEADER", action=wezterm.action{ActivateTab=0}},
{key="2", mods="LEADER", action=wezterm.action{ActivateTab=1}},
{key="3", mods="LEADER", action=wezterm.action{ActivateTab=2}},
{key="4", mods="LEADER", action=wezterm.action{ActivateTab=3}},
{key="5", mods="LEADER", action=wezterm.action{ActivateTab=4}},
{key="6", mods="LEADER", action=wezterm.action{ActivateTab=5}},
{key="7", mods="LEADER", action=wezterm.action{ActivateTab=6}},
{key="8", mods="LEADER", action=wezterm.action{ActivateTab=7}},
{key="9", mods="LEADER", action=wezterm.action{ActivateTab=8}},
{key="o", mods="LEADER", action="ActivateLastTab"},
{key="g", mods="LEADER", action="ShowTabNavigator"},
{key="c", mods="LEADER", action="ShowLauncher"},
{key="r", mods="LEADER", action="ReloadConfiguration"},
{key="x", mods="LEADER", action=wezterm.action{CloseCurrentPane={confirm=true}}},
{key="x", mods="LEADER|SHIFT", action=wezterm.action{CloseCurrentTab={confirm=true}}},
{key="`", mods="LEADER", action=wezterm.action{SendString="`"}},
}
} Improved Version:local wezterm = require 'wezterm';
-- Equivalent to POSIX basename(3)
-- Given "/foo/bar" returns "bar"
-- Given "c:\\foo\\bar" returns "bar"
local function basename(s)
return string.gsub(s, "(.*[/\\])(.*)", "%2")
end
local SOLID_LEFT_ARROW = utf8.char(0xe0ba)
local SOLID_LEFT_MOST = utf8.char(0x2588)
local SOLID_RIGHT_ARROW = utf8.char(0xe0bc)
local ADMIN_ICON = utf8.char(0xf49c)
local CMD_ICON = utf8.char(0xe62a)
local NU_ICON = utf8.char(0xe7a8)
local PS_ICON = utf8.char(0xe70f)
local ELV_ICON = utf8.char(0xfc6f)
local WSL_ICON = utf8.char(0xf83c)
local YORI_ICON = utf8.char(0xf1d4)
local NYA_ICON = utf8.char(0xf61a)
local VIM_ICON = utf8.char(0xe62b)
local PAGER_ICON = utf8.char(0xf718)
local FUZZY_ICON = utf8.char(0xf0b0)
local HOURGLASS_ICON = utf8.char(0xf252)
local SUNGLASS_ICON = utf8.char(0xf9df)
local PYTHON_ICON = utf8.char(0xf820)
local NODE_ICON = utf8.char(0xe74e)
local DENO_ICON = utf8.char(0xe628)
local LAMBDA_ICON = utf8.char(0xfb26)
local SUP_IDX = {"¹","²","³","⁴","⁵","⁶","⁷","⁸","⁹","¹⁰",
"¹¹","¹²","¹³","¹⁴","¹⁵","¹⁶","¹⁷","¹⁸","¹⁹","²⁰"}
local SUB_IDX = {"₁","₂","₃","₄","₅","₆","₇","₈","₉","₁₀",
"₁₁","₁₂","₁₃","₁₄","₁₅","₁₆","₁₇","₁₈","₁₉","₂₀"}
wezterm.on("format-tab-title", function(tab, tabs, panes, config, hover, max_width)
local edge_background = "#121212"
local background = "#4E4E4E"
local foreground = "#1C1B19"
local dim_foreground = "#3A3A3A"
if tab.is_active then
background = "#FBB829"
foreground = "#1C1B19"
elseif hover then
background = "#FF8700"
foreground = "#1C1B19"
end
local edge_foreground = background
local process_name = tab.active_pane.foreground_process_name
local pane_title = tab.active_pane.title
local exec_name = basename(process_name):gsub("%.exe$", "")
local title_with_icon
if exec_name == "nu" then
title_with_icon = NU_ICON .. " NuShell"
elseif exec_name == "pwsh" then
title_with_icon = PS_ICON .. " PS"
elseif exec_name == "cmd" then
title_with_icon = CMD_ICON .. " CMD"
elseif exec_name == "elvish" then
title_with_icon = ELV_ICON .. " Elvish"
elseif exec_name == "wsl" or exec_name == "wslhost" then
title_with_icon = WSL_ICON .. " WSL"
elseif exec_name == "nyagos" then
title_with_icon = NYA_ICON .. " " .. pane_title:gsub(".*: (.+) %- .+", "%1")
elseif exec_name == "yori" then
title_with_icon = YORI_ICON .. " " .. pane_title:gsub(" %- Yori", "")
elseif exec_name == "nvim" then
title_with_icon = VIM_ICON .. pane_title:gsub("^(%S+)%s+(%d+/%d+) %- nvim", " %2 %1")
elseif exec_name == "bat" or exec_name == "less" or exec_name == "moar" then
title_with_icon = PAGER_ICON .. " " .. exec_name:upper()
elseif exec_name == "fzf" or exec_name == "hs" or exec_name == "peco" then
title_with_icon = FUZZY_ICON .. " " .. exec_name:upper()
elseif exec_name == "btm" or exec_name == "ntop" then
title_with_icon = SUNGLASS_ICON .. " " .. exec_name:upper()
elseif exec_name == "python" or exec_name == "hiss" then
title_with_icon = PYTHON_ICON .. " " .. exec_name
elseif exec_name == "node" then
title_with_icon = NODE_ICON .. " " .. exec_name:upper()
elseif exec_name == "deno" then
title_with_icon = DENO_ICON .. " " .. exec_name:upper()
elseif exec_name == "bb" or exec_name == "cmd-clj" or exec_name == "janet" or exec_name == "hy" then
title_with_icon = LAMBDA_ICON .. " " .. exec_name:gsub("bb", "Babashka"):gsub("cmd%-clj", "Clojure")
else
title_with_icon = HOURGLASS_ICON .. " " .. exec_name
end
if pane_title:match("^Administrator: ") then
title_with_icon = title_with_icon .. " " .. ADMIN_ICON
end
local left_arrow = SOLID_LEFT_ARROW
if tab.tab_index == 0 then
left_arrow = SOLID_LEFT_MOST
end
local id = SUB_IDX[tab.tab_index+1]
local pid = SUP_IDX[tab.active_pane.pane_index+1]
local title = " " .. wezterm.truncate_right(title_with_icon, max_width-6) .. " "
return {
{Attribute={Intensity="Bold"}},
{Background={Color=edge_background}},
{Foreground={Color=edge_foreground}},
{Text=left_arrow},
{Background={Color=background}},
{Foreground={Color=foreground}},
{Text=id},
{Text=title},
{Foreground={Color=dim_foreground}},
{Text=pid},
{Background={Color=edge_background}},
{Foreground={Color=edge_foreground}},
{Text=SOLID_RIGHT_ARROW},
{Attribute={Intensity="Normal"}},
}
end)
return {
color_scheme = "srcery",
font_dirs = {"fonts"},
font_size = 11.0,
dpi = 96.0,
freetype_load_target = "Normal",
font = wezterm.font_with_fallback({
"Iosevka Mayukai Codepro",
"Sarasa Mono Slab CL"
}),
tab_max_width = 60,
enable_scroll_bar = true,
use_fancy_tab_bar = false,
window_background_opacity = 0.94,
default_prog = {"nu.exe"},
set_environment_variables = {
LANG = "en_US.UTF-8",
PATH = wezterm.executable_dir .. ";" .. os.getenv("PATH"),
},
colors = {
tab_bar = {
background = "#121212",
new_tab = {bg_color = "#121212", fg_color = "#FCE8C3", intensity = "Bold"},
new_tab_hover = {bg_color = "#121212", fg_color = "#FBB829", intensity = "Bold"},
active_tab = {bg_color = "#121212", fg_color = "#FCE8C3"},
}
},
window_background_gradient = {
orientation = "Vertical",
interpolation = "Linear",
blend = "Rgb",
colors = {
"#121212",
"#202020"
}
},
visual_bell = {
fade_in_duration_ms = 75,
fade_out_duration_ms = 75,
target = "CursorColor",
},
launch_menu = {
{
label = "Bottom",
args = {"btm.exe"},
},
{
label = "ntop",
args = {"ntop.exe"},
},
{
label = "Cmder",
args = {"cmd.exe", "/k", "D:/Scoop/apps/cmder/current/vendor/init.bat", "/f", "/nix_tools", "0"},
},
{
label = "Pwsh",
args = {"pwsh.exe", "-nol", "-noe"},
},
{
label = "NyaGOS",
args = {"nyagos.exe", "--glob"},
},
{
label = "NuShell",
args = {"nu.exe"},
},
{
label = "Elvish",
args = {"elvish.exe"},
},
{
label = "Yori",
args = {"yori.exe"},
},
{
label = "VS",
args = {"cmd.exe", "/k", "D:/Scoop/apps/cmder/current/vendor/init.bat", "/f", "/nix_tools", "0", "/VS"},
},
{
label = "PSVS",
args = {"pwsh.exe", "-noe", "-c", "&{Import-Module \"D:\\dev_env\\vs\\Common7\\Tools\\Microsoft.VisualStudio.DevShell.dll\"; Enter-VsDevShell 1c952f20}"},
}
},
disable_default_key_bindings = true,
leader = { key="`"},
keys = {
{key="Tab", mods="CTRL", action=wezterm.action{ActivateTabRelative=1}},
{key="Tab", mods="CTRL|SHIFT", action=wezterm.action{ActivateTabRelative=-1}},
{key="Enter", mods="ALT", action="ToggleFullScreen"},
{key="Insert", mods="SHIFT", action=wezterm.action{PasteFrom="PrimarySelection"}},
{key="Insert", mods="CTRL", action=wezterm.action{CopyTo="PrimarySelection"}},
{key="v", mods="LEADER", action=wezterm.action{SplitHorizontal={domain="CurrentPaneDomain"}}},
{key="s", mods="LEADER", action=wezterm.action{SplitVertical={domain="CurrentPaneDomain"}}},
{key="h", mods="LEADER", action=wezterm.action{ActivatePaneDirection="Left"}},
{key="l", mods="LEADER", action=wezterm.action{ActivatePaneDirection="Right"}},
{key="j", mods="LEADER", action=wezterm.action{ActivatePaneDirection="Down"}},
{key="k", mods="LEADER", action=wezterm.action{ActivatePaneDirection="Up"}},
{key="z", mods="LEADER", action="TogglePaneZoomState"},
{key="/", mods="LEADER", action=wezterm.action{Search={CaseInSensitiveString=""}}},
{key="q", mods="LEADER", action="QuickSelect"},
{key="1", mods="LEADER", action=wezterm.action{ActivateTab=0}},
{key="2", mods="LEADER", action=wezterm.action{ActivateTab=1}},
{key="3", mods="LEADER", action=wezterm.action{ActivateTab=2}},
{key="4", mods="LEADER", action=wezterm.action{ActivateTab=3}},
{key="5", mods="LEADER", action=wezterm.action{ActivateTab=4}},
{key="6", mods="LEADER", action=wezterm.action{ActivateTab=5}},
{key="7", mods="LEADER", action=wezterm.action{ActivateTab=6}},
{key="8", mods="LEADER", action=wezterm.action{ActivateTab=7}},
{key="9", mods="LEADER", action=wezterm.action{ActivateTab=8}},
{key="o", mods="LEADER", action="ActivateLastTab"},
{key="g", mods="LEADER", action="ShowTabNavigator"},
{key="c", mods="LEADER", action="ShowLauncher"},
{key="r", mods="LEADER", action="ReloadConfiguration"},
{key="x", mods="LEADER", action=wezterm.action{CloseCurrentPane={confirm=true}}},
{key="x", mods="LEADER|SHIFT", action=wezterm.action{CloseCurrentTab={confirm=true}}},
{key="`", mods="LEADER", action=wezterm.action{SendString="`"}},
}
} |
Beta Was this translation helpful? Give feedback.
-
If you are fan of these plugins, you might want to check https://github.com/aca/wezterm.nvim
|
Beta Was this translation helpful? Give feedback.
-
I made an airline-like tab bar. Yet-to-do:
Very happy to read feedback and improvements wezterm.lualocal wezterm = require 'wezterm'
local function font_with_fallback(name, params)
local names = { name, "Noto Color Emoji", "FiraCode Nerd Font" }
return wezterm.font_with_fallback(names, params)
end
-- local SOLID_LEFT_ARROW = utf8.char(0xe0b2)
local SOLID_RIGHT_ARROW = utf8.char(0xe0b0)
local Grey = "#0f1419"
local LightGrey = "#191f26"
local TAB_BAR_BG = "Black"
local ACTIVE_TAB_BG = "Yellow"
local ACTIVE_TAB_FG = "Black"
local HOVER_TAB_BG = Grey
local HOVER_TAB_FG = "White"
local NORMAL_TAB_BG = LightGrey
local NORMAL_TAB_FG = "White"
wezterm.on('format-tab-title', function(tab, tabs, panes, config, hover, max_width)
panes = panes
config = config
max_width = max_width
local background = NORMAL_TAB_BG
local foreground = NORMAL_TAB_FG
local is_first = tab.tab_id == tabs[1].tab_id
local is_last = tab.tab_id == tabs[#tabs].tab_id
if tab.is_active then
background = ACTIVE_TAB_BG
foreground = ACTIVE_TAB_FG
elseif hover then
background = HOVER_TAB_BG
foreground = HOVER_TAB_FG
end
local leading_fg = NORMAL_TAB_FG
local leading_bg = background
local trailing_fg = background
local trailing_bg = NORMAL_TAB_BG
if is_first then
leading_fg = TAB_BAR_BG
else
leading_fg = NORMAL_TAB_BG
end
if is_last then
trailing_bg = TAB_BAR_BG
else
trailing_bg = NORMAL_TAB_BG
end
local title = tab.active_pane.title
-- broken?
-- local title = " " .. wezterm.truncate_to_width(tab.active_pane.title, 30) .. " "
return {
{Attribute={Italic=false}},
{Attribute={Intensity=hover and "Bold" or "Normal"}},
{Background={Color=leading_bg}}, {Foreground={Color=leading_fg}},
{Text=SOLID_RIGHT_ARROW},
{Background={Color=background}}, {Foreground={Color=foreground}},
{Text=" "..title.." "},
{Background={Color=trailing_bg}}, {Foreground={Color=trailing_fg}},
{Text=SOLID_RIGHT_ARROW},
}
end)
return {
window_decorations = "RESIZE",
native_macos_fullscreen_mode = true,
hide_tab_bar_if_only_one_tab = true,
tab_bar_at_bottom = true,
use_fancy_tab_bar = false,
enable_tab_bar = true,
tab_max_width = 32,
leader = { key="b", mods="CTRL", timeout_milliseconds=1000 },
inactive_pane_hsb = {
saturation = 0.5,
brightness = 0.5,
},
color_scheme = "duskfox",
colors = {
tab_bar = {
background = TAB_BAR_BG,
},
},
tab_bar_style = {
new_tab = wezterm.format{
{Background={Color=HOVER_TAB_BG}}, {Foreground={Color=TAB_BAR_BG}}, {Text=SOLID_RIGHT_ARROW}, {Background={Color=HOVER_TAB_BG}}, {Foreground={Color=HOVER_TAB_FG}},
{Text=" + "},
{Background={Color=TAB_BAR_BG}}, {Foreground={Color=HOVER_TAB_BG}}, {Text=SOLID_RIGHT_ARROW},
},
new_tab_hover = wezterm.format{
{Attribute={Italic=false}},
{Attribute={Intensity="Bold"}},
{Background={Color=NORMAL_TAB_BG}}, {Foreground={Color=TAB_BAR_BG}}, {Text=SOLID_RIGHT_ARROW}, {Background={Color=NORMAL_TAB_BG}}, {Foreground={Color=NORMAL_TAB_FG}},
{Text=" + "},
{Background={Color=TAB_BAR_BG}}, {Foreground={Color=NORMAL_TAB_BG}}, {Text=SOLID_RIGHT_ARROW},
},
},
keys = {
{ key="-", mods="SUPER", action=wezterm.action{ SplitVertical={ domain="CurrentPaneDomain" } } },
{ key="\\", mods="SUPER", action=wezterm.action{ SplitHorizontal={ domain="CurrentPaneDomain" } } },
{ key="h", mods="SUPER", action=wezterm.action{ ActivatePaneDirection="Left" } },
{ key="l", mods="SUPER", action=wezterm.action{ ActivatePaneDirection="Right" } },
{ key="j", mods="SUPER", action=wezterm.action{ ActivatePaneDirection="Down" } },
{ key="k", mods="SUPER", action=wezterm.action{ ActivatePaneDirection="Up" } },
{ key="w", mods="SUPER", action=wezterm.action{ CloseCurrentPane={confirm=true} } },
},
font = font_with_fallback("FiraCode Nerd Font"),
font_rules = {
{ -- BOLD
intensity = "Bold",
weight = "Bold",
font = font_with_fallback("FiraCode Nerd Font", { weight = "Bold" }),
},
{ -- ITALIC
italic = true,
weight = "Light",
font = font_with_fallback("Operator Mono SSm Lig", { italic = true }),
},
{ -- BOLD ITALIC
italic = true,
intensity = "Bold",
weight = "Book",
font = font_with_fallback("Operator Mono SSm Lig", { weight = "Bold", italic = true }),
},
{ -- LIGHT
intensity = "Half",
weight = "Light",
font = font_with_fallback("Operator Mono SSm Lig"),
},
},
}
|
Beta Was this translation helpful? Give feedback.
-
Code is here.: https://github.com/jtsagata/Autodot/blob/master/configs/wterm/get_weather |
Beta Was this translation helpful? Give feedback.
-
Somewhat complete with background image cycler config: https://github.com/KevinSilvester/wezterm-config |
Beta Was this translation helpful? Give feedback.
-
config: https://github.com/yutkat/dotfiles/tree/main/.config/wezterm |
Beta Was this translation helpful? Give feedback.
-
I've refactored and updated my config to improve the dynamic rendering of the status-bar. I've added a mode indicator and made the config more colorful. features:
for more info take a look a the repo readme :). https://www.github.com/sravioli/wezterm old postThis is my config. It's based on the colors of kanagawa.nvim. I ported the three palettes but i basically only use I use I also "dynamically resolve" the left status-bar rendering. |
Beta Was this translation helpful? Give feedback.
-
Font: Here is my config: |
Beta Was this translation helpful? Give feedback.
-
Figured I'd share a couple useful keybindings. My config in full: Click me for config:-- https://luals.github.io/wiki/diagnostics/
---@diagnostic disable: redefined-local
---@diagnostic disable: unused-local
-- https://hackernoon.com/get-the-most-out-of-your-terminal-a-comprehensive-guide-to-wezterm-configuration
-- https://gilbertsanchez.com/posts/my-terminal-wezterm/
-- https://github.com/wez/wezterm/discussions/628
local wezterm = require 'wezterm'
local act = wezterm.action
local is_dark = wezterm.gui.get_appearance():find("Dark")
local is_linux = wezterm.target_triple:find("linux") ~= nil
local is_darwin = wezterm.target_triple:find("darwin") ~= nil
local scrollback_lines = 5000 -- default is 3500
local config = {}
if wezterm.config_builder then
config = wezterm.config_builder()
end
config.scrollback_lines = scrollback_lines
config.enable_kitty_keyboard = true
config.use_resize_increments = true
config.enable_scroll_bar = true
-- disable ligatures
config.harfbuzz_features = {
'calt=0',
'clig=0',
'liga=0',
}
-- blinking cursor
-- config.default_cursor_style = 'BlinkingBlock'
-- config.cursor_blink_ease_in = 'Constant'
-- config.cursor_blink_ease_out = 'Constant'
-- config.cursor_blink_rate = 600
config.adjust_window_size_when_changing_font_size = false
config.color_scheme = 'Tango (terminal.sexy)'
-- make the scrollbar thumb more visible
-- config.color_schemes = wezterm.get_builtin_color_schemes()
local color_schemes = wezterm.get_builtin_color_schemes()
local color_scheme = color_schemes[config.color_scheme]
config.color_schemes = {
[config.color_scheme] = color_scheme
}
color_scheme.scrollbar_thumb = "555555"
config.bold_brightens_ansi_colors = true
config.font_size = 16
config.font = wezterm.font_with_fallback {
'JetBrains Mono',
-- 'Iosevka Term',
-- 'Comic Shanns Mono',
-- 'Comic Code',
}
config.inactive_pane_hsb = {
-- default: 0.9
saturation = 1,
-- default: 0.8
brightness = 0.5,
}
local function edit_in_new_tab(window, pane, text)
if not text then
return nil
end
local path = os.tmpname()
local f = io.open(path, "w+")
if not f then
wezterm.log_error("could not open temp file for writing")
return
end
f:write(text)
f:flush()
f:close()
local args = {
"zsh",
"-ic",
"vi \"$0\"; " ..
"wezterm cli activate-pane --pane-id \"$1\"",
path,
tostring(pane:pane_id())
}
window:perform_action(act.SpawnCommandInNewTab { args = args }, pane)
wezterm.sleep_ms(1000)
os.remove(path)
end
local function get_last_output(pane)
local cursor = pane:get_cursor_position()
-- skip up 2 rows to skip shell prompt
local zone = pane:get_semantic_zone_at(0, cursor.y-2)
if zone then
return pane:get_text_from_semantic_zone(zone)
end
return nil
end
wezterm.on('format-window-title', function(tab, pane, tabs, panes, config)
local zoomed = ''
if tab.active_pane.is_zoomed then
zoomed = '[Z] '
end
local index = ''
if #tabs > 1 then
index = string.format('[%d/%d] ', tab.tab_index + 1, #tabs)
end
return zoomed .. index .. tab.active_pane.title
end)
wezterm.on('update-right-status', function(window, pane)
local name = window:active_key_table()
if name then
name = 'TABLE: ' .. name
end
window:set_right_status(name or '')
end)
wezterm.on(
"trigger-nvim-with-visible-text",
function(window, pane)
local scrollback = pane:get_lines_as_text()
edit_in_new_tab(window, pane, scrollback)
end
)
wezterm.on(
"trigger-nvim-with-scrollback",
function(window, pane)
local scrollback = pane:get_lines_as_text(scrollback_lines)
edit_in_new_tab(window, pane, scrollback)
end
)
wezterm.on(
"trigger-nvim-with-selection",
function(window, pane)
local selection = window:get_selection_text_for_pane(pane)
edit_in_new_tab(window, pane, selection)
end
)
wezterm.on(
"trigger-nvim-with-semantic-region",
function(window, pane)
local selection = get_last_output(pane)
edit_in_new_tab(window, pane, selection)
end
)
wezterm.on(
"trigger-show-keys",
function(window, pane)
local args = {
"zsh",
"-ic",
"TMPSUFFIX=.lua; " ..
"vi =(wezterm show-keys --lua); " ..
"wezterm cli activate-pane --pane-id \"$0\"",
tostring(pane:pane_id())
}
window:perform_action(act.SpawnCommandInNewTab { args = args }, pane)
end
)
wezterm.on(
"trigger-show-keys-diff",
function(window, pane)
local args = {
"zsh",
"-ic",
"TMPSUFFIX=.lua; " ..
"git diff -U1000 --no-index =(wezterm -n show-keys --lua) =(wezterm show-keys --lua); " ..
"wezterm cli activate-pane --pane-id \"$0\"",
tostring(pane:pane_id())
}
window:perform_action(act.SpawnCommandInNewTab { args = args }, pane)
end
)
config.leader = { key = ',', mods = 'SUPER' }
config.keys = {
{ key = 'UpArrow', mods = 'SHIFT', action = act.ScrollToPrompt(-1) },
{ key = 'DownArrow', mods = 'SHIFT', action = act.ScrollToPrompt(1) },
{ key = 'v', mods = 'SUPER', action = act.PasteFrom('Clipboard') },
{ key = 'p', mods = 'SUPER', action = act.ActivateKeyTable { name = 'edit_text', one_shot = true, }, },
{ key = 'r', mods = 'LEADER', action = act.ActivateKeyTable { name = 'resize_pane', one_shot = false, }, },
{ key = 'a', mods = 'LEADER', action = act.ActivateKeyTable { name = 'activate_pane', timeout_milliseconds = 1000, }, },
{ key = 'k', mods = 'LEADER', action = act.EmitEvent "trigger-show-keys" },
{ key = 'd', mods = 'LEADER', action = act.EmitEvent "trigger-show-keys-diff" },
}
config.mouse_bindings = {
{event = {Down = {streak = 4, button = "Left"}}, mods = "NONE", action = {SelectTextAtMouseCursor = "SemanticZone"}}
}
config.key_tables = {
resize_pane = {
{ key = 'LeftArrow', action = act.AdjustPaneSize { 'Left', 1 } },
{ key = 'h', action = act.AdjustPaneSize { 'Left', 1 } },
{ key = 'RightArrow', action = act.AdjustPaneSize { 'Right', 1 } },
{ key = 'l', action = act.AdjustPaneSize { 'Right', 1 } },
{ key = 'UpArrow', action = act.AdjustPaneSize { 'Up', 1 } },
{ key = 'k', action = act.AdjustPaneSize { 'Up', 1 } },
{ key = 'DownArrow', action = act.AdjustPaneSize { 'Down', 1 } },
{ key = 'j', action = act.AdjustPaneSize { 'Down', 1 } },
{ key = 'Escape', action = 'PopKeyTable' },
},
activate_pane = {
{ key = 'LeftArrow', action = act.ActivatePaneDirection 'Left' },
{ key = 'h', action = act.ActivatePaneDirection 'Left' },
{ key = 'RightArrow', action = act.ActivatePaneDirection 'Right' },
{ key = 'l', action = act.ActivatePaneDirection 'Right' },
{ key = 'UpArrow', action = act.ActivatePaneDirection 'Up' },
{ key = 'k', action = act.ActivatePaneDirection 'Up' },
{ key = 'DownArrow', action = act.ActivatePaneDirection 'Down' },
{ key = 'j', action = act.ActivatePaneDirection 'Down' },
},
edit_text = {
{ key = "o", action = act.EmitEvent "trigger-nvim-with-semantic-region" },
{ key = "s", action = act.EmitEvent "trigger-nvim-with-selection" },
{ key = "a", action = act.EmitEvent "trigger-nvim-with-scrollback" },
{ key = "v", action = act.EmitEvent "trigger-nvim-with-visible-text" },
},
copy_mode = {
-- { key = 'UpArrow', mods = 'SHIFT', action = act.CopyMode('MoveBackwardSemanticZone') },
-- { key = 'DownArrow', mods = 'SHIFT', action = act.CopyMode('MoveForwardSemanticZone') },
{ key = 'UpArrow', mods = 'SHIFT', action = act.CopyMode{ MoveBackwardZoneOfType = 'Input' } },
{ key = 'K', mods = 'SHIFT', action = act.CopyMode{ MoveBackwardZoneOfType = 'Input' } },
{ key = 'DownArrow', mods = 'SHIFT', action = act.CopyMode{ MoveForwardZoneOfType = 'Input' } },
{ key = 'J', mods = 'SHIFT', action = act.CopyMode{ MoveForwardZoneOfType = 'Input' } },
-- defaults:
{ key = 'Tab', mods = 'NONE', action = act.CopyMode 'MoveForwardWord' },
{ key = 'Tab', mods = 'SHIFT', action = act.CopyMode 'MoveBackwardWord' },
{ key = 'Enter', mods = 'NONE', action = act.CopyMode 'MoveToStartOfNextLine' },
{ key = 'Escape', mods = 'NONE', action = act.CopyMode 'Close' },
{ key = 'Space', mods = 'NONE', action = act.CopyMode{ SetSelectionMode = 'Cell' } },
{ key = '$', mods = 'NONE', action = act.CopyMode 'MoveToEndOfLineContent' },
{ key = '$', mods = 'SHIFT', action = act.CopyMode 'MoveToEndOfLineContent' },
{ key = ',', mods = 'NONE', action = act.CopyMode 'JumpReverse' },
{ key = '0', mods = 'NONE', action = act.CopyMode 'MoveToStartOfLine' },
{ key = ';', mods = 'NONE', action = act.CopyMode 'JumpAgain' },
{ key = 'F', mods = 'NONE', action = act.CopyMode{ JumpBackward = { prev_char = false } } },
{ key = 'F', mods = 'SHIFT', action = act.CopyMode{ JumpBackward = { prev_char = false } } },
{ key = 'G', mods = 'NONE', action = act.CopyMode 'MoveToScrollbackBottom' },
{ key = 'G', mods = 'SHIFT', action = act.CopyMode 'MoveToScrollbackBottom' },
{ key = 'H', mods = 'NONE', action = act.CopyMode 'MoveToViewportTop' },
{ key = 'H', mods = 'SHIFT', action = act.CopyMode 'MoveToViewportTop' },
{ key = 'L', mods = 'NONE', action = act.CopyMode 'MoveToViewportBottom' },
{ key = 'L', mods = 'SHIFT', action = act.CopyMode 'MoveToViewportBottom' },
{ key = 'M', mods = 'NONE', action = act.CopyMode 'MoveToViewportMiddle' },
{ key = 'M', mods = 'SHIFT', action = act.CopyMode 'MoveToViewportMiddle' },
{ key = 'O', mods = 'NONE', action = act.CopyMode 'MoveToSelectionOtherEndHoriz' },
{ key = 'O', mods = 'SHIFT', action = act.CopyMode 'MoveToSelectionOtherEndHoriz' },
{ key = 'T', mods = 'NONE', action = act.CopyMode{ JumpBackward = { prev_char = true } } },
{ key = 'T', mods = 'SHIFT', action = act.CopyMode{ JumpBackward = { prev_char = true } } },
{ key = 'V', mods = 'NONE', action = act.CopyMode{ SetSelectionMode = 'Line' } },
{ key = 'V', mods = 'SHIFT', action = act.CopyMode{ SetSelectionMode = 'Line' } },
{ key = '^', mods = 'NONE', action = act.CopyMode 'MoveToStartOfLineContent' },
{ key = '^', mods = 'SHIFT', action = act.CopyMode 'MoveToStartOfLineContent' },
{ key = 'b', mods = 'NONE', action = act.CopyMode 'MoveBackwardWord' },
{ key = 'b', mods = 'ALT', action = act.CopyMode 'MoveBackwardWord' },
{ key = 'b', mods = 'CTRL', action = act.CopyMode 'PageUp' },
{ key = 'c', mods = 'CTRL', action = act.CopyMode 'Close' },
{ key = 'd', mods = 'CTRL', action = act.CopyMode{ MoveByPage = (0.5) } },
{ key = 'e', mods = 'NONE', action = act.CopyMode 'MoveForwardWordEnd' },
{ key = 'f', mods = 'NONE', action = act.CopyMode{ JumpForward = { prev_char = false } } },
{ key = 'f', mods = 'ALT', action = act.CopyMode 'MoveForwardWord' },
{ key = 'f', mods = 'CTRL', action = act.CopyMode 'PageDown' },
{ key = 'g', mods = 'NONE', action = act.CopyMode 'MoveToScrollbackTop' },
{ key = 'g', mods = 'CTRL', action = act.CopyMode 'Close' },
{ key = 'h', mods = 'NONE', action = act.CopyMode 'MoveLeft' },
{ key = 'j', mods = 'NONE', action = act.CopyMode 'MoveDown' },
{ key = 'k', mods = 'NONE', action = act.CopyMode 'MoveUp' },
{ key = 'l', mods = 'NONE', action = act.CopyMode 'MoveRight' },
{ key = 'm', mods = 'ALT', action = act.CopyMode 'MoveToStartOfLineContent' },
{ key = 'o', mods = 'NONE', action = act.CopyMode 'MoveToSelectionOtherEnd' },
{ key = 'q', mods = 'NONE', action = act.CopyMode 'Close' },
{ key = 't', mods = 'NONE', action = act.CopyMode{ JumpForward = { prev_char = true } } },
{ key = 'u', mods = 'CTRL', action = act.CopyMode{ MoveByPage = (-0.5) } },
{ key = 'v', mods = 'NONE', action = act.CopyMode{ SetSelectionMode = 'Cell' } },
{ key = 'v', mods = 'CTRL', action = act.CopyMode{ SetSelectionMode = 'Block' } },
{ key = 'w', mods = 'NONE', action = act.CopyMode 'MoveForwardWord' },
{ key = 'y', mods = 'NONE', action = act.Multiple{ { CopyTo = 'ClipboardAndPrimarySelection' }, { CopyMode = 'Close' } } },
{ key = 'PageUp', mods = 'NONE', action = act.CopyMode 'PageUp' },
{ key = 'PageDown', mods = 'NONE', action = act.CopyMode 'PageDown' },
{ key = 'End', mods = 'NONE', action = act.CopyMode 'MoveToEndOfLineContent' },
{ key = 'Home', mods = 'NONE', action = act.CopyMode 'MoveToStartOfLine' },
{ key = 'LeftArrow', mods = 'NONE', action = act.CopyMode 'MoveLeft' },
{ key = 'LeftArrow', mods = 'ALT', action = act.CopyMode 'MoveBackwardWord' },
{ key = 'RightArrow', mods = 'NONE', action = act.CopyMode 'MoveRight' },
{ key = 'RightArrow', mods = 'ALT', action = act.CopyMode 'MoveForwardWord' },
{ key = 'UpArrow', mods = 'NONE', action = act.CopyMode 'MoveUp' },
{ key = 'DownArrow', mods = 'NONE', action = act.CopyMode 'MoveDown' },
},
}
-- more visible tabs
config.window_frame = {
font = wezterm.font { family = 'Roboto', weight = 'Bold' },
font_size = 14.0,
}
return config The following two events are kinda neat:
The The I also have some keybindings for quickly opening various bits of the scrollback (previous semantic region, the currently visible text, etc) so I can quickly copy, edit, and paste (for things like issue reports, notes, cobbling together multiple args for another command line, etc). Along those lines, it would be kinda cool if there was a means in wezterm for passing Thanks @wez for all your work on WezTerm and supporting packages! |
Beta Was this translation helpful? Give feedback.
-
I've created a tab-bar plugin that should work with all color schemes. A bit unorthodox way to display tabs, but I like it. The plugin can be found here |
Beta Was this translation helpful? Give feedback.
-
Some what finalized my setup, config here |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
And my dotfiles containing wezterm.lua. |
Beta Was this translation helpful? Give feedback.
-
I don't see anyone show git on status bar so I did it myself. I'm used to have git status on statusbar in tmux. |
Beta Was this translation helpful? Give feedback.
-
Can anyone help me out with a config to make my wz look like this |
Beta Was this translation helpful? Give feedback.
-
Here's my use-case:
(Note: everything is very much alpha) ~/.config/westerm/westerm.luathe main config with some modular structure. local wezterm = require 'wezterm'
local config = wezterm.config_builder()
config.automatically_reload_config = true
require('appearence').apply(config)
require('colors-wezterm').apply(config)
return config ~/.config/westerm/appearence.lua
local wezterm = require 'wezterm'
local colors = require('colors-wezterm')
local module = {}
function module.apply(config)
config.dpi = 120
config.font_size = 9.0
-- config.font = wezterm.font 'FiraCode Nerd Font Propo'
config.font = wezterm.font_with_fallback {
'FiraCode Nerd Font Propo',
'Fira Code',
'Fira Code',
'Droid Sans Mono',
'monospace',
}
config.window_background_opacity = 0.8
config.text_background_opacity = 0.5
-- Tab configs
config.use_fancy_tab_bar = true
config.hide_tab_bar_if_only_one_tab = true
config.window_frame = {
font_size = 9.0,
active_titlebar_bg = colors.color_titlebar.active_bg,
inactive_titlebar_bg = colors.color_titlebar.inactive_bg,
}
-- config.window_background_image = colors.window_background
end
return module quake module
|
Beta Was this translation helpful? Give feedback.
-
wezterm.lualocal wezterm = require("wezterm")
local action = wezterm.action
local nerdfonts = wezterm.nerdfonts
local mux = wezterm.mux
local F = require("functions")
local colors = {}
local config = {}
local custom = {}
local projects = {}
-- Custom
custom = {
color_scheme = {
dark = "Catppuccin Frappe",
light = "Catppuccin Mocha",
},
hostname = {
current = string.lower(wezterm.hostname()),
work = "pc-xxxxxx",
},
timeout = {
key = 3000,
leader = 1000
},
username = os.getenv("USER") or os.getenv("LOGNAME") or os.getenv("USERNAME"),
}
projects = {
default_workspace = "default",
repositories = {
{ type = "personal", workspace = "default", name = "home", path = os.getenv("HOME") },
{ type = "personal", workspace = "dotfiles", name = "project", path = os.getenv("HOME") .. "/Repositories/personal/gitlab.com/user/dotfiles" },
{ type = "work", workspace = "project1", name = "template", path = os.getenv("HOME") .. "/Repositories/work/github.com/user/project1" },
{ type = "work", workspace = "project2", name = "tab1", path = os.getenv("HOME") .. "/Repositories/work/gitlab.com/group", tabs = { 'tab1', 'tab2' } },
}
}
-- Path
config.set_environment_variables = {
PATH = wezterm.home_dir .. ":" .. os.getenv("PATH") .. ":" .. os.getenv("HOME") .. "/.nix-profile/bin"
}
-- Lauching
config.default_prog = { "zsh" }
config.automatically_reload_config = true
-- Colorscheme
config.color_scheme = F.scheme_for_appearance(
wezterm.gui.get_appearance(),
custom.color_scheme.dark,
custom.color_scheme.light
)
colors = wezterm.get_builtin_color_schemes()[config.color_scheme]
config.colors = {
compose_cursor = colors.ansi[2],
cursor_bg = colors.indexed[16],
split = colors.indexed[16],
tab_bar = { background = colors.background }
}
-- Cursor
config.xcursor_theme = "Adwaita"
-- Pane
config.inactive_pane_hsb = {
saturation = 0.6,
brightness = 0.6
}
-- IME
config.use_ime = false
-- Keys Mapping
config.disable_default_key_bindings = true
config.leader = { key = "f", mods = "CTRL", timeout_milliseconds = custom.timeout.leader }
config.keys = {
{ key = "o", mods = "LEADER",
action = action.ActivateKeyTable {
name = "open",
one_shot = false,
until_unknown = true,
timeout_milliseconds = custom.timeout.key
}
},
{ key = "m", mods = "LEADER",
action = action.ActivateKeyTable {
name = "move",
one_shot = false,
until_unknown = false,
timeout_milliseconds = custom.timeout.key
}
},
{ key = "r", mods = "LEADER",
action = action.ActivateKeyTable {
name = "resize",
one_shot = false,
until_unknown = true,
timeout_milliseconds = custom.timeout.key
}
},
{ key = "c", mods = "LEADER", action = action.ShowLauncherArgs { flags = "FUZZY|LAUNCH_MENU_ITEMS" } },
{ key = "h", mods = "LEADER", action = action.ActivateCommandPalette },
{ key = "l", mods = "LEADER", action = action.Multiple {
wezterm.action_callback(function(window,pane)
F.switch_previous_workspace(window,pane)
end),
action.EmitEvent 'set-previous-workspace'
}
},
{ key = "p", mods = "LEADER", action = action.PasteFrom("Clipboard") },
{ key = "q", mods = "LEADER", action = action.QuitApplication },
{ key = "s", mods = "LEADER", action = action.Multiple {
action.ShowLauncherArgs { flags = "FUZZY|WORKSPACES" },
action.EmitEvent 'set-previous-workspace'
}
},
{ key = "t", mods = "CTRL", action = action.SpawnTab("DefaultDomain") },
{ key = "v", mods = "LEADER", action = action.ActivateCopyMode },
{ key = "w", mods = "LEADER", action = action.ShowLauncherArgs { flags = "TABS" } },
{ key = "y", mods = "LEADER", action = action.Multiple {
action.CopyTo("ClipboardAndPrimarySelection"),
action.ClearSelection
}
},
{ key = "z", mods = "LEADER", action = action.TogglePaneZoomState, },
{ key = "DownArrow", mods = "ALT", action = action.ActivatePaneDirection("Down") },
{ key = "DownArrow", mods = "SHIFT", action = action.ScrollByLine(1) },
{ key = "End", mods = "SHIFT", action = action.ScrollToBottom },
{ key = "Home", mods = "SHIFT", action = action.ScrollToTop },
{ key = "LeftArrow", mods = "ALT", action = action.ActivatePaneDirection("Left") },
{ key = "PageDown", mods = "SHIFT", action = action.ScrollByPage(1) },
{ key = "PageUp", mods = "SHIFT", action = action.ScrollByPage(-1) },
{ key = "RightArrow", mods = "ALT", action = action.ActivatePaneDirection("Right") },
{ key = "UpArrow", mods = "ALT", action = action.ActivatePaneDirection("Up") },
{ key = "UpArrow", mods = "SHIFT", action = action.ScrollByLine(-1) },
{ key = "0", mods = "ALT", action = action.EmitEvent 'toggle-opacity-reset' },
{ key = "0", mods = "CTRL", action = action.ResetFontSize },
{ key = "-", mods = "ALT", action = action.EmitEvent 'toggle-opacity-minus' },
{ key = "-", mods = "CTRL", action = action.DecreaseFontSize },
{ key = "=", mods = "ALT", action = action.EmitEvent 'toggle-opacity-plus' },
{ key = "=", mods = "CTRL", action = action.IncreaseFontSize },
{ key = "[", mods = "ALT", action = action.ActivateTabRelative(-1) },
{ key = "[", mods = "CTRL", action = action.Multiple {
action.SwitchWorkspaceRelative(-1),
action.EmitEvent 'set-previous-workspace'
}
},
{ key = "]", mods = "ALT", action = action.ActivateTabRelative(1) },
{ key = "]", mods = "CTRL", action = action.Multiple {
action.SwitchWorkspaceRelative(1),
action.EmitEvent 'set-previous-workspace'
}
},
{ key = "/", mods = "LEADER", action = action.Search { CaseInSensitiveString = "" } },
{ key = "-", mods = "LEADER", action = action.SplitVertical { domain = "CurrentPaneDomain" } },
{ key = "|", mods = "LEADER|SHIFT", action = action.SplitHorizontal { domain = "CurrentPaneDomain" } },
{ key = ",", mods = "LEADER", action = action.PromptInputLine
{
description = wezterm.format {
{ Attribute = { Intensity = "Bold" }},
{ Foreground = { Color = colors.indexed[16] }},
{ Text = "Renaming tab title:" }},
action = wezterm.action_callback(function(window, _, line)
if line then
window:active_tab():set_title(line)
end
end),
}
},
{ key = "$", mods = "LEADER|SHIFT", action = action.PromptInputLine
{
description = wezterm.format {
{ Attribute = { Intensity = "Bold" }},
{ Foreground = { Color = colors.indexed[16] }},
{ Text = "Renaming session/workspace:" }},
action = wezterm.action_callback(function(_, _, line)
if line then
mux.rename_workspace(mux.get_active_workspace(),line)
end
end),
}
},
}
-- Active tab by index
for i = 1, 9 do
table.insert(config.keys, { key = tostring(i), mods = "ALT", action = action.ActivateTab(i - 1) })
end
config.key_tables = {
move = {
{ key = 'r', action = action.RotatePanes 'CounterClockwise' },
{ key = 's', action = action.PaneSelect },
{ key = 'Enter', action = 'PopKeyTable' },
{ key = 'Escape', action = 'PopKeyTable' },
{ key = 'LeftArrow', mods = 'SHIFT', action = action.MoveTabRelative(-1) },
{ key = 'RightArrow', mods = 'SHIFT', action = action.MoveTabRelative(1) },
},
resize = {
{ key = 'DownArrow', action = action.AdjustPaneSize { 'Down', 1 } },
{ key = 'LeftArrow', action = action.AdjustPaneSize { 'Left', 1 } },
{ key = 'RightArrow', action = action.AdjustPaneSize { 'Right', 1 } },
{ key = 'UpArrow', action = action.AdjustPaneSize { 'Up', 1 } },
{ key = 'Enter', action = 'PopKeyTable' },
{ key = 'Escape', action = 'PopKeyTable' },
},
open = {
{ key = "g", action = action {
QuickSelectArgs = {
label = "execute 'gcloud auth login --remote-bootstrap'",
patterns = { "gcloud auth login --remote-bootstrap=\".*\"" },
scope_lines = 30,
action = action.EmitEvent "trigger-gcloud-auth"
}
},
},
{ key = "p", action = action.SpawnCommandInNewWindow {
label = "open current path on file manager",
args = { "xdg-open", "." },
}
},
{ key = "u", action = action {
QuickSelectArgs = {
label = "open URL on browser",
patterns = { "https?://\\S+" },
scope_lines = 30,
action = wezterm.action_callback(function(window, pane)
local url = window:get_selection_text_for_pane(pane)
wezterm.log_info("opening: " .. url)
wezterm.open_with(url)
end)
}
},
},
}
}
-- Window
config.bold_brightens_ansi_colors = true
config.initial_cols = 200
config.initial_rows = 50
config.text_background_opacity = 0.90
config.window_background_opacity = 0.90
config.window_decorations = "RESIZE"
config.window_padding = {
left = 3,
right = 3,
top = 10,
bottom = 3,
}
-- Graphics
config.front_end = "WebGpu"
config.webgpu_power_preference = "HighPerformance"
-- Cursor
config.bypass_mouse_reporting_modifiers = "SHIFT"
config.cursor_blink_ease_in = "Linear"
config.cursor_blink_rate = 500
config.default_cursor_style = "BlinkingBlock"
config.hide_mouse_cursor_when_typing = false
config.mouse_bindings = {
{ event = { Down = { streak = 1, button = 'Middle' }}, mods = 'NONE', action = action.PasteFrom("Clipboard") },
{ event = { Down = { streak = 1, button = "Left" }}, mods = "NONE", action = action.Multiple { action.ClearSelection }},
{ event = { Up = { streak = 1, button = "Left" }}, mods = "NONE", action = action.Nop },
{ event = { Up = { streak = 2, button = "Left" }}, mods = "NONE", action = action.Multiple { action.CopyTo "ClipboardAndPrimarySelection", action.ClearSelection }},
{ event = { Up = { streak = 3, button = "Left" }}, mods = "NONE", action = action.Multiple { action.CopyTo "ClipboardAndPrimarySelection", action.ClearSelection }},
{ event = { Up = { streak = 1, button = "Left" }}, mods = "CTRL", action = action.OpenLinkAtMouseCursor },
}
-- Font
config.font = wezterm.font("JetBrainsMonoNL Nerd Font")
config.font_size = 10
-- Hyperlink
config.hyperlink_rules = wezterm.default_hyperlink_rules()
-- e-mail fulano-ciclano@example.com fulano_ciclano@example.com
table.insert(config.hyperlink_rules,{
regex = "\\b[A-Z-a-z0-9-_\\.]+@[\\w-]+(\\.[\\w-]+)+\\b",
format = "mailto:$0",
})
-- Scrolling
config.enable_scroll_bar = false
config.scrollback_lines = 10000
config.alternate_buffer_wheel_scroll_speed = 5
-- Tab
config.enable_tab_bar = true
config.hide_tab_bar_if_only_one_tab = false
config.show_new_tab_button_in_tab_bar = false
config.show_tab_index_in_tab_bar = true
config.status_update_interval = 1000
config.tab_bar_at_bottom = false
config.tab_max_width = 64
config.use_fancy_tab_bar = false
-- Launch commands
config.launch_menu = {
{
label = "HTTP 8080 - Open URL http://localhost:8080",
args = { "flatpak", "run", "org.mozilla.firefox", "--private-window", "http://localhost:8080" },
},
{
label = "HTTPS 8080 - Open URL https://localhost:8080",
args = { "flatpak", "run", "org.mozilla.firefox", "--private-window", "https://localhost:8080" },
},
{
label = "HTTPS 8433 - Open URL https://localhost:8433",
args = { "flatpak", "run", "org.mozilla.firefox", "--private-window", "https://localhost:8433" },
}
}
-- Events update status
wezterm.on("update-status", function(window, pane)
-- Workspace name
local stat = window:active_workspace()
local workspace_color = colors.ansi[3]
local time = wezterm.strftime("%Y-%m-%d %H:%M")
if window:active_key_table() then
stat = window:active_key_table()
workspace_color = colors.ansi[4]
elseif window:leader_is_active() then
stat = 'leader'
workspace_color = colors.ansi[2]
end
-- Current working directory
local cwd = pane:get_current_working_dir()
if cwd then
if type(cwd) == "userdata" then
-- Wezterm introduced the URL object in 20240127-113634-bbcac864
if string.len(cwd.path) > 32 then
cwd = ".." .. string.sub(cwd.path, -32, -1)
else
cwd = cwd.path
end
end
else
cwd = ""
end
-- Left status (left of the tab line)
window:set_left_status(wezterm.format({
{ Background = { Color = colors.background } },
{ Text = " " },
{ Background = { Color = colors.background } },
{ Foreground = { Color = workspace_color } },
{ Text = nerdfonts.ple_left_half_circle_thick },
{ Background = { Color = workspace_color } },
{ Foreground = { Color = colors.ansi[1] } },
{ Text = nerdfonts.cod_terminal_tmux .. " " },
{ Background = { Color = colors.ansi[1] } },
{ Foreground = { Color = colors.foreground } },
{ Text = " " .. stat },
{ Background = { Color = colors.background } },
{ Foreground = { Color = colors.ansi[1] } },
{ Text = nerdfonts.ple_right_half_circle_thick .. " " },
}))
-- Right status
window:set_right_status(wezterm.format({
-- Wezterm has a built-in nerd fonts
-- https://wezfurlong.org/wezterm/config/lua/wezterm/nerdfonts.html
--
{ Text = " " },
{ Background = { Color = colors.background } },
{ Foreground = { Color = colors.ansi[5] } },
{ Text = nerdfonts.ple_left_half_circle_thick },
{ Background = { Color = colors.ansi[5] } },
{ Foreground = { Color = colors.background } },
{ Text = nerdfonts.md_folder .. " " },
{ Background = { Color = colors.ansi[1] } },
{ Foreground = { Color = colors.foreground } },
{ Text = " " .. cwd },
{ Background = { Color = colors.background } },
{ Foreground = { Color = colors.ansi[1] } },
{ Text = nerdfonts.ple_right_half_circle_thick },
{ Text = " " },
{ Background = { Color = colors.background } },
{ Foreground = { Color = colors.ansi[6] } },
{ Text = nerdfonts.ple_left_half_circle_thick },
{ Background = { Color = colors.ansi[6] } },
{ Foreground = { Color = colors.background } },
{ Text = nerdfonts.fa_user .. " " },
{ Background = { Color = colors.ansi[1] } },
{ Foreground = { Color = colors.foreground } },
{ Text = " " .. custom.username },
{ Background = { Color = colors.background } },
{ Foreground = { Color = colors.ansi[1] } },
{ Text = nerdfonts.ple_right_half_circle_thick },
{ Text = " " },
{ Background = { Color = colors.background } },
{ Foreground = { Color = colors.ansi[7] } },
{ Text = nerdfonts.ple_left_half_circle_thick },
{ Background = { Color = colors.ansi[7] } },
{ Foreground = { Color = colors.ansi[1] } },
{ Text = nerdfonts.cod_server .. " " },
{ Background = { Color = colors.ansi[1] } },
{ Foreground = { Color = colors.foreground } },
{ Text = " " .. custom.hostname.current },
{ Background = { Color = colors.background } },
{ Foreground = { Color = colors.ansi[1] } },
{ Text = nerdfonts.ple_right_half_circle_thick },
{ Text = " " },
{ Background = { Color = colors.background } },
{ Foreground = { Color = colors.ansi[8]} },
{ Text = nerdfonts.ple_left_half_circle_thick },
{ Background = { Color = colors.ansi[8]} },
{ Foreground = { Color = colors.background } },
{ Text = nerdfonts.md_calendar_clock .. " " },
{ Background = { Color = colors.ansi[1] } },
{ Foreground = { Color = colors.foreground } },
{ Text = " " .. time },
{ Background = { Color = colors.background } },
{ Foreground = { Color = colors.ansi[1] } },
{ Text = nerdfonts.ple_right_half_circle_thick },
}))
end)
-- Events define tab title
wezterm.on("format-tab-title", function(tab)
local pane = tab.active_pane
local title = F.tab_title(tab) .. " "
local tab_number = " " .. tostring(tab.tab_index + 1)
-- Default tab title
local icon = nerdfonts.dev_terminal .. " " .. title
-- Add zoom icon
if pane.is_zoomed then
icon = nerdfonts.cod_zoom_in .. " " .. icon
end
-- Add copy icon
if string.find(pane.title,"^Copy mode:") then
icon = nerdfonts.md_content_copy .. " " .. icon
end
if tab.is_active then
return {
{ Background = { Color = colors.background } },
{ Foreground = { Color = colors.indexed[16]} },
{ Text = icon },
{ Background = { Color = colors.indexed[16]} },
{ Foreground = { Color = colors.background } },
{ Text = tab_number },
{ Background = { Color = colors.background } },
{ Foreground = { Color = colors.indexed[16]} },
{ Text = nerdfonts.ple_right_half_circle_thick .. " " },
}
else
return {
{ Background = { Color = colors.background } },
{ Foreground = { Color = colors.ansi[1] } },
{ Text = nerdfonts.ple_left_half_circle_thick },
{ Background = { Color = colors.ansi[1] } },
{ Foreground = { Color = colors.foreground } },
{ Text = title },
{ Background = { Color = colors.ansi[5] } },
{ Foreground = { Color = colors.background } },
{ Text = tab_number },
{ Background = { Color = colors.background } },
{ Foreground = { Color = colors.ansi[5] } },
{ Text = nerdfonts.ple_right_half_circle_thick .. " " },
}
end
end)
-- Events when wezterm is started
wezterm.on("gui-startup", function()
-- Iterate projects
for _, project in pairs(projects.repositories) do
-- Create personal's projects
if project.type == "personal" then
local _, _, window = mux.spawn_window { workspace = project.workspace, cwd = project.path }
window:active_tab():set_title(project.name)
wezterm.log_info('Creating workspace: ' .. project.workspace )
end
-- Create work's projects
if project.type == "work" and custom.hostname.current == custom.hostname.work then
-- Create workspace and tab
if project.tabs then
local _, _, window = mux.spawn_window { workspace = project.workspace, cwd = project.path .. '/' .. project.tabs[1] }
window:active_tab():set_title(project.name)
wezterm.log_info('Creating workspace: ' .. project.workspace )
for tab = 2, #project.tabs do
window:spawn_tab { cwd = project.path .. '/' .. project.tabs[tab] }
wezterm.log_info('Creating tab ' .. project.tabs[tab] .. ' on workspace ' .. project.workspace )
end
else
-- Create workspace
local _, _, window = mux.spawn_window { workspace = project.workspace, cwd = project.path }
window:active_tab():set_title(project.name)
wezterm.log_info('Creating workspace: ' .. project.workspace )
end
end
end
-- Default workspace
mux.set_active_workspace(projects.default_workspace)
wezterm.log_info('Setting default workspace: ' .. projects.default_workspace )
end)
-- Open a new pane and execute gcloud auth login --remote-bootstrap
wezterm.on('trigger-gcloud-auth', function(window, pane)
-- Get command and url from gcloud
local cmd = window:get_selection_text_for_pane(pane)
-- Append command sleep to have some time to copy content
cmd = cmd .. " " .. "<<< y 2>&1 | grep -E '^https:\\S+' | wl-copy -n"
-- Open new pane and execute command
-- Execute
window:perform_action(
pane:split {
direction = 'Bottom',
label = 'execute gcloud auth --remote-bootstrap',
args = { 'bash', '-c', cmd }
},
pane
)
end)
wezterm.on('toggle-compose', function(window, pane)
local overrides = window:get_config_overrides() or {}
overrides.colors = config.colors
if window:active_key_table() then
overrides.colors.cursor_bg = colors.ansi[4]
else
overrides.colors.cursor_bg = colors.ansi[3]
end
window:set_config_overrides(overrides)
end)
wezterm.on('toggle-opacity-minus', function(window, pane)
local overrides = window:get_config_overrides() or {}
if window:get_config_overrides() then
overrides.text_background_opacity = tonumber(string.format("%.2f",window:get_config_overrides().text_background_opacity))
overrides.window_background_opacity = tonumber(string.format("%.2f",window:get_config_overrides().window_background_opacity))
else
overrides.text_background_opacity = config.text_background_opacity
overrides.window_background_opacity = config.window_background_opacity
end
if overrides.window_background_opacity > 0 and overrides.window_background_opacity <= 1 then
overrides.text_background_opacity = overrides.text_background_opacity - 0.10
overrides.window_background_opacity = overrides.window_background_opacity - 0.10
window:set_config_overrides(overrides)
end
end)
wezterm.on('toggle-opacity-plus', function(window, pane)
local overrides = window:get_config_overrides() or {}
if window:get_config_overrides() then
overrides.text_background_opacity = tonumber(string.format("%.2f",window:get_config_overrides().text_background_opacity))
overrides.window_background_opacity = tonumber(string.format("%.2f",window:get_config_overrides().window_background_opacity))
else
overrides.text_background_opacity = config.text_background_opacity
overrides.window_background_opacity = config.window_background_opacity
end
if overrides.window_background_opacity >= 0 and overrides.window_background_opacity < 1 then
overrides.text_background_opacity = overrides.text_background_opacity + 0.10
overrides.window_background_opacity = overrides.window_background_opacity + 0.10
window:set_config_overrides(overrides)
end
end)
wezterm.on('toggle-opacity-reset', function(window, pane)
local overrides = window:get_config_overrides() or {}
overrides.text_background_opacity = config.text_background_opacity
overrides.window_background_opacity = config.window_background_opacity
window:set_config_overrides(overrides)
end)
wezterm.on('set-previous-workspace', function(window, pane)
local current_workspace = window:active_workspace()
if wezterm.GLOBAL.previous_workspace ~= current_workspace then
wezterm.GLOBAL.previous_workspace = current_workspace
end
end)
return config
functions.lualocal wezterm = require("wezterm")
local action = wezterm.action
local F = {}
-- Check if file exists
function F.file_exists(name)
local file = io.open(name,"r")
if file ~= nil then
io.close(file)
return true
else
return false
end
end
-- Match the appearance to the system's style
function F.scheme_for_appearance(appearance, dark, light)
if appearance:find "Dark" then
return dark
else
return light
end
end
-- Get basename of path
function F.basename(string)
return string.gsub(string, "(.*[/\\])(.*)", "%2")
end
-- Define window title
function F.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 F.basename(tab_info.active_pane.title)
end
F.switch_workspace = function(window, pane, workspace)
local current_workspace = window:active_workspace()
if current_workspace == workspace then
return
end
window:perform_action(
action.SwitchToWorkspace({
name = workspace,
}),
pane
)
wezterm.GLOBAL.previous_workspace = current_workspace
end
F.switch_previous_workspace = function(window, pane)
local current_workspace = window:active_workspace()
local workspace = wezterm.GLOBAL.previous_workspace
if current_workspace == workspace or wezterm.GLOBAL.previous_workspace == nil then
return
end
F.switch_workspace(window, pane, workspace)
end
return F |
Beta Was this translation helpful? Give feedback.
-
show ya moves!
initial setup, no lsp for wren yet. aura theme for wezterm and boo berry theme for helix until i port aura.. :/ can't wait to add some crazy flashing text, lmao. don't quite know how to easily move the window without a title bar on windows-os.. :/ will update my configs over time! update: of note: wezterm handles bold, italics, dim, and even flashing text of helix beautifully. 👨🍳 (..but can't show flashing selection without video.. 😞) |
Beta Was this translation helpful? Give feedback.
-
I found WezTerm about 5 months ago - I'm late to the party, but I've been loving it! I smile a little bit every time I pull up this terminal. I rotate the memes but this one has stuck around for the last couple months. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
I'll start with my current work setup:
wezterm.lua
Beta Was this translation helpful? Give feedback.
All reactions