Created
March 17, 2024 09:39
-
-
Save ykhs/746c91b8210d7472a313c617feb973e9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local wezterm = require "wezterm" | |
local config = wezterm.config_builder() | |
local act = wezterm.action | |
-- Colors | |
config.color_scheme = "iceberg-dark" | |
-- Font | |
config.font = wezterm.font("Moralerspace Neon") | |
config.font_size = 16.0 | |
config.line_height = 1.3 | |
-- Tabs | |
config.use_fancy_tab_bar = false | |
config.tab_bar_at_bottom = true | |
-- Leader | |
config.leader = { key="t", mods="CTRL" } | |
-- Keys | |
config.keys = { | |
-- Launcher | |
{ | |
key = "t", | |
mods = "LEADER", | |
action = act.ShowLauncher, | |
}, | |
-- Workspaces menu | |
{ | |
key = "s", | |
mods = "LEADER", | |
action = act.ShowLauncherArgs { flags = "WORKSPACES" } | |
}, | |
-- Create new workspace with name input | |
{ | |
key = "S", | |
mods = "LEADER", | |
action = act.PromptInputLine { | |
description = wezterm.format { | |
{ Attribute = { Intensity = "Bold" } }, | |
{ Foreground = { AnsiColor = "Fuchsia" } }, | |
{ Text = "Enter name for new workspace" }, | |
}, | |
action = wezterm.action_callback(function(window, pane, line) | |
if line then | |
window:perform_action( | |
act.SwitchToWorkspace { | |
name = line, | |
}, | |
pane | |
) | |
end | |
end), | |
}, | |
}, | |
-- Rename workspace | |
{ | |
key = "r", | |
mods = "LEADER", | |
action = act.PromptInputLine { | |
description = "Enter name for current workspace", | |
action = wezterm.action_callback(function(window, pane, line) | |
if line then | |
wezterm.mux.rename_workspace( | |
wezterm.mux.get_active_workspace(), | |
line | |
) | |
end | |
end) | |
} | |
}, | |
-- Move to next/previous workspace | |
{ key = 'n', mods = 'LEADER', action = act.SwitchWorkspaceRelative(1) }, | |
{ key = 'p', mods = 'LEADER', action = act.SwitchWorkspaceRelative(-1) }, | |
-- Split pane | |
{ key = "-", mods = "LEADER", action = act.SplitVertical { domain = "CurrentPaneDomain" } }, | |
{ key = "\\", mods = "LEADER", action = act.SplitHorizontal { domain = "CurrentPaneDomain" } }, | |
-- Move pane | |
{ key = "h", mods = "LEADER", action = act.ActivatePaneDirection("Left") }, | |
{ key = "j", mods = "LEADER", action = act.ActivatePaneDirection("Down") }, | |
{ key = "k", mods = "LEADER", action = act.ActivatePaneDirection("Up") }, | |
{ key = "l", mods = "LEADER", action = act.ActivatePaneDirection("Right") }, | |
-- Copy mode | |
{ key = "[", mods = "LEADER", action = act.ActivateCopyMode }, | |
} | |
-- Show workspace name on left status | |
wezterm.on("update-status", function(window, pane) | |
local ws = wezterm.mux.get_active_workspace() | |
window:set_left_status(wezterm.format { | |
{ Text = " [Workspace: " .. ws .. "] " }, | |
}) | |
end) | |
-- Show current directory, date and time on right status | |
wezterm.on("update-status", function(window, pane) | |
local status = {} | |
local cwd_uri = pane:get_current_working_dir() | |
if (cwd_uri) then | |
table.insert(status, { Text = wezterm.nerdfonts.cod_folder .. " " .. cwd_uri.file_path } ) | |
table.insert(status, { Text = " " } ) | |
end | |
local date = wezterm.strftime("%Y-%m-%d") | |
table.insert(status, { Text = wezterm.nerdfonts.md_calendar .. " " .. date } ) | |
table.insert(status, { Text = " " }) | |
local time = wezterm.strftime("%H:%M") | |
table.insert(status, { Text = wezterm.nerdfonts.md_clock .. " " .. time } ) | |
table.insert(status, { Text = " " }) | |
window:set_right_status(wezterm.format(status)) | |
end) | |
return config |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment