Skip to content

Instantly share code, notes, and snippets.

@adam-beck
Created February 17, 2025 12:46
Show Gist options
  • Save adam-beck/6fc70bd1dfb4d053607e9f6d2ffafe06 to your computer and use it in GitHub Desktop.
Save adam-beck/6fc70bd1dfb4d053607e9f6d2ffafe06 to your computer and use it in GitHub Desktop.
Wezterm
local wezterm = require 'wezterm'
local act = wezterm.action
local config = wezterm.config_builder()
config.tab_bar_at_bottom = true
config.font = wezterm.font 'JetBrainsMono NF'
local tabline = wezterm.plugin.require("https://github.com/michaelbrusegard/tabline.wez")
tabline.setup({
options = {
tabs_enabled = false
}
})
tabline.apply_to_config(config)
-- This has to come after the call to `tabline.apply_to_config`
-- as the plugin will override it
config.window_decorations = "TITLE | RESIZE"
wezterm.on('augment-command-palette', function(window, pane)
return {
{
brief = 'Rename tab',
icon = 'md_rename_box',
action = act.PromptInputLine {
description = 'Enter new name for tab',
action = wezterm.action_callback(function(window, pane, line)
if line then
window:active_tab():set_title(line)
end
end),
},
},
}
end)
config.color_scheme = 'Bamboo'
config.leader = { key = 'a', mods = 'CTRL', timeout_milliseconds = 1000 }
config.keys = {
{
key = ',',
mods = 'LEADER',
action = act.PromptInputLine {
description = 'Enter new name for tab',
-- initial_value = 'My Tab Name',
action = wezterm.action_callback(function(window, pane, line)
-- line will be `nil` if they hit escape without entering anything
-- An empty string if they just hit enter
-- Or the actual line of text they wrote
if line then
window:active_tab():set_title(line)
end
end),
},
},
{
key = 'l',
mods = 'LEADER|SHIFT',
action = act.ActivateLastTab,
},
{
key = 'c',
mods = 'LEADER',
action = act.SpawnTab 'CurrentPaneDomain',
},
{
key = 'n',
mods = 'LEADER',
action = act.ActivateTabRelative(1),
},
{
key = 'p',
mods = 'LEADER',
action = act.ActivateTabRelative(-1),
},
{
key = '|',
mods = 'LEADER|SHIFT',
action = wezterm.action.SplitHorizontal { domain = 'CurrentPaneDomain' },
},
{
key = '-',
mods = 'LEADER',
action = wezterm.action.SplitVertical { domain = 'CurrentPaneDomain' },
},
{
key = 'h',
mods = 'LEADER',
action = act.ActivatePaneDirection 'Left',
},
{
key = 'l',
mods = 'LEADER',
action = act.ActivatePaneDirection 'Right',
},
{
key = 'k',
mods = 'LEADER',
action = act.ActivatePaneDirection 'Up',
},
{
key = 'j',
mods = 'LEADER',
action = act.ActivatePaneDirection 'Down',
},
-- Send "CTRL-A" to the terminal when pressing CTRL-A, CTRL-A
{
key = 'a',
mods = 'LEADER|CTRL',
action = wezterm.action.SendKey { key = 'a', mods = 'CTRL' },
},
}
return config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment