mirror of
https://github.com/blahai/nyx.git
synced 2025-06-10 18:03:01 -04:00
add wezterm config (borrowed from isabel)
This commit is contained in:
parent
c85a317bc8
commit
26de676486
9 changed files with 1112 additions and 80 deletions
77
modules/home-manager/cli/wezterm/keybinds.lua
Normal file
77
modules/home-manager/cli/wezterm/keybinds.lua
Normal file
|
@ -0,0 +1,77 @@
|
|||
local wezterm = require("wezterm")
|
||||
local act = wezterm.action
|
||||
|
||||
local utils = require("utils")
|
||||
|
||||
local M = {}
|
||||
|
||||
local openUrl = act.QuickSelectArgs({
|
||||
label = "open url",
|
||||
patterns = { "https?://\\S+" },
|
||||
action = wezterm.action_callback(function(window, pane)
|
||||
local url = window:get_selection_text_for_pane(pane)
|
||||
wezterm.open_with(url)
|
||||
end),
|
||||
})
|
||||
|
||||
local changeCtpFlavor = act.InputSelector({
|
||||
title = "Change Catppuccin flavor",
|
||||
choices = {
|
||||
{ label = "Evergarden" },
|
||||
{ label = "Espresso" },
|
||||
{ label = "Mocha" },
|
||||
{ label = "Macchiato" },
|
||||
{ label = "Frappe" },
|
||||
{ label = "Latte" },
|
||||
},
|
||||
action = wezterm.action_callback(function(window, _, _, label)
|
||||
if label then
|
||||
window:set_config_overrides({ color_scheme = "Catppuccin " .. label })
|
||||
end
|
||||
end),
|
||||
})
|
||||
|
||||
local getNewName = 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),
|
||||
})
|
||||
|
||||
local keys = {}
|
||||
local map = function(key, mods, action)
|
||||
if type(mods) == "string" then
|
||||
table.insert(keys, { key = key, mods = mods, action = action })
|
||||
elseif type(mods) == "table" then
|
||||
for _, mod in pairs(mods) do
|
||||
table.insert(keys, { key = key, mods = mod, action = action })
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
map("Enter", "ALT", act.ToggleFullScreen)
|
||||
|
||||
map("e", "CTRL|SHIFT", getNewName)
|
||||
map("o", { "LEADER", "SUPER" }, openUrl)
|
||||
map("t", "ALT", changeCtpFlavor)
|
||||
|
||||
local mods
|
||||
if utils.is_windows() then
|
||||
mods = "ALT"
|
||||
else
|
||||
mods = "SUPER"
|
||||
end
|
||||
|
||||
M.apply = function(c)
|
||||
c.leader = {
|
||||
key = " ",
|
||||
mods = mods,
|
||||
timeout_milliseconds = math.maxinteger,
|
||||
}
|
||||
c.keys = keys
|
||||
-- c.disable_default_key_bindings = true
|
||||
end
|
||||
|
||||
return M
|
Loading…
Add table
Add a link
Reference in a new issue