terminal: wezterm WIP or something
This commit is contained in:
@@ -39,69 +39,163 @@ in {
|
||||
{ key = '${keys.up}', mods = 'CTRL|SHIFT', action = act.ActivatePaneDirection 'Up' },
|
||||
{ key = '${keys.right}', mods = 'CTRL|SHIFT', action = act.ActivatePaneDirection 'Right' },
|
||||
'';
|
||||
in ''
|
||||
local wezterm = require 'wezterm'
|
||||
local act = wezterm.action
|
||||
return {
|
||||
front_end = 'WebGpu',
|
||||
unix_domains = {
|
||||
{
|
||||
name = 'unix',
|
||||
},
|
||||
},
|
||||
enable_kitty_graphics = true,
|
||||
window_padding = {
|
||||
left = 0,
|
||||
right = 0,
|
||||
top = 0,
|
||||
bottom = 0,
|
||||
},
|
||||
use_fancy_tab_bar = false,
|
||||
inactive_pane_hsb = {
|
||||
-- saturation = 0.8,
|
||||
brightness = 0.7,
|
||||
},
|
||||
-- window_frame = {
|
||||
-- font = wezterm.font { family = 'Cantarell', weight = 'Bold' },
|
||||
-- },
|
||||
disable_default_key_bindings = true,
|
||||
leader = { key = 'Space', mods = 'CTRL', timeout_milliseconds = 2000 },
|
||||
keys = {
|
||||
{ key = 'Enter', mods = 'SHIFT|CTRL', action = act.ActivateCopyMode },
|
||||
{ key = 'R', mods = 'SHIFT|CTRL', action = act.ReloadConfiguration },
|
||||
{ key = '=', mods = 'CTRL', action = act.IncreaseFontSize },
|
||||
{ key = '-', mods = 'CTRL', action = act.DecreaseFontSize },
|
||||
{ key = '0', mods = 'CTRL', action = act.ResetFontSize },
|
||||
{ key = 'C', mods = 'SHIFT|CTRL', action = act.CopyTo 'Clipboard' },
|
||||
-- { key = 'N', mods = 'SHIFT|CTRL', action = act.SpawnWindow },
|
||||
{ key = 'l', mods = 'SHIFT|CTRL', action = act.CharSelect{ copy_on_select = true, copy_to = 'ClipboardAndPrimarySelection' } },
|
||||
{ key = 'v', mods = 'SHIFT|CTRL', action = act.PasteFrom 'Clipboard' },
|
||||
{ key = '<', mods = 'CTRL|SHIFT', action = act.ActivateTabRelative(-1) },
|
||||
{ key = '>', mods = 'CTRL|SHIFT', action = act.ActivateTabRelative(1) },
|
||||
{ key = 'Tab', mods = 'CTRL|SHIFT', action = act.ActivateTabRelative(-1) },
|
||||
{ key = 'Tab', mods = 'CTRL', action = act.ActivateTabRelative(1) },
|
||||
{ key = '%', mods = 'SHIFT|CTRL', action = act.SplitVertical { domain = 'CurrentPaneDomain' }, },
|
||||
{ key = '"', mods = 'SHIFT|CTRL', action = act.SplitHorizontal { domain = 'CurrentPaneDomain' }, },
|
||||
-- pane navigation
|
||||
${genNavigation arrows}
|
||||
${genNavigation homerow-arrows}
|
||||
in
|
||||
# lua
|
||||
''
|
||||
local wezterm = require 'wezterm'
|
||||
local act = wezterm.action
|
||||
|
||||
{ key = 't', mods = 'SHIFT|CTRL', action = act.SpawnTab 'CurrentPaneDomain' },
|
||||
{ key = 'w', mods = 'SHIFT|CTRL', action = act.CloseCurrentTab{ confirm = false } },
|
||||
{ key = 'f', mods = 'SHIFT|CTRL', action = act.CloseCurrentPane{ confirm = false } },
|
||||
{ key = 'b', mods = 'LEADER|CTRL', action = act.SendString '\x02', },
|
||||
{ key = 'Enter', mods = 'LEADER', action = act.ActivateCopyMode, },
|
||||
{ key = 'p', mods = 'LEADER', action = act.PasteFrom 'PrimarySelection', },
|
||||
{ key = 'k', mods = 'SHIFT|CTRL', action = act.Multiple
|
||||
{
|
||||
act.ClearScrollback 'ScrollbackAndViewport',
|
||||
act.SendKey { key = 'L', mods = 'CTRL' },
|
||||
},
|
||||
},
|
||||
{ key = 'r', mods = 'LEADER', action = act.ActivateKeyTable { name = 'resize_pane', one_shot = false, }, }
|
||||
},
|
||||
}
|
||||
'';
|
||||
local resurrect = wezterm.plugin.require("https://github.com/MLFlexer/resurrect.wezterm")
|
||||
local workspace_switcher = wezterm.plugin.require("https://github.com/MLFlexer/smart_workspace_switcher.wezterm")
|
||||
|
||||
wezterm.on("augment-command-palette", function(window, pane)
|
||||
local workspace_state = resurrect.workspace_state
|
||||
return {
|
||||
{
|
||||
brief = "Window | Workspace: Switch Workspace",
|
||||
icon = "md_briefcase_arrow_up_down",
|
||||
action = workspace_switcher.switch_workspace(),
|
||||
},
|
||||
{
|
||||
brief = "Window | Workspace: Rename Workspace",
|
||||
icon = "md_briefcase_edit",
|
||||
action = wezterm.action.PromptInputLine({
|
||||
description = "Enter new name for workspace",
|
||||
action = wezterm.action_callback(function(window, pane, line)
|
||||
if line then
|
||||
wezterm.mux.rename_workspace(wezterm.mux.get_active_workspace(), line)
|
||||
resurrect.state_manager.save_state(workspace_state.get_workspace_state())
|
||||
end
|
||||
end),
|
||||
}),
|
||||
},
|
||||
}
|
||||
end)
|
||||
|
||||
|
||||
return {
|
||||
front_end = 'WebGpu',
|
||||
unix_domains = {
|
||||
{
|
||||
name = 'unix',
|
||||
},
|
||||
},
|
||||
enable_kitty_graphics = true,
|
||||
window_padding = {
|
||||
left = 0,
|
||||
right = 0,
|
||||
top = 0,
|
||||
bottom = 0,
|
||||
},
|
||||
use_fancy_tab_bar = false,
|
||||
inactive_pane_hsb = {
|
||||
-- saturation = 0.8,
|
||||
brightness = 0.7,
|
||||
},
|
||||
-- window_frame = {
|
||||
-- font = wezterm.font { family = 'Cantarell', weight = 'Bold' },
|
||||
-- },
|
||||
disable_default_key_bindings = true,
|
||||
leader = { key = 'Space', mods = 'CTRL', timeout_milliseconds = 2000 },
|
||||
keys = {
|
||||
{
|
||||
key = "w",
|
||||
mods = "LEADER",
|
||||
action = resurrect.window_state.save_window_action(),
|
||||
},
|
||||
{
|
||||
key = "t",
|
||||
mods = "LEADER",
|
||||
action = resurrect.tab_state.save_tab_action(),
|
||||
},
|
||||
{
|
||||
key = "s",
|
||||
mods = "LEADER",
|
||||
action = wezterm.action_callback(function(win, pane)
|
||||
resurrect.state_manager.save_state(resurrect.workspace_state.get_workspace_state())
|
||||
resurrect.window_state.save_window_action()
|
||||
end),
|
||||
},
|
||||
{
|
||||
key = "r",
|
||||
mods = "LEADER",
|
||||
action = wezterm.action_callback(function(win, pane)
|
||||
resurrect.fuzzy_loader.fuzzy_load(win, pane, function(id, label)
|
||||
local type = string.match(id, "^([^/]+)") -- match before '/'
|
||||
id = string.match(id, "([^/]+)$") -- match after '/'
|
||||
id = string.match(id, "(.+)%..+$") -- remove file extention
|
||||
local opts = {
|
||||
relative = true,
|
||||
restore_text = true,
|
||||
on_pane_restore = resurrect.tab_state.default_on_pane_restore,
|
||||
}
|
||||
if type == "workspace" then
|
||||
local state = resurrect.state_manager.load_state(id, "workspace")
|
||||
resurrect.workspace_state.restore_workspace(state, opts)
|
||||
elseif type == "window" then
|
||||
local state = resurrect.state_manager.load_state(id, "window")
|
||||
resurrect.window_state.restore_window(pane:window(), state, opts)
|
||||
elseif type == "tab" then
|
||||
local state = resurrect.state_manager.load_state(id, "tab")
|
||||
resurrect.tab_state.restore_tab(pane:tab(), state, opts)
|
||||
end
|
||||
end)
|
||||
end),
|
||||
},
|
||||
{
|
||||
key = "d",
|
||||
mods = "LEADER",
|
||||
action = wezterm.action_callback(function(win, pane)
|
||||
resurrect.fuzzy_loader.fuzzy_load(win, pane, function(id)
|
||||
resurrect.state_manager.delete_state(id)
|
||||
end,
|
||||
{
|
||||
title = "Delete State",
|
||||
description = "Select State to Delete and press Enter = accept, Esc = cancel, / = filter",
|
||||
fuzzy_description = "Search State to Delete: ",
|
||||
is_fuzzy = true,
|
||||
})
|
||||
end),
|
||||
},
|
||||
{
|
||||
key = 'p',
|
||||
mods = 'LEADER',
|
||||
action = wezterm.action.ActivateCommandPalette,
|
||||
},
|
||||
{ key = 'Enter', mods = 'SHIFT|CTRL', action = act.ActivateCopyMode },
|
||||
{ key = 'R', mods = 'SHIFT|CTRL', action = act.ReloadConfiguration },
|
||||
{ key = '=', mods = 'CTRL', action = act.IncreaseFontSize },
|
||||
{ key = '-', mods = 'CTRL', action = act.DecreaseFontSize },
|
||||
{ key = '0', mods = 'CTRL', action = act.ResetFontSize },
|
||||
{ key = 'C', mods = 'SHIFT|CTRL', action = act.CopyTo 'Clipboard' },
|
||||
-- { key = 'N', mods = 'SHIFT|CTRL', action = act.SpawnWindow },
|
||||
{ key = 'l', mods = 'SHIFT|CTRL', action = act.CharSelect{ copy_on_select = true, copy_to = 'ClipboardAndPrimarySelection' } },
|
||||
{ key = 'v', mods = 'SHIFT|CTRL', action = act.PasteFrom 'Clipboard' },
|
||||
{ key = '<', mods = 'CTRL|SHIFT', action = act.ActivateTabRelative(-1) },
|
||||
{ key = '>', mods = 'CTRL|SHIFT', action = act.ActivateTabRelative(1) },
|
||||
{ key = 'Tab', mods = 'CTRL|SHIFT', action = act.ActivateTabRelative(-1) },
|
||||
{ key = 'Tab', mods = 'CTRL', action = act.ActivateTabRelative(1) },
|
||||
{ key = '%', mods = 'SHIFT|CTRL', action = act.SplitVertical { domain = 'CurrentPaneDomain' }, },
|
||||
{ key = '"', mods = 'SHIFT|CTRL', action = act.SplitHorizontal { domain = 'CurrentPaneDomain' }, },
|
||||
-- pane navigation
|
||||
${genNavigation arrows}
|
||||
${genNavigation homerow-arrows}
|
||||
|
||||
{ key = 't', mods = 'SHIFT|CTRL', action = act.SpawnTab 'CurrentPaneDomain' },
|
||||
{ key = 'w', mods = 'SHIFT|CTRL', action = act.CloseCurrentTab{ confirm = false } },
|
||||
{ key = 'f', mods = 'SHIFT|CTRL', action = act.CloseCurrentPane{ confirm = false } },
|
||||
{ key = 'b', mods = 'LEADER|CTRL', action = act.SendString '\x02', },
|
||||
{ key = 'Enter', mods = 'LEADER', action = act.ActivateCopyMode, },
|
||||
-- { key = 'p', mods = 'LEADER', action = act.PasteFrom 'PrimarySelection', },
|
||||
{ key = 'k', mods = 'SHIFT|CTRL', action = act.Multiple
|
||||
{
|
||||
act.ClearScrollback 'ScrollbackAndViewport',
|
||||
act.SendKey { key = 'L', mods = 'CTRL' },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user