terminal: wezterm WIP or something
This commit is contained in:
@@ -39,9 +39,40 @@ in {
|
|||||||
{ key = '${keys.up}', mods = 'CTRL|SHIFT', action = act.ActivatePaneDirection 'Up' },
|
{ key = '${keys.up}', mods = 'CTRL|SHIFT', action = act.ActivatePaneDirection 'Up' },
|
||||||
{ key = '${keys.right}', mods = 'CTRL|SHIFT', action = act.ActivatePaneDirection 'Right' },
|
{ key = '${keys.right}', mods = 'CTRL|SHIFT', action = act.ActivatePaneDirection 'Right' },
|
||||||
'';
|
'';
|
||||||
in ''
|
in
|
||||||
|
# lua
|
||||||
|
''
|
||||||
local wezterm = require 'wezterm'
|
local wezterm = require 'wezterm'
|
||||||
local act = wezterm.action
|
local act = wezterm.action
|
||||||
|
|
||||||
|
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 {
|
return {
|
||||||
front_end = 'WebGpu',
|
front_end = 'WebGpu',
|
||||||
unix_domains = {
|
unix_domains = {
|
||||||
@@ -67,6 +98,70 @@ in {
|
|||||||
disable_default_key_bindings = true,
|
disable_default_key_bindings = true,
|
||||||
leader = { key = 'Space', mods = 'CTRL', timeout_milliseconds = 2000 },
|
leader = { key = 'Space', mods = 'CTRL', timeout_milliseconds = 2000 },
|
||||||
keys = {
|
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 = 'Enter', mods = 'SHIFT|CTRL', action = act.ActivateCopyMode },
|
||||||
{ key = 'R', mods = 'SHIFT|CTRL', action = act.ReloadConfiguration },
|
{ key = 'R', mods = 'SHIFT|CTRL', action = act.ReloadConfiguration },
|
||||||
{ key = '=', mods = 'CTRL', action = act.IncreaseFontSize },
|
{ key = '=', mods = 'CTRL', action = act.IncreaseFontSize },
|
||||||
@@ -91,14 +186,13 @@ in {
|
|||||||
{ key = 'f', mods = 'SHIFT|CTRL', action = act.CloseCurrentPane{ confirm = false } },
|
{ key = 'f', mods = 'SHIFT|CTRL', action = act.CloseCurrentPane{ confirm = false } },
|
||||||
{ key = 'b', mods = 'LEADER|CTRL', action = act.SendString '\x02', },
|
{ key = 'b', mods = 'LEADER|CTRL', action = act.SendString '\x02', },
|
||||||
{ key = 'Enter', mods = 'LEADER', action = act.ActivateCopyMode, },
|
{ key = 'Enter', mods = 'LEADER', action = act.ActivateCopyMode, },
|
||||||
{ key = 'p', mods = 'LEADER', action = act.PasteFrom 'PrimarySelection', },
|
-- { key = 'p', mods = 'LEADER', action = act.PasteFrom 'PrimarySelection', },
|
||||||
{ key = 'k', mods = 'SHIFT|CTRL', action = act.Multiple
|
{ key = 'k', mods = 'SHIFT|CTRL', action = act.Multiple
|
||||||
{
|
{
|
||||||
act.ClearScrollback 'ScrollbackAndViewport',
|
act.ClearScrollback 'ScrollbackAndViewport',
|
||||||
act.SendKey { key = 'L', mods = 'CTRL' },
|
act.SendKey { key = 'L', mods = 'CTRL' },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ key = 'r', mods = 'LEADER', action = act.ActivateKeyTable { name = 'resize_pane', one_shot = false, }, }
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
|
|||||||
Reference in New Issue
Block a user